11-05-2007 10:44 AM
Hi,
We need to use BAPI BAPI_MATERIAL_SAVEDATA to create material in SAP. It is required to create/change materials with reference to a change number.
However we did not find any reference of Change number in this function module.
Is there any possiblity to use the change number within this function ?
Alternatively is there any other function module available for creataion/change of material along with ECN ?
Thanks & Regards,
Devendra
09-11-2008 12:11 PM
Hello,
Please have a look inside the function 'BAPI_MATERIAL_SAVEDATA', that you want to use:
The function 'BAPI_MATERIAL_SAVEDATA' passes the structure 'MARA_UEB' while calling the fonction 'MATERIAL_MAINTAIN_DARK'. The structure 'MARA_UEB' contains the field 'AENNR' for the change number.
You can fill this field by using the extension tables of the function 'BAPI_MATERIAL_SAVEDATA':
DATA: lt_bapiparex LIKE bapiparex OCCURS 0 WITH HEADER LINE,
lt_bapiparexx LIKE bapiparexx OCCURS 0 WITH HEADER LINE.
lt_bapiparex-structure = 'BAPI_TE_MARA'.
lt_bapiparex-valuepart1+0(18) = ls_mathead-material.
lt_bapiparex-valuepart1+18(12) = '000000001180'.
APPEND lt_bapiparex.
CLEAR lt_bapiparex.
lt_bapiparexx-structure = 'BAPI_TE_MARAX'.
lt_bapiparexx-valuepart1+0(18) = ls_mathead-material.
lt_bapiparexx-valuepart1+18(1) = 'X'.
APPEND lt_bapiparexx.
CLEAR lt_bapiparexx.
CALL FUNCTION 'BAPI_MATERIAL_SAVEDATA'
EXPORTING
headdata = ls_mathead
clientdata = ls_mara
clientdatax = ls_marax
plantdata = ls_marc
plantdatax = ls_marcx
forecastparameters = ls_mpop
forecastparametersx = ls_mpopx
planningdata = ls_mpgd
planningdatax = ls_mpgdx
storagelocationdata = ls_mard
storagelocationdatax = ls_mardx
valuationdata = ls_mbew
valuationdatax = ls_mbewx
warehousenumberdata = ls_mlgn
warehousenumberdatax = ls_mlgnx
salesdata = ls_mvke
salesdatax = ls_mvkex
storagetypedata = ls_mlgt
storagetypedatax = ls_mlgtx
IMPORTING
return = ls_bapiret2
TABLES
materialdescription = lt_makt
unitsofmeasure = lt_marm
unitsofmeasurex = lt_marmx
internationalartnos = lt_mean
materiallongtext = lt_mltx
taxclassifications = lt_mlan
returnmessages = lt_matreturn2
prtdata = lt_mfhm
prtdatax = lt_mfhmx.
extensionin = lt_bapiparex
extensioninx = lt_bapiparexx.
Best regards,
Holger
09-12-2008 8:22 AM
I have forgotten to mention the following:
You have also to create an append structure of the structure BAPI_TE_MARA. You have to put the field AENNR with the data element AENNR in this append structure.
You have also to create an append structure of the structure BAPI_TE_MARAX. You have to put the field AENNR with the data element BAPIUPDATE in this append structure.
03-23-2013 11:30 AM
10-16-2014 8:03 AM
Hi Bruno/Holger,
I know it is old thread. but this solution is not working for me. I have tried & implemented the same.
So I created one new thread for this issue. Can you please help me here.
http://scn.sap.com/thread/3636157
Appreciate your response.
Regards,
SK