LOOP AT itab_mast.
cnt0 = cnt0 + 1.
CALL FUNCTION 'CS_BOM_EXPL_MAT_V2'
EXPORTING
capid = 'PP01'
datuv = sy-datum
ehndl = '1'
emeng = '1'
mehrs = 'X'
mkmat = 'X' "限制展开所有阶
mmory = '1'
mtnrv = itab_mast-matnr "'000000000210000105'
stlan = 'M'
werks = '2110' "'1100'
IMPORTING
topmat = topmat_t
* DSTST =
TABLES
stb = stb1
* MATCAT =
EXCEPTIONS
alt_not_found = 1
material_not_found = 3
missing_authorization = 4
no_bom_found = 5
OTHERS = 9 .
* SORT stb1 BY stufe.
* IF sy-subrc <> 0.
* MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
* WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
* ENDIF.