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_SAVEDATA to update material master

Former Member
0 Kudos

Hi,

I am using BAPI_MATERIAL_SAVEDATA to update a material. I am updating only one field i.e MARA-MSTAE(X-plant material status on basic data 1 view) But when i excecute the BAPI its giving an error message "The field MARA-TRAGR/BAPI_MARA-TRANS_GRP is defined as a required field; it does not contain an entry" but in MARA its updating MSTAE field.

I am pasting here my code. Please help me how to solve this problem.

REPORT ZTEST1 no standard page heading.

data: headdata type bapimathead,

client_data type bapi_mara,

client_datax type bapi_marax,

return like bapiret2,

headdata-material = '000000000190000195'.

client_data-PUR_STATUS = '10'.

client_datax-PUR_STATUS = 'X'.

CALL FUNCTION 'BAPI_MATERIAL_SAVEDATA'

EXPORTING

HEADDATA = headdata

CLIENTDATA = client_data

CLIENTDATAX = CLIENT_DATAX

  • PLANTDATA =

  • PLANTDATAX =

  • FORECASTPARAMETERS =

  • FORECASTPARAMETERSX =

  • PLANNINGDATA =

  • PLANNINGDATAX =

  • STORAGELOCATIONDATA =

  • STORAGELOCATIONDATAX =

  • VALUATIONDATA =

  • VALUATIONDATAX =

  • WAREHOUSENUMBERDATA =

  • WAREHOUSENUMBERDATAX =

  • SALESDATA =

  • SALESDATAX =

  • STORAGETYPEDATA =

  • STORAGETYPEDATAX =

  • FLAG_ONLINE = ' '

  • FLAG_CAD_CALL = ' '

  • NO_DEQUEUE = ' '

IMPORTING

RETURN = return

  • TABLES

  • MATERIALDESCRIPTION =

  • UNITSOFMEASURE =

  • UNITSOFMEASUREX =

  • INTERNATIONALARTNOS =

  • MATERIALLONGTEXT =

  • TAXCLASSIFICATIONS =

  • RETURNMESSAGES =

  • PRTDATA =

  • PRTDATAX =

  • EXTENSIONIN =

  • EXTENSIONINX =

.

if return-type = 'S'.

commit WORK.

endif.

In material 190000195 there are only 2 views basic data1 and basic data2. Initially MARA-MSTAE is '00' and i am trying to update it as '10'. My code is updating the field but giving return parameter as Error.

I also checked in Value range table of TRAGR we can have blank value i.e Generic value.

Thanks in Advance.

Rajesh.

3 REPLIES 3

Former Member
0 Kudos

Hi Rajesh,

When you update the material master using the transaction MM02, do you get the same error message? Is transportation group in Customizing defined as a required field?

Regards,

John.

0 Kudos

No, I am not getting any error message when i am modifying that material through MM02 transaction. Because the material have only Basic data 1&2 views. Tragr(transportation group) field is in sales view.

Also the TRAGR field is mandatory in our customizing.

One strange thing is the BAPI is updating Material master but the return message is showing as error.

Thanks,

Rajesh.

0 Kudos

Hello,

I guess the error is caused due to the fact the TRAGR field is in the MARA table, although it is only shown at the Sales level.

If in customizing the field is set to obligatory it should be filled, despite the fact you are not changing any Sales-view related data because the field is in the MARA table.

Regards,

John.