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.
Entity Dummy is created here to accomplish the type of GW modeling you are expecting as per your scenario and has no real significance.
Its just to facilitate association between Header and Item entities as per the scenario here.
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 ' . Thislinks 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