Search code examples
s4sdk

S/4HANA Cloud SDK: Create sales order with reference to a sales contract


I would like to create a sales order with reference to a sales contract using the S/4HANA Cloud SDK. I do not see a get/set method for ReferenceSDDocument at the header- or item-level in the com.sap.cloud.sdk.s4hana.datamodel.odata.namespaces.salesorder.SalesOrder class, even though it is shown in the sample JSON-body in the POST of /A_SalesOrder in the API Hub. Not sure if I should be somehow using the SalesOrderField class, or something else ... or should be switching to the SOAP API.


Solution

  • As you are using version 1.11.1 of the S/4HANA Cloud SDK you have the OData VDM that corresponds to the state of S/4HANA at this point in time.

    You now have two options:

    1. Use the newer scp-neo-javaee7 archetype. This exists in version 2.13.2 and supports the latest S/4HANA version.
    2. Create your own OData VDM for your system, check this blog for more information on how to do this.