I am getting an issue with my program. I am using function module CS_BOM_EXPL_MAT_V2
to get the BOMs of a material. For example I have a material MAT1
that has the ff. BOM explosion.
MAT1
- COMP1 with Qty 2
- COMP2 with Qty 1
- COMP3 with Qty 1
And then, for component COMP1
, it also has sub-components:
COMP1
- SUBCOMP1 with Qty 1
- SUBCOMP2 with Qty 1
So what I am expecting in my program, using CS_BOM_EXPL_MAT_V2
, is to have the report to have a quantity of SUBCOMP1
= 2 and SUBCOMP2
= 2 (because MAT1
uses 2 quantity of COMP1
). But what I am getting is SUBCOMP1
= 1 qty and SUBCOMP2
= 1 qty because I think that it is only considering the BOM of COMP1
and the quantity of COMP1
is not taken into account.
When running transaction CS12
, the output is correct (SUBCOMP1
= 2, SUBCOMP2
= 2) for material MAT1
.
So, how do I make CS_BOM_EXPL_MAT_V2
work so that it will respect the count of the component, in this case COMP1
with Qty 2, and cascade the value to the sub-components, in this case SUBCOMP1
and SUBCOMP2
, and multiply it so it will return the correct quantity, in this case both sub-components should have Qty 2 as in transaction CS12
?
If this is not possible with FM CS_BOM_EXPL_MAT_V2
, please suggest other ways to achieve this.
Here's how my FM currently looks like:
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.