Skip to Content
avatar image
Former Member

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.

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • Best Answer
    avatar image
    Former Member
    Apr 08, 2013 at 05:57 PM

    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

    Add comment
    10|10000 characters needed characters exceeded