Skip to Content
author's profile photo Former Member
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 a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

1 Answer

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on 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 a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.