Application Development 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: 

Bapi material master create

Former Member
0 Kudos

heloo gurus,

when i execute the below code

it throws a short dump error

can u please correct my code if there is anything wrong in it

DATA: headdata TYPE bapimathead.

DATA: clientdata TYPE bapi_mara.

DATA: clientdatax TYPE bapi_marax.

DATA: plantdata TYPE bapi_marc.

DATA: plantdatax TYPE bapi_marcx.

DATA: descdata TYPE TABLE OF bapi_makt WITH HEADER LINE.

*data: return type table of bapiret2 with header line.

DATA: returnm TYPE TABLE OF bapi_matreturn2 WITH HEADER LINE.

DATA: imat TYPE TABLE OF bapimatinr WITH HEADER LINE.

CALL FUNCTION 'BAPI_MATERIAL_GETINTNUMBER'

EXPORTING

material_type = 'ZMED'

  • INDUSTRY_SECTOR = 'M'

TABLES

material_number = imat.

READ TABLE imat INDEX 1.

IF sy-subrc = 0.

headdata-material = imat-material.

ENDIF.

headdata-ind_sector = 'Z'.

headdata-matl_type = mtart.

headdata-basic_view = 'X'.

headdata-purchase_view = 'X'.

clientdata-base_uom = meins.

clientdatax-base_uom = 'X'.

clientdata-old_mat_no = bismt.

clientdatax-old_mat_no = 'X'.

clientdata-matl_group = matkl.

clientdatax-matl_group = 'X'.

clientdata-document = zeinr.

clientdatax-document = 'X'.

clientdata-size_dim = groes.

clientdatax-size_dim = 'X'.

clientdata-std_descr = normt.

clientdatax-std_descr = 'X'.

clientdata-basic_matl = wrkst.

clientdatax-basic_matl = 'X'.

clientdata-del_flag = lvorm.

clientdatax-del_flag = 'X'.

descdata-langu = sy-langu.

descdata-matl_desc = maktx.

APPEND descdata.

plantdata-pur_group = ekgrp.

plantdatax-pur_group = 'X'.

plantdata-auto_p_ord = kautb.

plantdatax-auto_p_ord = 'X'.

plantdata-plant = werks.

plantdatax-plant = 'X'.

CALL FUNCTION 'BAPI_MATERIAL_SAVEDATA'

EXPORTING

headdata = headdata

clientdata = clientdata

clientdatax = clientdatax

plantdata = plantdata

plantdatax = plantdatax

  • FORECASTPARAMETERS =

  • FORECASTPARAMETERSX =

  • PLANNINGDATA =

  • PLANNINGDATAX =

  • STORAGELOCATIONDATA =

  • STORAGELOCATIONDATAX =

  • VALUATIONDATA =

  • VALUATIONDATAX =

  • WAREHOUSENUMBERDATA =

  • WAREHOUSENUMBERDATAX =

  • SALESDATA =

  • SALESDATAX =

  • STORAGETYPEDATA =

  • STORAGETYPEDATAX =

IMPORTING

return = return

TABLES

materialdescription = descdata

  • UNITSOFMEASURE =

  • UNITSOFMEASUREX =

  • INTERNATIONALARTNOS =

  • MATERIALLONGTEXT =

  • TAXCLASSIFICATIONS =

returnmessages = returnm

  • PRTDATA =

  • PRTDATAX =

  • EXTENSIONIN =

  • EXTENSIONINX =

.

  • CHECK sy-subrc = 0.

IF sy-subrc EQ 0.

return-number = 0.

return-type = 'S'.

return-id = 'Z1'.

return-message = 'Successfully updated'.

return-message_v1 = ''.

return-message_v2 = ''.

return-message_v3 = ''.

return-message_v4 = sy-mandt.

ELSE.

return-number = 0.

return-type = 'E'.

return-id = 'Z1'.

return-message = 'Not updated'.

return-message_v1 = ''.

return-message_v2 = ''.

return-message_v3 = ''.

return-message_v4 = sy-mandt.

ENDIF.

<b>Error analysis</b>

An exception occurred. This exception is dealt with in more detail bel

. The exception, which is assigned to the class 'CX_SY_DYN_CALL_ILLEGA

was neither

caught nor passed along using a RAISING clause, in the procedure

"ZTEST_BAPI_MM01" "(FUNCTION)"

.

Since the caller of the procedure could not have expected this excepti

to occur, the running program was terminated.

The reason for the exception is:

The call to the function module "BAPI_MATERIAL_SAVEDATA" is incorrect:

In the function module interface, you can specify only

fields of a specific type and length under "RETURN".

Although the currently specified field

"RETURN" is the correct type, its length is incorrect.

Thamks

senthil

2 REPLIES 2

Former Member
0 Kudos

i have removed the comment

data: return type table of bapiret2 with header line.

Former Member
0 Kudos

i have uncommented the line

data: return type table of bapiret2 with header line.