Skip to Content

Navigation between 2 Entities with Key - Non Key Linkage

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.

  1. EKKO_EKPO to Navigate from PO Header To Item (Ref Constraint EBELN-EBELN)
  2. MARA_EKPO to get POs for respective Material (Ref Constraint MATNR-MATNR)

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

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • May 22 at 05:49 PM

    Hi,

    I assume you are using BAPI_PO_GET_DETAIL(or something similar) which fetches the details of a PO Header and its all Items together in one go so your navigation looks like it's working but in background it's the BAPI's capability. In case of material I am not sure of any such BAPI/FM and hence your custom handling of Expanded_Entity looks good to cater the requirement.

    Add comment
    10|10000 characters needed characters exceeded