计算BOM函数
call function 'CS_BOM_EXPL_MAT_V2'
exporting
capid = 'PP01' " BOM应用
cuobj = '000000000000000000'
datuv = '20101013' "有效起始日
emeng = '1' "需求数量
mktls = 'X'
mehrs = 'X' "多层展开
mtnrv = '12345678-1' "wa_vbeln-matnr "展开物料号
stlal = '1' "BOM用途
stlan = '1' "BOM用途
stpst = '0' "BOM用途
svwvo = 'X'
werks = '2217' "物料所在工厂
tables
stb = it_bom
matcat = it_matcat
exceptions
alt_not_found = 1
material_not_found = 3
missing_authorization = 4
no_bom_found = 5
others = 9.
loop at it_bom into wa_bom.
endloop.
if sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
endif.
exporting
capid = 'PP01' " BOM应用
cuobj = '000000000000000000'
datuv = '20101013' "有效起始日
emeng = '1' "需求数量
mktls = 'X'
mehrs = 'X' "多层展开
mtnrv = '12345678-1' "wa_vbeln-matnr "展开物料号
stlal = '1' "BOM用途
stlan = '1' "BOM用途
stpst = '0' "BOM用途
svwvo = 'X'
werks = '2217' "物料所在工厂
tables
stb = it_bom
matcat = it_matcat
exceptions
alt_not_found = 1
material_not_found = 3
missing_authorization = 4
no_bom_found = 5
others = 9.
loop at it_bom into wa_bom.
endloop.
if sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
endif.