2007 Nov 28 2:18 PM
Hi
i am using the below code to explode the BOM i am getting more than 30000 material in i_mast, but at some point it is throwing Errror NO_BOM_FOUND.
now it is difficult to find the particular material for which it is showing error, how can i check it initially before passing the materials to the FM. so that noe Error will be shown
*&---------------------------------------------------------------------*
*& Form f_explore_bom
*&---------------------------------------------------------------------*
FORM f_explore_bom.
RANGES s_stlnr FOR stko-stlnr.
**
CHECK i_marc[] IS NOT INITIAL.
**
SELECT matnr werks stlnr INTO TABLE i_mast
FROM mast FOR ALL ENTRIES IN i_marc
WHERE matnr = i_marc-matnr AND
werks = i_marc-werks.
**
DELETE i_mast WHERE stlnr IS INITIAL.
**
CHECK i_mast[] IS NOT INITIAL.
**
SELECT stlnr lkenz INTO TABLE i_stko
FROM stko FOR ALL ENTRIES IN i_mast
WHERE stlty = 'M' AND stlnr = i_mast-stlnr.
**
s_stlnr-sign = 'I'. s_stlnr-option = 'EQ'.
LOOP AT i_stko WHERE lkenz = 'X'.
s_stlnr-low = i_stko-stlnr. COLLECT s_stlnr.
ENDLOOP.
**
DELETE i_mast WHERE stlnr IN s_stlnr.
**
LOOP AT i_mast.
CALL FUNCTION 'CS_BOM_EXPL_MAT_V2'
EXPORTING
capid = 'ENGR'
datuv = sy-datum
mtnrv = i_mast-matnr
werks = i_mast-werks
TABLES
stb = i_stb.
*
LOOP AT i_stb.
i_comp-werks = i_mast-werks.
i_comp-matnr = i_mast-matnr.
i_comp-comp = i_stb-idnrk.
i_comp-comp_qty = i_stb-menge.
i_comp-comp_posnr = i_stb-posnr.
i_comp-comp_werks = i_stb-werks.
*
i_matnr-matnr = i_stb-idnrk.
i_objek-objek = i_stb-idnrk.
*
COLLECT : i_matnr, i_objek.
*
APPEND i_comp. CLEAR : i_matnr, i_objek, i_comp.
*
ENDLOOP.
REFRESH i_stb. CLEAR : i_stb, i_mast.
ENDLOOP.
ENDFORM. " f_explore_bom
Hi
i am using the below code to explode the BOM i am getting more than 30000 material in i_mast, but at some point it is throwing Errror NO_BOM_FOUND.
now it is difficult to find the particular material for which it is showing error, how can i check it initially before passing the materials to the FM. so that noe Error will be shown
*&---------------------------------------------------------------------*
*& Form f_explore_bom
*&---------------------------------------------------------------------*
FORM f_explore_bom.
RANGES s_stlnr FOR stko-stlnr.
**
CHECK i_marc[] IS NOT INITIAL.
**
SELECT matnr werks stlnr INTO TABLE i_mast
FROM mast FOR ALL ENTRIES IN i_marc
WHERE matnr = i_marc-matnr AND
werks = i_marc-werks.
**
DELETE i_mast WHERE stlnr IS INITIAL.
**
CHECK i_mast[] IS NOT INITIAL.
**
SELECT stlnr lkenz INTO TABLE i_stko
FROM stko FOR ALL ENTRIES IN i_mast
WHERE stlty = 'M' AND stlnr = i_mast-stlnr.
**
s_stlnr-sign = 'I'. s_stlnr-option = 'EQ'.
LOOP AT i_stko WHERE lkenz = 'X'.
s_stlnr-low = i_stko-stlnr. COLLECT s_stlnr.
ENDLOOP.
**
DELETE i_mast WHERE stlnr IN s_stlnr.
**
LOOP AT i_mast.
CALL FUNCTION 'CS_BOM_EXPL_MAT_V2'
EXPORTING
capid = 'ENGR'
datuv = sy-datum
mtnrv = i_mast-matnr
werks = i_mast-werks
TABLES
stb = i_stb.
*
LOOP AT i_stb.
i_comp-werks = i_mast-werks.
i_comp-matnr = i_mast-matnr.
i_comp-comp = i_stb-idnrk.
i_comp-comp_qty = i_stb-menge.
i_comp-comp_posnr = i_stb-posnr.
i_comp-comp_werks = i_stb-werks.
*
i_matnr-matnr = i_stb-idnrk.
i_objek-objek = i_stb-idnrk.
*
COLLECT : i_matnr, i_objek.
*
APPEND i_comp. CLEAR : i_matnr, i_objek, i_comp.
*
ENDLOOP.
REFRESH i_stb. CLEAR : i_stb, i_mast.
ENDLOOP.
ENDFORM. " f_explore_bom
2007 Nov 28 2:23 PM
Hi,
Check Exceptions.
Add the following code at the end of the FM :
EXCEPTIONS
material_not_found = 4
no_plant_data = 8
no_bom_found = 12
no_suitable_bom_found = 16.
if sy-subrc eq 12.
break-point.
endif.
Then check !
Hope this helps,
Erwan
2008 Nov 13 8:53 AM
| User | Count |
|---|---|
| 4 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |