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

BAPI_MATERIAL_SAVEDATA

Former Member
0 Likes
516

Hi to everyone.

I'm using BAPI_MATERIAL_SAVEDATA to duplicate some material (basically I want to create a copy of a material but changing the PLANT). Should I inform all the fields or just the material number in the headdata and the new plant?

Thanks

carles

4 REPLIES 4
Read only

Former Member
0 Likes
465

See the sample code.....

report zrich_0003 .

data: headdata type bapimathead.

data: clientdata type bapi_mara.

data: clientdatax type bapi_marax.

data: descdata type table of BAPI_MAKT with header line.

data: return type bapiret2 .

data: returnm type table of bapi_matreturn2 with header line.

data: xmara type mara.

parameters: p_matnr type mara-matnr.

headdata-material = p_matnr.

headdata-ind_sector = 'M'.

headdata-matl_type = 'FERT'.

headdata-basic_view = 'X'.

clientdata-BASE_UOM = 'EA'.

clientdatax-BASE_UOM = 'X'.

clientdata-old_mat_no = 'Old Material'.

clientdatax-old_mat_no = 'X'.

clientdata-division = '00'.

clientdatax-division = 'X'.

descdata-LANGU = sy-langu.

descdata-MATL_DESC = 'This is the description'.

append descdata.

call function 'BAPI_MATERIAL_SAVEDATA'

exporting

headdata = headdata

clientdata = clientdata

clientdatax = clientdatax

  • PLANTDATA =

  • 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.

Check these links........

Regards,

Pavan

Read only

RaymondGiuseppi
Active Contributor
0 Likes
465

Just fill what is needed :

HEADDATA
PLANTDATA
PLANTDATAX

Regards

Read only

Former Member
Read only

Former Member
0 Likes
465

Before calling the BAPI_MATERIAL_SAVEDATA, I recover the material data using BAPI_MATERIAL_GET_ALL.

Then I do MOVE-CORRESPONDING to move data from the clientdata and plantdata wa recovered to the headdata, clientdata and plantdata wa that I need to inform BAPI_MATERIAL_SAVEDATA. Then I need to fill the clientdatax and plantdatax wa, but the fields informed may vary depending on the material (the delete flag may or may not be marked...), and I suppose the better way to inform the clientdatax and plantdatax wa would be filling all their fields, but how can I do that?

thanks.

carles