Hello Experts,
I have a question regarding displaying Multiple rows as Output in XML Response using Create_Deep_Entity method. How to achieve that? Below is the procedure i followed and I am able to return only last record of the table in XML Response.
I have 2 Entity Types PurchaseHeader and PurchaseItem with fields as mentioned below and also maintained Associations and Navigation's between 2 Entity types. Also ImplementedCreate_Deep_Entity method in Data Provider class.
PurchaseHeader:-
PurchaseDoc
DocumentNum
PurchaseItem:-
PurchaseDoc
PurchaseItem
Quantity
DocDate
PostDate
StockType
DocumentNum
From a GoodsRecipt Post BAPI, I will be getting Material document Numbers as Output for each Item of a Purchase Document from a table i.e Item_doc table. I am looping that table and passing it tocopy_data_to_ref, but I am able to get only final record(MaterialDoc) in the XML Response Output. I want to fetch all Material docs for each item in Response payload.
Loop at Item_doc into wa_item_doc.
ls_gr_item-DocumentNum = wa_mat_doc-DocumentNum.
ls_gr_item-PurchaseDoc = wa_mat_doc-PurchaseDoc.
copy_data_to_ref(
EXPORTING
is_data = ls_gr_item
CHANGING
cr_data = er_deep_entity
).
endloop.
Thanks.