Technology Blogs by SAP
Learn how to extend and personalize SAP applications. Follow the SAP technology blog for insights into SAP BTP, ABAP, SAP Analytics Cloud, SAP HANA, and more.
Showing results for 
Search instead for 
Did you mean: 
This is related to integration of any source system (ECC/ThirdParty/SAP Cloud system) with SAP S/4HANA Cloud. As there are various Odata services has been provided as whitelisted API and these can be viewed in API HUB portal. For most of integrations in CPI, we need to use ODATA APIs to create/change/update data in target system. Several times, we used to have requirement to send data for multiple entities for deep insert. For instance, if we are going to create Sales order then Sales order header and Item, both entities data needs to be passed to target system. Here the challenge comes during mapping and request/reply call for multiple/deep insert entities that to be used in Message Mapping steps flow. Hence, in this blog post, I am going to explain how to create and use XSD (XML Schema Definition) file that can be used in mapping step for these requirements.

Problem Description: During mapping step when we select target structure (Odata API) then the default integration flow will have only the root entities in the mapping. Like in below case when we select EMDX file that has been downloaded from API HUB, there will be a pop-up to select a particular entity, we cannot select multiple entities and unable to create navigation to deep entity as well. We can only do mapping for one entity set.

Only one entity can be selected as shown below:



Solution: To get XSD file that need to be used in Message Mapping, the solution is to create Odata call first in Request Reply step and use OData as Receiver adapter. As required, add connection details for S/4HANA Cloud ODATA API in Connection tab (Address and Credentials).

Next, in Processing tab, open the Query Wizard.

In query wizard Select Create operation with sub levels.

Selecting sub levels is most important step here, because then only you would be able to see deep entity set and navigation to select the required dataset. A maximum of 05 sub levels can be selected.

Below down in fields catalogue you would see navigation to deep entity set, use them and select required data.

After done all entity and field selection, choose Finish to close the Query Wizard. Instantly, you will see one XSD file has been created and available to use in mapping. The same you can check also in Resources tab.

Now, go to Message Mapping step and in target source message (right side), select the XSD file that has been created in last step.


After selecting, you would be able to see deep entity and all the fields that has been selected during Odata Query wizard and next you would be able to do binding with source structure fields accordingly.

Conclusion:  As OData is preferable API to be used in SAP CPI, so explained above how this can be used in deep Insert scenarios.

Thanks for reading, if you wish to know more, or have any queries, then please feel free to contact or drop a note here.