Skip to Content

Patch issue "PATCH requests require components to be updated" when invoking S/4HANA Cloud SDK

Hello experts,

I am investigating S/4HANA Cloud SDK to update existing business partner.

@Override
public ODataUpdateResult run() throws ODataException {
ODataUpdateResult updateResult = new DefaultBusinessPartnerService()
.updateBusinessPartner(businessPartner)
.execute();
logger.info("Update Business Partner successfully");
return updateResult;
}

Request payload is

{
"BusinessPartner": "1521",
"LastName": "jerry",
"FirstName": "zhang"
}

I always got error "PATCH requests require components to be updated".

It seems that the code does not know which Business Partner is to be updated.

Could you please give some ideas?

Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

2 Answers

  • May 20 at 06:56 AM

    Hi Jerry,

    we are currently investigating in this issue. As a quick workaround you might have a look here: https://github.com/SAP/cloud-s4-sdk-examples/issues/73

    With version 2.16.0 we introduced a new method on the update call chain: replacingEntity()

    This will send your request as a PUT request, which should not throw the described issue.

    But to better understand the underlying issue, can you provide the following information:

    • Which version of the SAP Cloud SDK are you using?
    • What kind of system are you calling (cloud or on-premise)? And which version (if applicable)?

    Greetings

    Chris

    Add comment
    10|10000 characters needed characters exceeded

    • Hi Jerry,

      okay, now I think I understood. So you never use the setter methods but want a (potentially) changed BusinessPartner object retrieved via Spring desirialization to be sent to the S/4 system.

      This is not the use case we build the default behavior of the update function ("updateEntity", sending only changed fields via PATCH) around, so using the "replaceEntity" option (sending all fields via PUT) is the intended use.

      We will discuss internally how we can adjust the documentation/behavior to better suit the expectations.

      But thanks again for your detailed responses!

      Greetings

      Chris

  • May 20 at 12:56 PM

    I have a new issue with replacingEntity(). I am using SpringBoot with Cloud SDK. Cloud you please advise?

    com.fasterxml.jackson.databind.exc.InvalidDefinitionException: No serializer found for class java.util.Collections$3 and no properties discovered to create BeanSerializer (to avoid exception, disable SerializationFeature.FAIL_ON_EMPTY_BEANS) (through reference chain: com.sap.cloud.sdk.odatav2.connectivity.ODataUpdateResult["headerNames"])

    Add comment
    10|10000 characters needed characters exceeded