Skip to Content

creating Multiple orders with multiple items

Hi Experts

How to proceed to create multiple orders  with with multiple items in gateway(ODATA)?

as for i know Deep insert is used for Creating Header with Item

Batch is used for Multiple entries creation ( Not for header with item )

My requirement is

Customer   material  quantity      value

1000          a1          2               200

1000          a2          3               300

2000          b1          2               200

2000          b2          3               300

At single Url i want create 2 orders with customer wise

first order should be below items

1000          a1          2               200

1000          a2          3               300

Second order should be below items

2000          b1          2               200

2000          b2          3               300

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • avatar image
    Former Member
    Sep 18, 2015 at 05:16 PM

    Hello Hussain,

    Yes its possible with Create_Deep_Entity implementation.

    I suggest as below.

    Below is for your quick reference to give idea how to proceed.

    Create 3 entities :

    1. Dummy

    2. Header

    3. Item

    Here entity Dummy is just a dummy one and entities Header & Item will be having your actual properties required as per your scenario.

    Association :

    Create Association between entities Dummy and Header and maintain cardinality as 1 to N

    Create Association between entities Header and Item and maintain cardinality as 1 to N


    Navigation :

    Create navigation ' Hdrs ' under the entity ' Dummy ' . This links Dummy and Header entities

    Create navigation ' Itms ' under the entity ' Header ' . This links Header and Item entities


    Deep Structure Declaration ->

      data: BEGIN OF ls_itm.

              INCLUDE TYPE ZCL_ZGW_XXXX_MPC=>TS_Header.

      data: Itms TYPE TABLE OF ZCL_ZGW_XXXX_MPC=>TS_item WITH DEFAULT KEY,

            end of ls_itm.

      data: BEGIN OF ls_deep,

        operation TYPE ZCL_ZGW_XXXX_MPC=>TS_dummy-operation.

      data: Hdrs like TABLE OF LS_ITM WITH DEFAULT KEY,

            end of ls_deep.

    IO_DATA_PROVIDER->READ_ENTRY_DATA( IMPORTING ES_DATA = ls_deep ).

    Here ls_deep structure will have all the details now.

    Sample Payload ->

    {

    "Operation":"DeepInsert","Hdrs":[{"Hid":"01","Itms":[{"Iid":"01"},{"Iid":"02"}]},{"Hid":"02","Itms":[{"Iid":"01"},{"Iid":"02"}]}]

    }

    Here Operation is a dummy property defined under entity Dummy and has no significance as i mentioned above.

    i.e.,        1st Header with ID '01' having its associated Items with ID '01' and '02' ,

                  2nd Header with ID '02' having its associated Items with ID '01' and '02'

    This will work and you can accomplish your scenario.

    This way you can send multiple headers and their multiple items and perform create operation of N number of headers and their associated items.

    Kindly follow correct naming conventions while your are modelling your entities and properties 😊

    Regards,

    Ashwin

    Add comment
    10|10000 characters needed characters exceeded