2013 Apr 08 1:38 PM
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.
2013 Apr 08 6: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
2013 Apr 08 6: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
2013 Apr 09 10:15 PM
Kim,
thanks for your tremendous help. It is working great now
Kevin