Skip to Content
avatar image
Former Member

Change Number in BAPI_MATERIAL_SAVEDATA

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

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • avatar image
    Former Member
    Sep 11, 2008 at 11:11 AM

    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

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Sep 12, 2008 at 07: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.

    Add comment
    10|10000 characters needed characters exceeded