CALL
FUNCTION
'CS_BOM_EXPL_MAT_V2'
EXPORTING
CAPID = 'PP01'
DATUV = SY -DATUM
EMENG = 1
MEHRS = 'X' "多层展开,'X'表示是,''表示否
MTNRV = WA_SATNR
WERKS = WERKS
* IMPORTING
* TOPMAT =
* DSTST =
TABLES
STB = ZTAB
* 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
EXPORTING
CAPID = 'PP01'
DATUV = SY -DATUM
EMENG = 1
MEHRS = 'X' "多层展开,'X'表示是,''表示否
MTNRV = WA_SATNR
WERKS = WERKS
* IMPORTING
* TOPMAT =
* DSTST =
TABLES
STB = ZTAB
* 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
BOM是有“有效期”的,用CS12查询时输入不同的valid from,则得出的BOM结果就有可能不同。用FM:CS_BOM_EXPL_MAT_V2取BOM也是一样的道理。
一般情况下,将以上的参数datuv 赋予当前日期sy-datum,即可得到当前最新的有效BOM。
对于capid参数,一般情况下,我们所取的都生产用BOM,所以必须指定为"PP01" 。如果是其它类型的BOM应用,则可以按需要选择:
[B]PP01------ Production - general [/B]
BEST------ Inventory management
INST ------ Plant maintenance
PC01 ------ Costing
PI01 ------ Process manufacturing
SD01------ Sales and distribution