2008 Aug 08 7:27 AM
Hi All,
I have a requirement, where in now I have created the Material in Material Master and also created the BOM using the materials created. Now that I want to have the change in the structure of the BOM or in the quantity of materials used in BOM.
For this to happen I need to create a change number which I can do it in CC01, How do I link this change no with the BOM structure or the materials that under changes.
How can I handle this using the BAPI's. Is their a way I can create a change number using a BAPI.
I am using the BAPI_MATERIAL_SAVEDATA to create/change material and BAPI_BOM_UPLOAD_SAVE to create or change BOM. Which field in these BAPI's should be link to the change number which is created above.
Regards,
Nithiyanandam
2008 Sep 11 12:09 PM
Hello,
here is the answer, how you can link the change number to the material by using the function 'BAPI_MATERIAL_SAVEDATA' :
Please have a look inside the function 'BAPI_MATERIAL_SAVEDATA' :
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
Hello,
here is the answer, how you can link the change number to the material by using the function 'BAPI_MATERIAL_SAVEDATA' :
Please have a look inside the function 'BAPI_MATERIAL_SAVEDATA' :
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
2008 Aug 08 9:00 AM
Hi Guys,
Please provide some suggestions.
Regards,
Nithiyanandam
2008 Aug 08 9:41 AM
Hi Guys,
Any clues... Please provide some lights to this.. I have not worked in ABAP.. I am working on XI.. So I dont really understand what will the exact way to handle these change number(ECN).
Regards,
Nithiyanandam
2008 Aug 21 7:58 AM
2008 Sep 11 12:09 PM
Hello,
here is the answer, how you can link the change number to the material by using the function 'BAPI_MATERIAL_SAVEDATA' :
Please have a look inside the function 'BAPI_MATERIAL_SAVEDATA' :
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
2008 Sep 12 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.
| User | Count |
|---|---|
| 4 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |