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.
cancel
Showing results for 
Search instead for 
Did you mean: 
Kamal_Jain
Advisor
Advisor
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.
7 Comments
Saumitra
Product and Topic Expert
Product and Topic Expert
0 Kudos
Great blog & illustration kamal.jain4
former_member226
Employee
Employee
0 Kudos
Indeed it is one of those "hidden" features of CPI. Thank for sharing the trick!
Kamal_Jain
Advisor
Advisor
0 Kudos
Adding this comment to let you know that one additional feature has been given in the step of the Odata call query wizard. There is a checkbox provided to "Generate XML Schema Definition". Upon selecting this checkbox an XSD file will be generated that needs to be consumed in the message mapping step. In case if XSD file already exists it will provide an option either to overwrite the existing file or create a new file.
0 Kudos

Thanks for that . WHats the problem when I dont see the fields in the sublevel .  I see that in Get but not Create . Is that an Issue on the Odata description?

vvaree
Explorer
0 Kudos
Is there an option for PATCH ? This option doesn't seem to work for PATCH .For example , Can we combine Sales order header and Sales order item patch in one.
Kamal_Jain
Advisor
Advisor
0 Kudos
No, for patch we can only update one entity at a time.
Gunter
Product and Topic Expert
Product and Topic Expert
0 Kudos
You hint should be in a golden frame and on the help entry page 😀 Thank you very much Kamal!