on 01-17-2021 7:01 PM
Hi Good Day,
Am posting this Question after searching at least Dozen times. Since am not getting desired result hence i have decided i should seek some help, i have gone gone through below links however i dont get the desired results.
https://blogs.sap.com/2020/01/08/get-expanded-entity-set-get-expanded-entity-sap-odata/
https://blogs.sap.com/2019/12/17/implementing-get_expanded_entity-get_expanded_entityset/
Requirement :
I Have Header, Items and Documents.
Each Item will have more than one document.
I have created 3 Tables Header, Items and Documents
I have Created an Association and Navigation Property
Link : M : N & N : M
I get Header Data : Items but not Items to Documents.
Tried at least 50 times(Believe me)! yet not joy, I know am making mistake, but don't what it is.
I always results like this.
IMP : The Item structure name is similar to Navigation property.
This is my code
data : lt_output type standard table of zplan1_s_deep,
lt_zcase_s_header type standard table of zheader,
lt_zcase_s_item type standard table of zitems,
lt_zcase_s_docs type standard table of zdocs.
data : ls_zcase_s_header type zheader,
ls_zcase_s_item type zitems,
ls_zcase_s_docs type zdocs,
ls_output type ZPLAN1_S_DEEP.
data : lv_techname type string.constants: lc_expand_tech_clause type string value 'HEADERTOITEMNAV/ITEMTODOCSNAV'.
select * from zheaderinto table lt_zcase_s_header.
if lt_zcase_s_header is not initial.select * from zitems into table lt_zcase_s_itemfor all entries in lt_zcase_s_header where id eq lt_zcase_s_header-id.
if sy-subrc = 0.
select * from zdocs into table lt_zcase_s_docsfor all entries in lt_zcase_s_item where id eq lt_zcase_s_item-id and sdept = lt_zcase_s_item-sdept.
endif.
endif.
loop at lt_zcase_s_header into ls_zcase_s_header.
move-corresponding ls_zcase_s_header to ls_output.
loop at lt_zcase_s_item into ls_zcase_s_item where id eq ls_zcase_s_header-id.
append ls_zcase_s_item to ls_output-headertoitemnav.
loop at lt_zcase_s_docs into ls_zcase_s_docs where id eq ls_zcase_s_item-id and sdept eq ls_zcase_s_item-sdept.
append ls_zcase_s_docs to ls_output-itemtodocsnav.endloop.
endloop.
append ls_output to lt_output.clear ls_output.endloop.
copy_data_to_ref(exporting
is_data = lt_outputchanging
cr_data = er_entityset ).
insert lc_expand_tech_clause into table et_expanded_tech_clauses.
I really appreciate your valuable contributions.
User | Count |
---|---|
86 | |
10 | |
10 | |
9 | |
7 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.