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: 
Former Member

This blog will explain how to implement multi-level create deep.

Prerequisite, please make sure you are familiar with create deep implementation via Gateway:

Step by Step development for CREATE_DEEP_ENTITY operation

For multi-level create deep, we assume this following scenario:

Here, FirstSon & SecondSon are the first-level deep of father, FirstGrandSon is the first-level of FirstSon but second-level of Father.

Then How to implement this create-deep scenario?

1. Create entities/associations in SEGW which map to this relationship.

     Four entities are created: Father/FirstSon/SecondSon/FirstGrandson; Each entity has three properties: Key/Property1/Property2

     Three associations are created: "Father to FirstSon" & "Father to SecondSon" & "FirstSon to FirstGrandSon"

2. Generate and register the ODate Service.

     I assume you are familiar with these general Gateway steps :smile: .

3. Implement  create_deep_entity method.

     First create the multi-level deep structure which can holds the nested data from input; Then use  io_data_provider to get the input.

     Here I just write simple code snippet, as long as we can get nested data in the runtime.

4. Test in RestClient

     I used to try to test the multi-level create deep in our traditional GW client and using XML format as payload. Nested data can be transferred into our create_deep_entity method, but the position of the nested data in second level is wrong. Thus, I strongly suggested to use JSON format as payload. Since our GW Client doesn't have a good support json fromat. I recommend to use the RestClient. (In RestClient you have to first get CSRF token and then post)




    "Key": "Father-Key",

    "Property1": "Father-Property-1",

    "Property2": "Father-Property-2",

    "FirstSon": [


            "Key": "FirstSon-Key-1",

            "Property1": "Firstson-Property-1",

            "Property2": "Firstson-Property-2",

            "FirstGrandson": [


                    "Key": "GrandSon-Key-1",

                    "Property1": "GrandSon-Property-1",

                    "Property2": "GrandSon-Property-2"





            "Key": "FirstSon-Key-2",

            "Property1": "Firstson-Property-3",

            "Property2": "Firstson-Property-4",

            "FirstGrandson": [


                    "Key": "GrandSon-Key-2",

                    "Property1": "GrandSon-Property-3",

                    "Property2": "GrandSon-Property-4"



                    "Key": "GrandSon-Key-3",

                    "Property1": "GrandSon-Property-5",

                    "Property2": "GrandSon-Property-6"





    "SecondSon": [


            "Key": "SecondSon-Key-1",

            "Property1": "SecondSon-Property-1",

            "Property2": "SecondSon-Property-2"



            "Key": "SecondSon-Key-2",

            "Property1": "SecondSon-Property-3",

            "Property2": "SecondSon-Property-4"



            "Key": "SecondSon-Key-3",

            "Property1": "SecondSon-Property-5",

            "Property2": "SecondSon-Property-6"




5. Check if the multi-level nested data is mapping to the right position in our runtime.


Father-level data:

Son-level data (deep to father):

Grandson-level data (deep to FirstSon):

     FirstSon[1] has one entry; FristSon[2] has two entry; as payload expected.

Now we get the multi-level nested data in the right position, then we can do anything we want in following :smile: .

Hope it helps!