Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

MVKE Material Hierarchy

In reference to PRODH

I need to extract the material hierarchy codes (5 levels) from PRODH field in MVKE. If I test using se16 on MVKE the table displays all 5 levels correctly in the PRODH field. However when I repeat the process using a query in a RFC only the first level is returned. The code for the RFC query is provided below.

My question is how to get the 5 hierarchy levels via ABAP. thanks

FUNCTION ZSD_MM_MVKE .

*"----------------------------------------------------------------------

*"*"Local Interface:

*"  IMPORTING

*"     VALUE(MATERIAL) TYPE  MATNR

*"  EXPORTING

*"     VALUE(HIERARCHY) TYPE  PRODH

*"  EXCEPTIONS

*"      NOVALUE

*"----------------------------------------------------------------------

select prodh from mvke into hierarchy

   where matnr EQ material.

   endselect.

ENDFUNCTION.

replied

Hello Kevin,

Try making your target a table with key fields.  For example:

TYPES: BEGIN OF type_hierarchy,

                matnr TYPE matnr,

               vkorg  TYPE vkorg,

               vtweg  TYPE vtweg,

               prodh  TYPE prodh_d,

             END OF type_hierarchy.

DATA: t_hierarchy TYPE STANDARD TABLE OF type_hierarchy.

SELECT matnr vkorg vtweg prodh INTO TABLE t_hierarchy

  WHERE matnr = material.

Regards,

Kim

1 View this answer in context
Not what you were looking for? View more on this topic or Ask a question