SAP Tables

BAPI_MATERIAL_SAVEDATA SAP Function module - Create and Change Material Master Data




BAPI_MATERIAL_SAVEDATAis a standard SAP function module available within R/3 SAPsystems depending on your version and release level. Below is the pattern details for this FM showing its interface including any import/export parameters, exceptions etc as well as any documentation contributions specific to the object. See here to view full function module documentation and code listing, simply by entering the name BAPI_MATERIAL_SAVEDATA into the relevant SAP transaction such as SE37 or SE80.

Contribute (Add Comments)
Please help keep this info upto date and use the comments section below to add useful hints, tips and information specific to this SAP function. This will then be available for you and other users to easily find by simply searching on the object name BAPI_MATERIAL_SAVEDATA or its description.


Pattern for FM BAPI_MATERIAL_SAVEDATA - BAPI MATERIAL SAVEDATA
Associated Function Group: 1001UEB
Released Date: 16.01.2006
CALL FUNCTION 'BAPI_MATERIAL_SAVEDATA' "Create and Change Material Master Data
  EXPORTING
    headdata =                  " bapimathead   Header segment with control information
*   clientdata =                " bapi_mara     Client-specific material data
*   clientdatax =               " bapi_marax    Information on update for CLIENTDATA
*   plantdata =                 " bapi_marc     Plant-specific material data
*   plantdatax =                " bapi_marcx    Information on update for PLANTDATA
*   forecastparameters =        " bapi_mpop     Forecast Parameters
*   forecastparametersx =       " bapi_mpopx    Information on update for FORECASTDATA
*   planningdata =              " bapi_mpgd     Planning data
*   planningdatax =             " bapi_mpgdx    Information on update for PLANNINGDATA
*   storagelocationdata =       " bapi_mard     Storage-location-specific material data
*   storagelocationdatax =      " bapi_mardx    Information on update for STORAGELOCATIONDATA
*   valuationdata =             " bapi_mbew     Valuation data
*   valuationdatax =            " bapi_mbewx    Information on update for VALUATIONDATA
*   warehousenumberdata =       " bapi_mlgn     Warehouse-number-specific material data
*   warehousenumberdatax =      " bapi_mlgnx    Information on update for WAREHOUSEDATA
*   salesdata =                 " bapi_mvke     Sales data
*   salesdatax =                " bapi_mvkex    Information on update for SALESDATA
*   storagetypedata =           " bapi_mlgt     Storage-type-specific material data
*   storagetypedatax =          " bapi_mlgtx    Information on update for STORAGETYPEDATA
*   flag_online = SPACE         " bapie1global_data-testrun  No ALE Field Selection
*   flag_cad_call = SPACE       " bapie1global_data-testrun  Call From CAD System
*   no_dequeue = SPACE          " bapie1global_data-testrun  Screens, display user entry
*   no_rollback_work = SPACE    " bapie1global_data-testrun  Override rollback if error occurs
  IMPORTING
    return =                    " bapiret2      Return parameters
* TABLES
*   materialdescription =       " bapi_makt     Material descriptions
*   unitsofmeasure =            " bapi_marm     Units of measure
*   unitsofmeasurex =           " bapi_marmx    Information on update for UNITSOFMEASURE
*   internationalartnos =       " bapi_mean     International Article Numbers (EANs)
*   materiallongtext =          " bapi_mltx     Long texts
*   taxclassifications =        " bapi_mlan     Tax classifications
*   returnmessages =            " bapi_matreturn2  All messages
*   prtdata =                   " bapi_mfhm     Production resource/tool (PRT) fields in the material master
*   prtdatax =                  " bapi_mfhmx    Information on update for PRTDATAX
*   extensionin =               " bapiparex     Reference Structure for BAPI Parameters EXTENSIONIN/EXTENSIONOUT
*   extensioninx =              " bapiparexx    Reference Structure for BAPI Parameters EXTENSIONIN/EXTENSIONOUT
    .  "  BAPI_MATERIAL_SAVEDATA

ABAP code example for Function Module BAPI_MATERIAL_SAVEDATA

The ABAP code below is a full code listing to execute function module BAPI_MATERIAL_SAVEDATA including all data declarations. The code uses the latest in-line data declaration syntax but I have included an abap code snipet at the end to show how declarations would look using the original method of declaring data variables up front. This will allow you to compare and fully understand the new inline method. Please note some of the newer syntax such as the @DATA is not available until a later 4.70 service pack (SP8).
DATA:
ld_return   TYPE BAPIRET2,
it_materialdescription   TYPE STANDARD TABLE OF BAPI_MAKT,"tables param
wa_materialdescription LIKE LINE OF it_materialdescription  ,
it_unitsofmeasure   TYPE STANDARD TABLE OF BAPI_MARM,"tables param
wa_unitsofmeasure LIKE LINE OF it_unitsofmeasure  ,
it_unitsofmeasurex   TYPE STANDARD TABLE OF BAPI_MARMX,"tables param
wa_unitsofmeasurex LIKE LINE OF it_unitsofmeasurex  ,
it_internationalartnos   TYPE STANDARD TABLE OF BAPI_MEAN,"tables param
wa_internationalartnos LIKE LINE OF it_internationalartnos  ,
it_materiallongtext   TYPE STANDARD TABLE OF BAPI_MLTX,"tables param
wa_materiallongtext LIKE LINE OF it_materiallongtext  ,
it_taxclassifications   TYPE STANDARD TABLE OF BAPI_MLAN,"tables param
wa_taxclassifications LIKE LINE OF it_taxclassifications  ,
it_returnmessages   TYPE STANDARD TABLE OF BAPI_MATRETURN2,"tables param
wa_returnmessages LIKE LINE OF it_returnmessages  ,
it_prtdata   TYPE STANDARD TABLE OF BAPI_MFHM,"tables param
wa_prtdata LIKE LINE OF it_prtdata  ,
it_prtdatax   TYPE STANDARD TABLE OF BAPI_MFHMX,"tables param
wa_prtdatax LIKE LINE OF it_prtdatax  ,
it_extensionin   TYPE STANDARD TABLE OF BAPIPAREX,"tables param
wa_extensionin LIKE LINE OF it_extensionin  ,
it_extensioninx   TYPE STANDARD TABLE OF BAPIPAREXX,"tables param
wa_extensioninx LIKE LINE OF it_extensioninx  .

DATA(ld_headdata) = 'Check type of data required'.
DATA(ld_clientdata) = 'Check type of data required'.
DATA(ld_clientdatax) = 'Check type of data required'.
DATA(ld_plantdata) = 'Check type of data required'.
DATA(ld_plantdatax) = 'Check type of data required'.
DATA(ld_forecastparameters) = 'Check type of data required'.
DATA(ld_forecastparametersx) = 'Check type of data required'.
DATA(ld_planningdata) = 'Check type of data required'.
DATA(ld_planningdatax) = 'Check type of data required'.
DATA(ld_storagelocationdata) = 'Check type of data required'.
DATA(ld_storagelocationdatax) = 'Check type of data required'.
DATA(ld_valuationdata) = 'Check type of data required'.
DATA(ld_valuationdatax) = 'Check type of data required'.
DATA(ld_warehousenumberdata) = 'Check type of data required'.
DATA(ld_warehousenumberdatax) = 'Check type of data required'.
DATA(ld_salesdata) = 'Check type of data required'.
DATA(ld_salesdatax) = 'Check type of data required'.
DATA(ld_storagetypedata) = 'Check type of data required'.
DATA(ld_storagetypedatax) = 'Check type of data required'.

DATA(ld_flag_online). = 'some text here'

DATA(ld_flag_cad_call). = 'some text here'

DATA(ld_no_dequeue). = 'some text here'

DATA(ld_no_rollback_work). = 'some text here'

"populate fields of struture and append to itab
append wa_materialdescription to it_materialdescription.

"populate fields of struture and append to itab
append wa_unitsofmeasure to it_unitsofmeasure.

"populate fields of struture and append to itab
append wa_unitsofmeasurex to it_unitsofmeasurex.

"populate fields of struture and append to itab
append wa_internationalartnos to it_internationalartnos.

"populate fields of struture and append to itab
append wa_materiallongtext to it_materiallongtext.

"populate fields of struture and append to itab
append wa_taxclassifications to it_taxclassifications.

"populate fields of struture and append to itab
append wa_returnmessages to it_returnmessages.

"populate fields of struture and append to itab
append wa_prtdata to it_prtdata.

"populate fields of struture and append to itab
append wa_prtdatax to it_prtdatax.

"populate fields of struture and append to itab
append wa_extensionin to it_extensionin.

"populate fields of struture and append to itab
append wa_extensioninx to it_extensioninx.. CALL FUNCTION 'BAPI_MATERIAL_SAVEDATA' EXPORTING headdata = ld_headdata * clientdata = ld_clientdata * clientdatax = ld_clientdatax * plantdata = ld_plantdata * plantdatax = ld_plantdatax * forecastparameters = ld_forecastparameters * forecastparametersx = ld_forecastparametersx * planningdata = ld_planningdata * planningdatax = ld_planningdatax * storagelocationdata = ld_storagelocationdata * storagelocationdatax = ld_storagelocationdatax * valuationdata = ld_valuationdata * valuationdatax = ld_valuationdatax * warehousenumberdata = ld_warehousenumberdata * warehousenumberdatax = ld_warehousenumberdatax * salesdata = ld_salesdata * salesdatax = ld_salesdatax * storagetypedata = ld_storagetypedata * storagetypedatax = ld_storagetypedatax * flag_online = ld_flag_online * flag_cad_call = ld_flag_cad_call * no_dequeue = ld_no_dequeue * no_rollback_work = ld_no_rollback_work IMPORTING return = ld_return * TABLES * materialdescription = it_materialdescription * unitsofmeasure = it_unitsofmeasure * unitsofmeasurex = it_unitsofmeasurex * internationalartnos = it_internationalartnos * materiallongtext = it_materiallongtext * taxclassifications = it_taxclassifications * returnmessages = it_returnmessages * prtdata = it_prtdata * prtdatax = it_prtdatax * extensionin = it_extensionin * extensioninx = it_extensioninx . " BAPI_MATERIAL_SAVEDATA
IF SY-SUBRC EQ 0.   "All OK ENDIF.

ABAP code to compare 7.40 inline data declaration with original syntax

The below ABAP code uses the older none in-line data declarations. This allows you to see the coding differences/benefits of the later inline syntax. It may also be useful if you are using an older version of SAP as some of the newer syntax above, such as the @DATA is not available until 4.70 EHP 8.
DATA:
ld_return TYPE BAPIRET2 ,
ld_headdata TYPE BAPIMATHEAD ,
it_materialdescription TYPE STANDARD TABLE OF BAPI_MAKT ,
wa_materialdescription LIKE LINE OF it_materialdescription,
ld_clientdata TYPE BAPI_MARA ,
it_unitsofmeasure TYPE STANDARD TABLE OF BAPI_MARM ,
wa_unitsofmeasure LIKE LINE OF it_unitsofmeasure,
ld_clientdatax TYPE BAPI_MARAX ,
it_unitsofmeasurex TYPE STANDARD TABLE OF BAPI_MARMX ,
wa_unitsofmeasurex LIKE LINE OF it_unitsofmeasurex,
ld_plantdata TYPE BAPI_MARC ,
it_internationalartnos TYPE STANDARD TABLE OF BAPI_MEAN ,
wa_internationalartnos LIKE LINE OF it_internationalartnos,
ld_plantdatax TYPE BAPI_MARCX ,
it_materiallongtext TYPE STANDARD TABLE OF BAPI_MLTX ,
wa_materiallongtext LIKE LINE OF it_materiallongtext,
ld_forecastparameters TYPE BAPI_MPOP ,
it_taxclassifications TYPE STANDARD TABLE OF BAPI_MLAN ,
wa_taxclassifications LIKE LINE OF it_taxclassifications,
ld_forecastparametersx TYPE BAPI_MPOPX ,
it_returnmessages TYPE STANDARD TABLE OF BAPI_MATRETURN2 ,
wa_returnmessages LIKE LINE OF it_returnmessages,
ld_planningdata TYPE BAPI_MPGD ,
it_prtdata TYPE STANDARD TABLE OF BAPI_MFHM ,
wa_prtdata LIKE LINE OF it_prtdata,
ld_planningdatax TYPE BAPI_MPGDX ,
it_prtdatax TYPE STANDARD TABLE OF BAPI_MFHMX ,
wa_prtdatax LIKE LINE OF it_prtdatax,
ld_storagelocationdata TYPE BAPI_MARD ,
it_extensionin TYPE STANDARD TABLE OF BAPIPAREX ,
wa_extensionin LIKE LINE OF it_extensionin,
it_extensioninx TYPE STANDARD TABLE OF BAPIPAREXX ,
wa_extensioninx LIKE LINE OF it_extensioninx,
ld_storagelocationdatax TYPE BAPI_MARDX ,
ld_valuationdata TYPE BAPI_MBEW ,
ld_valuationdatax TYPE BAPI_MBEWX ,
ld_warehousenumberdata TYPE BAPI_MLGN ,
ld_warehousenumberdatax TYPE BAPI_MLGNX ,
ld_salesdata TYPE BAPI_MVKE ,
ld_salesdatax TYPE BAPI_MVKEX ,
ld_storagetypedata TYPE BAPI_MLGT ,
ld_storagetypedatax TYPE BAPI_MLGTX ,
ld_flag_online TYPE BAPIE1GLOBAL_DATA-TESTRUN ,
ld_flag_cad_call TYPE BAPIE1GLOBAL_DATA-TESTRUN ,
ld_no_dequeue TYPE BAPIE1GLOBAL_DATA-TESTRUN ,
ld_no_rollback_work TYPE BAPIE1GLOBAL_DATA-TESTRUN .

ld_return = 'Check type of data required'.
ld_headdata = 'Check type of data required'.

"populate fields of struture and append to itab
append wa_materialdescription to it_materialdescription.
ld_clientdata = 'Check type of data required'.

"populate fields of struture and append to itab
append wa_unitsofmeasure to it_unitsofmeasure.
ld_clientdatax = 'Check type of data required'.

"populate fields of struture and append to itab
append wa_unitsofmeasurex to it_unitsofmeasurex.
ld_plantdata = 'Check type of data required'.

"populate fields of struture and append to itab
append wa_internationalartnos to it_internationalartnos.
ld_plantdatax = 'Check type of data required'.

"populate fields of struture and append to itab
append wa_materiallongtext to it_materiallongtext.
ld_forecastparameters = 'Check type of data required'.

"populate fields of struture and append to itab
append wa_taxclassifications to it_taxclassifications.
ld_forecastparametersx = 'Check type of data required'.

"populate fields of struture and append to itab
append wa_returnmessages to it_returnmessages.
ld_planningdata = 'Check type of data required'.

"populate fields of struture and append to itab
append wa_prtdata to it_prtdata.
ld_planningdatax = 'Check type of data required'.

"populate fields of struture and append to itab
append wa_prtdatax to it_prtdatax.
ld_storagelocationdata = 'Check type of data required'.

"populate fields of struture and append to itab
append wa_extensionin to it_extensionin.

"populate fields of struture and append to itab
append wa_extensioninx to it_extensioninx.
ld_storagelocationdatax = 'Check type of data required'.
ld_valuationdata = 'Check type of data required'.
ld_valuationdatax = 'Check type of data required'.
ld_warehousenumberdata = 'Check type of data required'.
ld_warehousenumberdatax = 'Check type of data required'.
ld_salesdata = 'Check type of data required'.
ld_salesdatax = 'Check type of data required'.
ld_storagetypedata = 'Check type of data required'.
ld_storagetypedatax = 'Check type of data required'.

ld_flag_online. = 'some text here'

ld_flag_cad_call. = 'some text here'

ld_no_dequeue. = 'some text here'

ld_no_rollback_work. = 'some text here'.

SAP Documentation for FM BAPI_MATERIAL_SAVEDATA


You use this method to create new material master data or to change existing material master data. The data on a material can be ...See here for full SAP fm documentation