Your requirement is to create data using the OData Service and for the related KUT field. Upon executing the OData Service, data is created in system, but the issue is with KUT field which is ZField, where the data is not uploaded. Although the required value is passed in the Request payload for the KUT field, the field appears blank.
where ZField is the KUT field
myxxxxxx represents the tenant
Yyyyyyyyyy is the object in OData Collection
SAP Cloud for Customer
Reproducing the Issue
Execute the POST method for the below Service in OData Service Explorer:
- Go to Administrator work center
- Go to OData Service Explorer view
- Show SAP OData Services
- Highlight the Service name c4codataapi and select Test
- On the OData Console, in the left pane, select the required Entity Set
- Select the Test tab
- Select the POST method for https://myxxxxxx.crm.ondemand.com/sap/c4c/odata/v1/c4codataapi/YyyyyyyyyyCollection
- Input data for the required fields
- Select Execute
You receive a Response that the data is successfully created.
Verify the data in the respective work center view and observe that only KUT field ZField is still blank.
The affected extension field has extension scenario where at runtime, the value gets overwritten from source Business Object.
Consider the below OData Service, for which the data for KUT field ZField is not uploaded when you execute the POST method.
In this case, source Business Object is PDM_MATERIAL. It is an expected behavior that whenever an extension scenario is enabled, a value from payload will get overwritten by value from source Business Object. In this example, source Business Object has no value for given extension field for given instance.
For the POST method to execute successfully, disable the extension scenario for the affected KUT field or create an extension field without any extension scenario. Thereafter, execute the POST method for the respective OData Service.
Whereas, in the Update scenario (PATCH method), the extension scenario does not work. That is, during Update scenario, the application is not calling the extension scenario. This is the designed behaviour.
Therefore, you may use one of the below options:
1. Use a field that is not linked to the extension scenario, so that the data which is being passed in the OData gets reflected in the extension field on the Business Object without being overwritten by the value from the source Business Object.
In the above example, use a field that is not linked to the extension scenario, so that the data which is being passed in the OData gets reflected in the extension field on /IBASE/INSTALL_POINT BO without being overwritten by the value from the source Business Object PDM_MATERIAL.
2. You can perform 2 calls of OData. That is, first a Create call and then an Update call on the same extension field.
OData, _KUT, KUT, Extension field, Extension scenario, PDM_MATERIAL, Business Object, Registered Product, RegisteredProduct, POST, PATCH , KBA , registeredproduct , extension field , extension scenario , business object, , pdm_material , kut , odata , registered product , LOD-CRM-INT-API , OData API (C4C Only) , Problem