Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

termination in program SAPLCSAP

Former Member
0 Likes
2,449

Hello Experts,

i am calling 'CSAP_MAT_BOM_CREATE'.

and the parameters passed to this FM are

matnr

werks

usage

tstko for i_stko

flg_warning

t_stpo = tstpo

before call to this FM i checked all teh entries are correct.

when i execute the program a short dump occurs.

error raise.

if flg_error eq kreuz.

clear flg_error.

perform appl_log_exit using 'CSAP_MAT_BOM_CREATE'

changing hlp_subrc.

raise error.

endif.

this is error is raised from FM on 002470 line.

plz help.

thanks in advance.

regards,

Ashmita singh

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
2,035

well,

If a short dump is raised, please call transaction ST22 and open the short dump and report here the rows, maybe I can help you then.

11 REPLIES 11
Read only

Former Member
0 Likes
2,036

well,

If a short dump is raised, please call transaction ST22 and open the short dump and report here the rows, maybe I can help you then.

Read only

0 Likes
2,035

Can you help me on this?

Read only

vattekrishna
Participant
0 Likes
2,035

Hi,

Did you handle the exceptions by uncommenting?

Read only

Former Member
0 Likes
2,035

I am getting the error here...

call function 'CS_BT_MASTB_READ'

exporting

ematnr = csin-matnr

estlan = csin-stlan

etrtyp = anzeigen

ewerks = csin-werks

no_buffer = kreuz

exceptions

mast_nrfd = 1

stzu_nrfd = 4

others = 5.

if sy-subrc eq 0.

flg_error = kreuz.

perform appl_log_write_single_message using chr_e msgid_29

'037'

csin-matnr csin-werks

csin-stlan ' '.

endif.

if flg_error eq kreuz.

clear flg_error.

perform appl_log_exit using 'CSAP_MAT_BOM_CREATE'

changing hlp_subrc.

raise error.<----


endif.

Read only

Former Member
0 Likes
2,035

Here is my code....can anybody help me...

REPORT ZMBAPI_CS01 .

DATA : FNAME TYPE STRING.

DATA : WLV_FILE TYPE RLGRAP-FILENAME.

*DATA : WT_TEST LIKE ALSMEX_TABLINE OCCURS 0 WITH HEADER LINE.

DATA : T_INTERN TYPE STANDARD TABLE OF ALSMEX_TABLINE,

W_INTERN TYPE ALSMEX_TABLINE.

Types : Begin of x_mat,

matnr(18) type c,

plant(4) type c,

bom_usage type STLAN,

END OF x_mat.

Types : Begin of x_bom,

matnr1(18) type c,

matnr2(18) type c,

  • plant(4) type c,

  • bom_usage type STLAN,

itm_no(4) type c,

itm_cat(1) TYPE C,

bom_comp(18) type c,

qty(18) type c,

End of x_bom.

DATA : ITEM_NO(4) TYPE N.

DATA : ITEM_NO2(4) TYPE N.

DATA: counter TYPE i,

itemno(4) TYPE n,

matnr LIKE csap_mbom-matnr,

werks LIKE csap_mbom-werks,

usage LIKE csap_mbom-stlan,

date LIKE csap_mbom-datuv.

****************BOM HEADER***********

DATA: BEGIN OF tstko.

INCLUDE STRUCTURE stko_api01.

DATA: END OF tstko.

**************************************

******************BOM ITEM*********

DATA: BEGIN OF tstpo OCCURS 0.

INCLUDE STRUCTURE stpo_api01.

DATA: END OF tstpo.

*************************************

DATA: flg_warning LIKE capiflag-flwarning.

DATA : L_MSTRING(480).

DATA : T_MAT TYPE STANDARD TABLE OF X_MAT,

W_MAT TYPE X_MAT.

DATA : T_BOM TYPE STANDARD TABLE OF X_BOM,

W_BOM TYPE X_BOM.

DATA : FLAG,

IDX1 TYPE SY-TABIX,

IDN(4) TYPE N,

FNAM(30) TYPE C.

*&----


*

*& SELECTION- SCREEN

*&----


*

SELECTION-SCREEN : BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-001.

PARAMETERS : P_PATH TYPE rlgrap-filename.

SELECTION-SCREEN: END OF BLOCK B1.

AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_PATH.

CALL FUNCTION 'F4_FILENAME'

EXPORTING

PROGRAM_NAME = SYST-CPROG

  • DYNPRO_NUMBER = SYST-DYNNR

  • FIELD_NAME = ' '

IMPORTING

FILE_NAME = P_PATH .

INITIALIZATION.

REFRESH: t_mat, t_bom,t_intern.

CLEAR: w_mat,w_bom,w_intern,idn,flag.

START-OF-SELECTION.

PERFORM UPLOAD_FILES.

PERFORM BOM_UPLOAD.

PERFORM ITEM_DATA.

&----


*& Form UPLOAD_FILES

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


FORM UPLOAD_FILES.

CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'

EXPORTING

FILENAME = P_PATH

I_BEGIN_COL = 1

I_BEGIN_ROW = 2

I_END_COL = 7

I_END_ROW = 100

TABLES

INTERN = T_INTERN

  • EXCEPTIONS

  • INCONSISTENT_PARAMETERS = 1

  • UPLOAD_OLE = 2

  • OTHERS = 3

.

IF SY-SUBRC <> 0.

WRITE 'Path of Excel file is not correct'.

EXIT.

ENDIF.

ENDFORM. " UPLOAD_FILES

&----


*& Form BOM_UPLOAD

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


FORM BOM_UPLOAD.

SORT T_INTERN BY ROW COL.

LOOP AT T_INTERN INTO W_INTERN.

CASE W_INTERN-COL.

WHEN 1.

W_MAT-MATNR = W_INTERN-VALUE.

W_BOM-MATNR1 = W_INTERN-VALUE.

WHEN 2.

  • W_BOM-PLANT = W_INTERN-VALUE.

W_MAT-PLANT = W_INTERN-VALUE.

WHEN 3.

  • W_BOM-BOM_USAGE = W_INTERN-VALUE.

W_MAT-BOM_USAGE = W_INTERN-VALUE.

WHEN 4.

W_BOM-ITM_NO = W_INTERN-VALUE.

WHEN 5.

W_BOM-ITM_CAT = W_INTERN-VALUE.

WHEN 6.

W_BOM-BOM_COMP = W_INTERN-VALUE.

WHEN 7.

W_BOM-QTY = W_INTERN-VALUE.

ENDCASE.

AT END OF ROW.

APPEND W_BOM TO T_BOM.

APPEND W_MAT TO T_MAT.

CLEAR : W_BOM, W_MAT.

ENDAT.

ENDLOOP.

ENDFORM. " BOM_UPLOAD

&----


*& Form ITEM_DATA

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


FORM ITEM_DATA.

CALL FUNCTION 'CALO_INIT_API'

  • EXPORTING

  • FLAG_DB_LOG_ON = 'X'

  • FLAG_MSG_ON = 'X'

  • FLAG_API_API_CALL_ON = ' '

  • FLAG_COLLECT_MSG_ON = ' '

  • EXTERNAL_LOG_NO = 'API'

  • DEL_LOG_AFTER_DAYS = '10'

  • DATA_RESET_SIGN = '!'

EXCEPTIONS

LOG_OBJECT_NOT_FOUND = 1

LOG_SUB_OBJECT_NOT_FOUND = 2

OTHERS = 3

.

IF SY-SUBRC <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

DELETE ADJACENT DUPLICATES FROM T_MAT COMPARING MATNR.

SORT T_MAT BY MATNR.

SORT T_BOM BY MATNR1.

CLEAR : COUNTER, ITEM_NO.

LOOP AT T_MAT INTO W_MAT.

REFRESH TSTPO.

CLEAR : MATNR, WERKS, USAGE.

matnr = w_mat-matnr.

WERKS = W_MAT-PLANT.

USAGE = W_MAT-BOM_USAGE.

LOOP AT T_BOM INTO W_BOM WHERE MATNR1 = W_MAT-MATNR.

ADD 1 TO COUNTER.

ITEM_NO = 10 * COUNTER.

OVERLAY ITEM_NO WITH '0000'.

W_BOM-ITM_NO = ITEM_NO.

  • CONCATENATE '00' ITEM_NO INTO ITEM_NO2.

TSTPO-ITEM_CATEG = W_BOM-ITM_CAT.

TSTPO-ITEM_NO = W_BOM-ITM_NO.

TSTPO-COMPONENT = W_BOM-BOM_COMP.

TSTPO-COMP_QTY = W_BOM-QTY.

APPEND TSTPO.

CLEAR : W_BOM,TSTPO.

ENDLOOP.

  • WRITE: / 'MATNR'.

CALL FUNCTION 'CSAP_MAT_BOM_CREATE'

EXPORTING

MATERIAL = MATNR

PLANT = WERKS

BOM_USAGE = USAGE

  • VALID_FROM =

  • CHANGE_NO =

  • REVISION_LEVEL =

I_STKO = TSTKO

FL_NO_CHANGE_DOC = ' '

FL_COMMIT_AND_WAIT = ' '

FL_CAD = ' '

FL_DEFAULT_VALUES = 'X'

IMPORTING

FL_WARNING = flg_warning

  • BOM_NO =

TABLES

T_STPO = TSTPO[]

  • T_DEP_DATA =

  • T_DEP_DESCR =

  • T_DEP_ORDER =

  • T_DEP_SOURCE =

  • T_DEP_DOC =

  • T_LTX_LINE =

  • T_STPU =

  • EXCEPTIONS

  • ERROR = 1

  • OTHERS = 2

.

IF SY-SUBRC <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

ENDLOOP.

ENDFORM. " ITEM_DATA

Read only

0 Likes
2,035

Hi ,

I think u did.

please check the parameters those you passed to Exporting and Importing.

Follw the path from SE38

Program -> check -> Extended program check -> click on execute where you can see the errors if you didn't pass the parameters to functionmodule.

Read only

fernando_martin
Active Participant
0 Likes
2,035

Hi Ashmita,

looking at the FM code:

*- Baustein nur für Anlegen einfache Stückliste, deshalb

  • lesen, ob Stückliste bereits existiert

call function 'CS_BT_MASTB_READ'

exporting

ematnr = csin-matnr

estlan = csin-stlan

etrtyp = anzeigen

ewerks = csin-werks

no_buffer = kreuz

exceptions

mast_nrfd = 1

stzu_nrfd = 4

others = 5.

if sy-subrc eq 0.

flg_error = kreuz.

perform appl_log_write_single_message using chr_e msgid_29

'037'

csin-matnr csin-werks

csin-stlan ' '.

endif.

if flg_error eq kreuz.

clear flg_error.

perform appl_log_exit using 'CSAP_MAT_BOM_CREATE'

changing hlp_subrc.

raise error.

endif.

it tells you to show an error if the BOM already exists. Look if this is the case.

Hope this helps.

Regards

Read only

Former Member
0 Likes
2,035

Hi Asmita ,

What I can see is , you are making call to raise statement explicitly and thats the reason you are getting an exception called and that too i snot handled in ur program. Please also see the condition which is making call to this statement.

Instead of Raise see if you can display a error message.

Hope this is helpful.

Regards,

Uma Dave

Read only

0 Likes
2,035

Hi Ashmita,

As said by fmartin73 ,the BOM must be exists already.check one more time.

Had you handled the exceptions you might have known this by looking at the the error message instead of dump.

Read only

Former Member
0 Likes
2,035

Yes correct...after giving the new material i am gettinf new error...

Source code extract

005600 transporting no fields.

005610 if sy-subrc eq 0.

005620 perform ltext_maintain

005630 tables t_ltx_line

005640 using '2'

005650 stpox-identifier

005660 l_tbx

005670 typ_mat.

005680 endif.

005690 * end of insertion note 505378

005700

005710 * Unterpositionen "note 530922

005720 if not lt_stpub is initial. "note 530922

005730 perform upos_maintain "note 530922

005740 tables lt_stpub "note 530922

005750 using l_tbx "note 530922

005760 0. "note 530922

005770 endif. "note 530922

005780 endif.

005790 if not flg_api_warning is initial.

005800 flg_warning = kreuz.

005810 endif.

005820 endif.

005830 endloop.

005840

005850 if flg_error eq kreuz.

005860 fl_warning = flg_warning.

005870 perform appl_log_exit using 'CSAP_MAT_BOM_CREATE'

005880 changing hlp_subrc.

005890 call function 'DEQUEUE_ALL'.

> raise error.

005910 else.

Is there any problem in FM itself?

plz help..

Read only

Former Member
0 Likes
2,035

This question seems as answered (solved) at the top but we've the same problem in these days.

We controlled (checked) the case that if the BOM is already exist in the system and nothing found, returned.

Could anybody help?

Thanks for responses.

Mustafa