我的程序出了问题。我正在使用功能模块CS_BOM_EXPL_MAT_V2
来获取材料的BOM。例如,我有一个具有ff的材料MAT1
。 BOM爆炸。
MAT1
- COMP1 with Qty 2
- COMP2 with Qty 1
- COMP3 with Qty 1
然后,对于组件COMP1
,它还有子组件:
COMP1
- SUBCOMP1 with Qty 1
- SUBCOMP2 with Qty 1
因此,我在我的程序中使用CS_BOM_EXPL_MAT_V2
期待的是报告的数量为SUBCOMP1
= 2和SUBCOMP2
= 2(因为MAT1
使用2个数量的COMP1
)。但我得到的是SUBCOMP1
= 1数量和SUBCOMP2
= 1数量,因为我认为它只考虑COMP1
的BOM和COMP1
的数量没有考虑在内。
当运行事务CS12
时,对于材料SUBCOMP1
,输出是正确的(SUBCOMP2
= 2,MAT1
= 2)。
那么,我如何使CS_BOM_EXPL_MAT_V2
工作,以便它将尊重组件的计数,在这种情况下COMP1
与数量2,并将值级联到子组件,在这种情况下SUBCOMP1
和SUBCOMP2
,并将其相乘以便它将返回正确的数量,在这种情况下,两个子组件应该具有Qty 2,如事务CS12
?
如果使用FM CS_BOM_EXPL_MAT_V2
无法做到这一点,请提供其他方法来实现此目的。
这是我的FM目前的样子:
CALL FUNCTION 'CS_BOM_EXPL_MAT_V2'
EXPORTING
aumgb = 'X'
capid = 'PP01'
datuv = v_datuv "date input in selection screen
endhl = '1'
mehrs = 'X'
mmory = '1'
mtnrv = v_matnr "material input in selection screen
stlal = v_stlal "alternative BOM input in selection screen
stpst = 0 "Level in multi-bom expl.
svwvo = 'X'
werks = v_werks "plant input in selection screen
vrvso = 'X'
IMPORTING
topmat = gs_top
TABLES
stb = gt_stb
matcat = gt_matca
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.
这是Laurent Fournier在snc.sap.com上给出的答案。这对我很有帮助,因此我想在此保留它。
I think that you must set multilevel indicator. Take a look at the following code and see if this can help you.
FORM EXPLODE_BOM USING U_DATE
U_MATNR
U_MENGE
U_WERKS
U_MULTI
CHANGING C_SUCCESS.
CLEAR : C_SUCCESS.
CALL FUNCTION 'CS_BOM_EXPL_MAT_V2'
EXPORTING
* FTREL = ' '
* ALEKZ = ' '
* ALTVO = ' '
* AUFSW = ' '
AUMGB = 'X'
* AUMNG = 0
AUSKZ = ' '
* AMIND = ' '
* BAGRP = ' '
* BEIKZ = ' '
* BESSL = ' '
* BGIXO = ' '
* BREMS = ' '
CAPID = 'PP01'
* CHLST = ' '
* COSPR = ' '
* CUOBJ = 000000000000000
* CUOVS = 0
* CUOLS = ' '
DATUV = U_DATE
* DELNL = ' '
* DRLDT = ' '
* EHNDL = ' '
* EMENG = 0
* ERSKZ = ' '
* ERSSL = ' '
* FBSTP = ' '
* KNFBA = ' '
* KSBVO = ' '
* MBWLS = ' '
* MKTLS = 'X'
* MDMPS = ' '
MEHRS = U_MULTI
* MKMAT = ' '
* MMAPS = ' '
* SALWW = ' '
* SPLWW = ' '
* MMORY = ' '
MTNRV = U_MATNR
* NLINK = ' '
* POSTP = ' '
* RNDKZ = ' '
* RVREL = ' '
* SANFR = ' '
* SANIN = ' '
* SANKA = ' '
* SANKO = ' '
* SANVS = ' '
* SCHGT = ' '
* STKKZ = ' '
* STLAL = '1'
* STLAN = '1'
STPST = 0
* SVWVO = 'X'
WERKS = U_WERKS
* NORVL = ' '
* MDNOT = ' '
* PANOT = ' '
* QVERW = ' '
* VERID = ' '
* VRSVO = 'X'
* IMPORTING
* TOPMAT =
* DSTST =
TABLES
STB = BOM_EXPL
* 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