‎2010 Feb 11 5:32 AM
Hi Experts,
I have a requirement where I need to determine all the components ( even multilevel) of a BOM.
I am using FM "CS_BOM_EXPLOSION" with flag 'MEHRS' as X.
But in my case , one BOM can have multiple "Alternative BOm's" also and I need to get the information about all of them.
Please help me understand , how do I retrieve the entire information??
Thanks in advance!!!
‎2010 Feb 11 5:36 AM
Hi,
Use this FM u will get all the levels of BOM
CALL FUNCTION 'CS_BOM_EXPL_MAT_V2'
EXPORTING
capid = 'PP01'
datuv = sy-datum
ehndl = '1'
mktls = 'X'
mehrs = 'X'
mtnrv = lv_matnr1
stlal = lv_stlal1
stlan = lv_stlan1
svwvo = 'X'
werks = lv_werks1
vrsvo = 'X'
TABLES
stb = it_stpo5
EXCEPTIONS
alt_not_found = 1
call_invalid = 2
material_not_found = 3
missing_authorization = 4
no_bom_found = 5
no_plant_data = 6
no_suitable_bom_found = 7
conversion_error = 8
OTHERS = 9.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
‎2010 Feb 11 6:43 AM
Hi
Use FM 'CS_BOM_EXPL_MAT_V2' as below.
select * from stpo into table lt_stpo
where POSTP = 'K' .
loop at lt_stpo.
select * from plmz into table lt_plmz where
stlnr = lt_stpo-stlnr and
stlty = lt_stpo-stlty and
stlkn = lt_stpo-stvkn and
kante = '000000'.
if sy-subrc = 0.
append lines of lt_plmz to lt_plmz_modify.
endif.
describe table lt_plmz lines entries.
counter = counter + entries.
clear entries.
endloop.
loop at lt_plmz_modify.
select single * from mast into lt_mast where
stlnr = lt_plmz_modify-stlnr_w and
stlan = usage and
stlal = lt_plmz_modify-stlal_w .
if sy-subrc <> 0.
write : 'No BOM found with usg',usage,' for BOM',lt_plmz_modify-stlnr_w.
endif.
CALL FUNCTION 'CS_BOM_EXPL_MAT_V2'
EXPORTING
FTREL = 'X'
CAPID = 'PP01'
DATUV = lt_plmz_modify-datuv
MDMPS = 'X'
MEHRS = 'X'
MTNRV = lt_mast-matnr
STLAL = lt_plmz_modify-stlal_w
stlan = usage
WERKS = lt_mast-werks
MDNOT = 'X'
IMPORTING
TOPMAT =
DSTST =
TABLES
STB = lt_stb
MATCAT =
EXCEPTIONS
ALT_NOT_FOUND = 1
CALL_INVALID = 2
MATERIAL_NOT_FOUND = 3
MISSING_AUTHORIZATION = 4
NO_BOM_FOUND = 5
NO_PLANT_DATA = 6
NO_SUITABLE_BOM_FOUND = 7
CONVERSION_ERROR = 8
OTHERS = 9
.
IF SY-SUBRC <> 0.
Write: ' Error in BOM Explosion for material ', lt_mast-matnr.
ENDIF.
Regards
Gaurav
‎2010 Feb 11 7:08 AM
I even want the details of Alternative BOM's.
For e.g. if I have a BOM with 4 Alternative BOM's , I need to explode all of them.
If this possible using above FM's, I am able to explode only one Alternative BOM as specified in STLAL.
‎2010 Feb 11 8:41 AM
Hi,
Donot post duplicate threads.
Pl check link:[http://wiki.sdn.sap.com/wiki/display/Snippets/InverseorReverseBomwithQtyRequired]