In SAP we can use BOM Explosion using below function module, we need to pass some important parameter.
CAPID - BOM Application ID (BEST).
EMENG - Required Quantity.
MTNRV - Material.
STLAL - Alternative BOM.
STLAN - BOM Usage.
WERKS - Plant.
we can find the multilevel BOM in STB table.
Code Snippet:
CALL FUNCTION 'CS_BOM_EXPL_MAT_V2'
EXPORTING
alekz = 'X'
capid = p_capid
datuv = sy-datum
emeng = p_emeng
mktls = 'X'
mehrs = 'X'
mtnrv = lv_matnr
stlal = lv_stlal
stlan = lv_stlan
stpst = 0
svwvo = 'X'
werks = lv_werks
vrsvo = 'X'
TABLES
stb = it_stb
matcat = it_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.
ENDIF.
IDE Used To Test This Code : SAP GUI.
Try this code in your computer for better understanding. Enjoy the code. If you have any Question you can contact us or mail us. We will reply you as soon as possible.