Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Problem in using ' BAPI_MATERIAL_SAVEDATA'

Problem in using BAPI_MATERIAL_SAVEDATA

Hi Experts,

I want to extend a Material from Plant A to Plant B. I am getting the following error.

E MM 360 Key fields for user data PLANTDATA and checkbox structure PLANTDATAX are different

Please correct in the code:

data: la_headdata type BAPIMATHEAD,

la_clientdata type BAPI_MARA,

la_CLIENTDATAX type BAPI_MARAX,

la_PLANTDATA type BAPI_marc, "Plant View

la_PLANTDATAX type bapi_marcx, "Plant View

la_mbew type bapi_mbew, "Accounting View

la_mbewx type bapi_mbewx.

*la_return type BAPIRET2.

*to return messages

DATA:BEGIN OF la_RETURN OCCURS 0.

INCLUDE STRUCTURE BAPIRET2.

DATA:END OF la_RETURN.

data: i_materialdescription type table of BAPI_MAKT,

wa_mat_desc like line of i_materialdescription.

  • Header

la_headdata-MATERIAL = '000001000000004000'.

la_headdata-IND_SECTOR = 'M'.

la_headdata-MATL_TYPE = 'ZALB'.

la_headdata-basic_view = 'X'.

la_headdata-purchase_view = 'X'.

la_headdata-account_view = 'X'.

la_headdata-MRP_VIEW = 'X'.

la_headdata-STORAGE_VIEW = 'X'.

la_headdata-COST_VIEW = 'X'.

  • Client Data - Basic

la_clientdata-BASE_UOM = 'EA'.

la_CLIENTDATAX-BASE_UOM = 'X'.

la_clientdata-MATL_GROUP = '21001000'.

la_CLIENTDATAX-MATL_GROUP = 'X'.

la_clientdata-unit_of_wt = 'KG'.

la_clientdatax-unit_of_wt = 'X'.

la_clientdata-division = '10'.

la_clientdatax-division = 'X'.

  • Material Description

wa_mat_desc-langu = 'E'.

wa_mat_desc-MATL_DESC = '+TLA,FILTER KIT,BUNDLE B'.

append wa_mat_desc to i_materialdescription.

clear: wa_mat_desc.

  • Plant - Purchasing

la_PLANTDATA-plant = '5530'.

la_PLANTDATAX-plant = 'X'.

la_PLANTDATA-pur_group = '006'.

la_PLANTDATAX-pur_group = 'X'.

  • Accounting

la_mbew-val_area = '5530'.

la_mbewx-val_area = 'X'.

la_mbew-price_ctrl = 'S'.

la_mbewx-price_ctrl = 'X'.

la_mbew-std_price = '0.01'.

la_mbewx-std_price = 'X'.

*la_mbew-price_unit = '1.000'.

*la_mbewx-price_unit = 'X'.

CALL FUNCTION 'BAPI_MATERIAL_SAVEDATA'

EXPORTING

headdata = la_headdata

CLIENTDATA = la_clientdata

CLIENTDATAX = la_CLIENTDATAX

PLANTDATA = la_PLANTDATA

PLANTDATAX = la_PLANTDATAX

  • FORECASTPARAMETERS =

  • FORECASTPARAMETERSX =

  • PLANNINGDATA =

  • PLANNINGDATAX =

  • STORAGELOCATIONDATA =

  • STORAGELOCATIONDATAX =

VALUATIONDATA = la_mbew

VALUATIONDATAX = la_mbewx

  • WAREHOUSENUMBERDATA =

  • WAREHOUSENUMBERDATAX =

  • SALESDATA =

  • SALESDATAX =

  • STORAGETYPEDATA =

  • STORAGETYPEDATAX =

  • FLAG_ONLINE = ' '

  • FLAG_CAD_CALL = ' '

IMPORTING

RETURN = la_return

TABLES

MATERIALDESCRIPTION = i_materialdescription

  • UNITSOFMEASURE =

  • UNITSOFMEASUREX =

  • INTERNATIONALARTNOS =

  • MATERIALLONGTEXT =

  • TAXCLASSIFICATIONS =

  • RETURNMESSAGES =

  • PRTDATA =

  • PRTDATAX =

  • EXTENSIONIN =

  • EXTENSIONINX =

.

read table la_return with key TYPE = 'S'.

if sy-subrc = 0.

CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'.

endif.

WRITE:/ la_RETURN-TYPE,

2 la_RETURN-ID,

22 la_RETURN-NUMBER,

25 la_RETURN-MESSAGE.

Former Member
Not what you were looking for? View more on this topic or Ask a question