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

BOM Components

Former Member
0 Likes
431

Hi ,

How can i determine that a material number is a BOM and if that is the case then how can i find the components of it.

Regards

Arun

1 ACCEPTED SOLUTION
Read only

RichHeilman
Developer Advocate
Developer Advocate
0 Likes
359

First hit against the MAST table with the material number. Then hit against STPO with the internal BOM number to get the components. There are also some function modules that will do this to.



data: xmast type mast.
data: istpo type table of stpo with header line.


Select Single * from mast
              where matnr = p_matnr.
If sy-subrc = 0.
Write:/ 'This material has a BOM'.
else.
Write:/ 'No BOM found'.
Endif.


write:/ 'Components'.
select * into corresponding fields of table istpo
        from stpo
             where stlnr = xmast-stlnr.
loop at istpo.
write:/ istpo-idnrk.
endloop.

Regards,

Rich Heilman

2 REPLIES 2
Read only

RichHeilman
Developer Advocate
Developer Advocate
0 Likes
360

First hit against the MAST table with the material number. Then hit against STPO with the internal BOM number to get the components. There are also some function modules that will do this to.



data: xmast type mast.
data: istpo type table of stpo with header line.


Select Single * from mast
              where matnr = p_matnr.
If sy-subrc = 0.
Write:/ 'This material has a BOM'.
else.
Write:/ 'No BOM found'.
Endif.


write:/ 'Components'.
select * into corresponding fields of table istpo
        from stpo
             where stlnr = xmast-stlnr.
loop at istpo.
write:/ istpo-idnrk.
endloop.

Regards,

Rich Heilman

Read only

0 Likes
359

Hi Arun,

I know you have marked this problem as solved, but in the case where you have multiple level BOMS, just selecting using the tables mast/istpo is not going to get the full list (not unless you recurse the selects).

I would recommend going straight for the function: CS_BOM_EXPL_MAT_V2 (think spelling is correct).

This way you'll get full explosion (for the specified plant also!).

Cheers,

Brad