METHOD /iwbep/if_mgw_appl_srv_runtime~get_expanded_entityset.
DATA : it_out_tab TYPE STANDARD TABLE OF zdeep_s,
wa_out_tab LIKE LINE OF it_out_tab,
it_header TYPE STANDARD TABLE OF zheader,
wa_header TYPE zheader,
it_item TYPE STANDARD TABLE OF zitem,
wa_item TYPE zitem.
CASE iv_entity_set_name.
WHEN 'HeaderSet'.
SELECT * FROM zheader INTO TABLE it_header.
IF sy-subrc = 0.
SELECT * FROM zitem INTO TABLE it_item FOR ALL ENTRIES IN it_header WHERE id = it_header-id.
ENDIF.
LOOP AT it_header INTO wa_header.
MOVE-CORRESPONDING wa_header TO wa_out_tab.
LOOP AT it_item INTO wa_item WHERE id = wa_header-id.
APPEND wa_item TO wa_out_tab-headertoitemnav.
CLEAR : wa_item.
ENDLOOP.
APPEND wa_out_tab TO it_out_tab.
CLEAR : wa_header,wa_out_tab.
ENDLOOP.
copy_data_to_ref(
EXPORTING
is_data = it_out_tab
CHANGING
cr_data = er_entityset ).
ENDCASE.
ENDMETHOD.
{
"d" : {
"results" : [
{
"__metadata" : {
},
"Id" : "100",
"Name" : "MOUSE",
"Dept" : "DEPT1",
"HeaderToItemNav" : {
"results" : [
{
"__metadata" : {
},
"Id" : "100",
"Sdept" : "DEPT-1A",
"Stock" : "22"
},
{
"__metadata" : {
},
"Id" : "100",
"Sdept" : "DEPT-1B",
"Stock" : "44"
},
{
"__metadata" : {
},
"Id" : "100",
"Sdept" : "DEPT-1C",
"Stock" : "76"
}
]
}
},
{
"__metadata" : {
},
"Id" : "101",
"Name" : "KEYBOARD",
"Dept" : "DEPT2",
"HeaderToItemNav" : {
"results" : [
{
"__metadata" : {
},
"Id" : "101",
"Sdept" : "DEPT2-SM",
"Stock" : "115"
},
{
"__metadata" : {
},
"Id" : "101",
"Sdept" : "DEPT-2C",
"Stock" : "129"
},
{
"__metadata" : {
},
"Id" : "101",
"Sdept" : "DEPT-2D",
"Stock" : "251"
},
{
"__metadata" : {
},
"Id" : "101",
"Sdept" : "DEPT-2M",
"Stock" : "009"
}
]
}
}
]
}
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
6 | |
4 | |
4 | |
3 | |
3 | |
3 | |
3 | |
3 | |
3 | |
3 |