Skip to Content
0
Former Member
Jul 02, 2007 at 08:42 AM

hi pls very urgent

48 Views

this report for getting the bom for the sales order wise.

This is my source code, i am getting the dump error for a particular input.

the sales order i giving as a input have the bom for the application Engineering Design.(STLAN =2) but i haven't checked.

so can you tell me how to correct this dump error.

Exception condition "CALL_INVALID" raised.

the erro message is RAISE_EXCEPTION

DATA : BEGIN OF itab OCCURS 0,

VBELN like vbap-VBELN, "SALE ORDER

posnr LIKE vbap-POSNR, "LINE ITEM

STLNR1 like vbap-STLNR,

STLNR like STPO-STLNR,

MATNR LIKE VBAP-MATNR,

ARKTX LIKE VBAP-ARKTX,

MEINS LIKE VBAP-MEINS,

IDNRK LIKE STPO-IDNRK,

werks like vbap-werks,

MAKTX LIKE MAKT-MAKTX,

KWMENG LIKE VBAP-KWMENG,

MENG LIKE VBAP-ABLFZ,

STLAL LIKE MAST-STLAL,

STLAN LIKE MAST-STLAN,

CAPID LIKE TC04-CAPID,

END OF itab.

DATA : BEGIN OF it_final OCCURS 0,

VBELN like vbap-VBELN, "SALE ORDER

posnr LIKE vbap-POSNR, "LINE ITEM

STLNR1 like vbap-STLNR,"BOM

STLNR like STPO-STLNR, "BOM no

MATNR LIKE VBAP-MATNR, "MATERIAL

ARKTX LIKE VBAP-ARKTX, "DESC

MEINS LIKE VBAP-MEINS, "BUn

IDNRK LIKE STPO-IDNRK, "COMPONENT

werks like vbap-werks, "PLANT

MAKTX LIKE MAKT-MAKTX, "DESC

MNGKO LIKE STPO-MENGE, "CONSUMPTION

ROANZ LIKE STPO-ROANZ, "BASE QTY

MEINS1 LIKE STPO-MEINS, " Un

KWMENG LIKE VBAP-KWMENG, "ORDER QTY

STLAL LIKE MAST-STLAL,

STLAN LIKE MAST-STLAN,

CAPID LIKE TC04-CAPID,

END OF it_final.

data : begin of itab1 occurs 0,

VBELN like vbap-VBELN, "SALE ORDER

posnr LIKE vbap-POSNR, "LINE ITEM

STLNR1 like vbap-STLNR,

STLNR like STPO-STLNR,

MATNR LIKE VBAP-MATNR,

ARKTX LIKE VBAP-ARKTX,

MEINS LIKE VBAP-MEINS,

IDNRK LIKE STPO-IDNRK,

werks like vbap-werks,

MAKTX LIKE MAKT-MAKTX,

KWMENG LIKE VBAP-KWMENG,

MENG LIKE VBAP-ABLFZ,

STLAL LIKE MAST-STLAL,

STLAN LIKE MAST-STLAN,

CAPID LIKE TC04-CAPID,

END OF itab1.

data : ibom1 like stpox occurs 0 with header line,

ibom2 like stpox occurs 0 with header line.

SELECTION-SCREEN BEGIN OF BLOCK bk1 WITH FRAME TITLE text-001.

SELECT-OPTIONS: zso FOR vbep-vbeln OBLIGATORY.

SELECT-OPTIONS: zli FOR vbep-posnr.

SELECT-OPTIONS: ZPL FOR VBAP-WERKS.

PARAMETERS ZQTY TYPE STKO-BMENG.

SELECTION-SCREEN END OF BLOCK bk1.

gs_layout-colwidth_optimize = 'X'.

select vbeln

posnr

MATNR

ARKTX

STLNR

WERKS

KWMENG

MEINS

from vbap

into corresponding fields of table itab

where Vbeln in zso and

posnr in zli and

werks in zpl.

select matnr stlal STLAN from mast

into corresponding fields of table ITAB1

for all entries in ITAB

where matnr = itab-matnr.

sort itab1 by matnr.

loop at itab.

if zqty is initial.

itab-meng = itab-KWMENG.

modify itab.

endif.

ENDLOOP.

loop at itab1.

if zqty is not initial.

move zqty to itab1-meng.

modify itab1.

endif.

endloop.

loop at itab1.

read table itab with key matnr = itab1-matnr.

if sy-subrc = 0.

itab1-vbeln = itab-vbeln.

itab1-posnr = itab-posnr.

itab1-ARKTX = itab-ARKTX.

itab1-stlnr1 = itab-stlnr1.

itab1-stlnr = itab-stlnr.

itab1-meins = itab-meins.

itab1-IDNRK = itab-IDNRK.

itab1-werks = itab-werks.

itab1-MAKTX = itab-MAKTX.

  • ITAB1-STLAN = ITAB1-STLAN.

IF ITAB1-STLAN = '1'.

ITAB1-CAPID = 'PP01'.

ELSEIF ITAB1-STLAN = '5'.

ITAB1-CAPID = 'SD01'.

ELSEIF ITAB1-STLAN = '6'.

ITAB1-CAPID = 'PC01'.

ELSEif itab1-stlan <> 1

and itab1-stlan <> 5

and itab1-stlan <> 6.

exit.

ENDIF.

if zqty is initial.

itab1-MENG = itab-meng.

else.

itab1-meng = itab1-meng.

itab1-kwmeng = zqty.

endif.

if zqty is initial.

itab1-KWMENG = itab-KWMENG.

endif.

itab1-STLAL = itab1-STLAL.

endif.

modify itab1.

clear : itab.

endloop.

loop at itab1.

clear : ibom1[].

CALL FUNCTION 'CS_BOM_EXPL_MAT_V2'

EXPORTING

capid = ITAB1-CAPID

datuv = sy-datum

emeng = itab1-meng

mehrs = 'X'

mtnrv = itAB1-matnr

stlal = ITAB1-stlal

werks = itAB1-werks

TABLES

stb = ibom1

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.