Skip to content

Allow sending fields with null value in create and update batch requests #1170

@JimmyDZH

Description

@JimmyDZH

Describe the Problem

When we set specific fields to 'null' in our 'create batch' requests, the fields with 'null' values are excluded from the request and are therefore not passed to the SAP system.

SAP allows null values in addition to its initial values with the field annotation "@Semantics.nullValueIndicatorFor:"

With the SDK when we use the following to create an entity with the field "AuszahlungsbetragTatsächlich" and set its value to null explicitly. it seems that the field with the value 'null' is not being sent to the SAP system, which in turn results in the entity being created with an initial value instead of the passed null value.

We encounter the same issue with a put or patch update request. Setting the field spefically to null will set the field to initial.

Is there a way to specifically send the null fields during a create and update batch request?

antrag.setAuszahlungsbetragTatsaechlich(null);
    var createAntragRequest = odataService.createAntrag(antrag);

    try (BatchResponse result =
        odataService.batch().addChangeset(createAntragRequest).execute(destination)) {
 
      Antrag createdAntrag = result.getModificationResult(createAntragRequest).getModifiedEntity();
 
      return sapAntragToEntityMapper.mapAntrag(createdAntrag);
    }

Response after Creation via SDK:
Image

Setting it via postman manually is working as intended:

Request:
Image

Response:

Image

Propose a Solution

It would be helpful to be able to configure the SDK to allow sending of fields with null values, since SAP allows null values.

For example a configuration setting "alwaysSendNullValues" that can be set globally or per request.

Describe Alternatives

No response

Affected Development Phase

Development

Impact

Impaired

Timeline

Go-Live in 1-2 months.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions