Hi Experts,
I have a requirement:
I have 3 Entity types, EKKO, EKPO, MARA with exact same structure and key as SE11 Tables.
I created 2 Navigation as below.
I am using BAPI as the data source for all entity sets. I then realize that EKKO_EKPO navigation works out of the box to retrieve relevant EKPO data...I.e. EKKOSet/?$expand=EKKO_EKPO
Meanwhile, when I try to navigate MARA(Where MATNR is Key) to EKPO (Where MATNR is Not Key) I.e. MARASet/?$expand=MARA_EKPO, I do not get relevant EKPO data. May I know what is the most appropriate way to achieve this?
In the meantime I managed to do a workaround (or maybe it is the correct solution I am not sure) as below. Am I doing this correctly? or there is a more proper way to do it?
if IV_SOURCE_NAME = 'MARA'.
clear LS_KEYTB.
read table IT_KEY_TAB into LS_KEYTB index 1.
if SY-SUBRC = 0.
select ebeln ebelp loekz txz01 matnr bukrs
werks lgort ktmng menge meins
from ekpo
into TABLE et_entityset
where MATNR = LS_KEYTB-VALUE
order by ebeln ebelp.
endif.
else.
** Regular Key-to-Key-Nav
try.
call method SUPER->EKPOSET_GET_ENTITYSET
exporting
IV_ENTITY_NAME = IV_ENTITY_NAME
IV_ENTITY_SET_NAME = IV_ENTITY_SET_NAME
IV_SOURCE_NAME = IV_SOURCE_NAME
IT_FILTER_SELECT_OPTIONS = IT_FILTER_SELECT_OPTIONS
IS_PAGING = IS_PAGING
IT_KEY_TAB = IT_KEY_TAB
IT_NAVIGATION_PATH = IT_NAVIGATION_PATH
IT_ORDER = IT_ORDER
IV_FILTER_STRING = IV_FILTER_STRING
IV_SEARCH_STRING = IV_SEARCH_STRING
IO_TECH_REQUEST_CONTEXT = IO_TECH_REQUEST_CONTEXT
importing
ET_ENTITYSET = ET_ENTITYSET
ES_RESPONSE_CONTEXT = ES_RESPONSE_CONTEXT.
catch /IWBEP/CX_MGW_BUSI_EXCEPTION .
catch /IWBEP/CX_MGW_TECH_EXCEPTION .
endtry.
endif.
Best Regards
Andre Julius