Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

BAPI (BOM) TOP Material

Former Member
0 Likes
484

HI all

I have the following problem:

Selection: Material (Component)

I can find the next BOM level with the FM "CS_WHERE_USED_MAT". But I need the TOP level.

Is there a better FM/BAPI that I can use to find the last material number (final assembly)?

Thanks

Alex

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
426

Hi,

I know functions that get the structure to the deepest level but on the opposite way not ... and it would interesting to learn.

I might suggest that you work with a loop in order to get the top-level in the structure:

DO WHILE SUBRC = 0.

Call function CS_WHERE_USED_MAT

exporting

MATNR = MYMATNR

importing

exceptions.

if sy-subrc = 0.

read table MATCAT where ....

move MATCAT-MATNR to MYMATNR.

else.

subrc = 4.

endif.

ENDDO.

1 REPLY 1
Read only

Former Member
0 Likes
427

Hi,

I know functions that get the structure to the deepest level but on the opposite way not ... and it would interesting to learn.

I might suggest that you work with a loop in order to get the top-level in the structure:

DO WHILE SUBRC = 0.

Call function CS_WHERE_USED_MAT

exporting

MATNR = MYMATNR

importing

exceptions.

if sy-subrc = 0.

read table MATCAT where ....

move MATCAT-MATNR to MYMATNR.

else.

subrc = 4.

endif.

ENDDO.