2009 Jan 15 6:20 PM
If I am given a material component of a BOM, how can I then get the BOM header material. For instance Part 123 is the BOM header material and it contains one component which is part ABC. If I know part ABC, how do I then pull in Part 123 into my program?
Thanks in advance for your help.
2009 Jan 15 7:05 PM
That's right, the component can be used in more than one BOM, so you have to take that into account. But any way, you would need to get the internal BOM number from STPO where you find your ABC material in field IDNRK. Then use this internal BOM number and select against, the MAST table. This MAST table will give you the parent material and plant. So you may need to use STKO as well to get some of other field values to use to narrow your search against MAST.
Regards,
Rich Heilman
If I am given a material component of a BOM, how can I then get the BOM header material. For instance Part 123 is the BOM header material and it contains one component which is part ABC. If I know part ABC, how do I then pull in Part 123 into my program?
Thanks in advance for your help.
2009 Jan 15 7:01 PM
Hi ,
I have a conern regarding your requiremnet , as a material can be used in a number of BOM , so the material ABC can be in more than one BOM , so what exactly is your requirement to get all the materisl which have the material ABC as a component in the bom ,
Regards
Arun
2009 Jan 15 7:05 PM
That's right, the component can be used in more than one BOM, so you have to take that into account. But any way, you would need to get the internal BOM number from STPO where you find your ABC material in field IDNRK. Then use this internal BOM number and select against, the MAST table. This MAST table will give you the parent material and plant. So you may need to use STKO as well to get some of other field values to use to narrow your search against MAST.
Regards,
Rich Heilman
2009 Jan 15 7:09 PM
Or you could use this function.
data: selpool like mc29s.
data: eqpcat like cscequi occurs 0.
data: kndcat like cscknd occurs 0.
data: matcat like cscmat occurs 0.
data: prjcat like cscprj occurs 0.
data: stdcat like cscstd occurs 0.
data: tplcat like csctpl occurs 0.
clear itab. refresh itab.
call function 'CS_WHERE_USED_MAT'
exporting
datub = sy-datum
datuv = sy-datum
matnr = lv_matnr
postp = ' '
stlan = ' '
werks = lv_werks
stltp = ' '
importing
topmat = selpool "Not Currently Used
tables
wultb = itab "Contains the where-used records
equicat = eqpcat "Not Currently Used
kndcat = kndcat "Not Currently Used
matcat = matcat "Not Currently Used
stdcat = stdcat "Not Currently Used
tplcat = tplcat "Not Currently Used
prjcat = prjcat "Not Currently Used
exceptions
material_not_found = 02
no_where_used_rec_found = 03
no_where_used_rec_selected = 04
no_where_used_rec_valid = 05.Regards,
Rich Heilman
2009 Jan 15 7:11 PM
Give the material component in the field IDNRK ( component) in the table STPO
BOM category ( STLTY) = M and then you will get BOM ( STLNR )
Give this STLNR to table MAST and find header material in matnr.
select single stlnr from stpo into stpo-stlnr where idnrk = p_component
and stlty = 'M' .
if sy-subrc = 0
select single matnr from mast into mast-matnr where stlnr = stpo-stlnr.
endif.
mast-matnr is the bom header material.
If there are multiple BOM's for the given component, then you will have to specify more conditions in the where clause.
2009 Jan 15 8:04 PM
| User | Count |
|---|---|
| 6 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |