Skip to Content

Multi-Level Expansion with GET_EXPANDED_ENTITYSET : Unable to expand from Item1 to Item2

Sep 05, 2017 at 06:09 AM


avatar image

Hi Experts,

I am working on Multi-Level Expansion with GET_EXPANDED_ENTITYSET . I have successfully expanded from header to item1 but i am unable to expand from item1 to item2 .

I have tried the below code.
data: wa_complex type zcomplex1,
          it_complex type standard table of zcomplex1.
*          wa_item1 like line of wa_complex-item1set,
*          wa_item2 like LINE OF wa_complex-item2set.

   data : it_header type standard table of zztab1_o1.
          it_itm1 type standard table of Zztab2_o1,
          it_itm2 type standard table of Zztab3_o1,
          wa_header TYPE zztab1_o1,
          wa_itm1 type zztab2_o1,
          wa_itm2 type zztab3_o1.
    DATA: it_name TYPE string.

if iv_entity_set_name = 'headerSet'.
 select *
 from zztab1_o1 into TABLE it_header.
 if sy-subrc = 0.
 select * from Zztab2_o1
 into table it_itm1
 for all entries in it_header
 where id = it_header-id.
 if sy-subrc = 0.
 select * from Zztab3_o1
 into table it_itm2
 for all entries in it_itm1
 where id = it_itm1-id.
 sort it_itm1 by id.
 sort it_itm2 by id.
 LOOP aT it_header into wa_header.
 MOVE-CORRESPONDING wa_header to wa_complex.
 LOOP at it_itm1 into wa_itm1 where id = wa_header-id.
 APPEND wa_itm1 to wa_complex-item1Set.
 LOOP at it_itm2 INTO wa_itm2 where id = wa_header-id.
 append wa_itm2 to wa_complex-item2set.
 append wa_complex to it_complex.
 clear wa_complex.
 is_data = it_complex
 cr_data = er_entityset
 it_name = 'ITEM1SET/ITEM2SET' .
 APPEND it_name to et_expanded_tech_clauses.


I am getting the data in er_enityset for all the nodes ( header to item1 and item1 to item2) .But when i am trying the same in Gateway (/sap/opu/odata/sap/Z014_SRV/headerSet?$expand=item1Set/item2Set&$format=json) it is not getting expand from Item1 to Item2 . It is getting expand only from header to Item1.

Please help me on this.

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

1 Answer

Best Answer
Rishabh Jain Mar 06 at 08:17 AM
10 |10000 characters needed characters left characters exceeded