SAP BAPI_MATERIAL_SAVEDATA Function Module for Create and Change Material Master Data
BAPI_MATERIAL_SAVEDATA is a standard bapi material savedata SAP function module available within SAP R/3 or S/4 Hana systems, depending on your version and release level. It is used for Create and Change Material Master Data processing and below is the pattern details for this FM, showing its interface including any import and export parameters, exceptions etc. there is also a full "cut and paste" ABAP pattern code example, along with implementation ABAP coding, documentation and contribution comments specific to this or related objects.
See here to view full function module documentation and code listing for bapi material savedata FM, simply by entering the name BAPI_MATERIAL_SAVEDATA into the relevant SAP transaction such as SE37 or SE38.
Function Group: 1001UEB
Program Name: SAPL1001UEB
Main Program: SAPL1001UEB
Appliation area: M
Release date: 16-Jan-2006
Mode(Normal, Remote etc): Remote-Enabled
Update:
Function BAPI_MATERIAL_SAVEDATA pattern details
In-order to call this FM within your sap programs, simply using the below ABAP pattern details to trigger the function call...or see the full ABAP code listing at the end of this article. You can simply cut and paste this code into your ABAP progrom as it is, including variable declarations.CALL FUNCTION 'BAPI_MATERIAL_SAVEDATA'"Create and Change Material Master Data.
EXPORTING
HEADDATA = "Header segment with control information
* STORAGELOCATIONDATA = "Storage-location-specific material data
* STORAGELOCATIONDATAX = "Information on update for STORAGELOCATIONDATA
* VALUATIONDATA = "Valuation data
* VALUATIONDATAX = "Information on update for VALUATIONDATA
* WAREHOUSENUMBERDATA = "Warehouse-number-specific material data
* WAREHOUSENUMBERDATAX = "Information on update for WAREHOUSEDATA
* SALESDATA = "Sales data
* SALESDATAX = "Information on update for SALESDATA
* STORAGETYPEDATA = "Storage-type-specific material data
* STORAGETYPEDATAX = "Information on update for STORAGETYPEDATA
* CLIENTDATA = "Client-specific material data
* FLAG_ONLINE = ' ' "No ALE Field Selection
* FLAG_CAD_CALL = ' ' "Call From CAD System
* NO_DEQUEUE = ' ' "Screens, display user entry
* NO_ROLLBACK_WORK = ' ' "Override rollback if error occurs
* CLIENTDATAX = "Information on update for CLIENTDATA
* PLANTDATA = "Plant-specific material data
* PLANTDATAX = "Information on update for PLANTDATA
* FORECASTPARAMETERS = "Forecast Parameters
* FORECASTPARAMETERSX = "Information on update for FORECASTDATA
* PLANNINGDATA = "Planning data
* PLANNINGDATAX = "Information on update for PLANNINGDATA
IMPORTING
RETURN = "Return parameters
TABLES
* MATERIALDESCRIPTION = "Material descriptions
* EXTENSIONIN = "Reference Structure for BAPI Parameters EXTENSIONIN/EXTENSIONOUT
* EXTENSIONINX = "Reference Structure for BAPI Parameters EXTENSIONIN/EXTENSIONOUT
* UNITSOFMEASURE = "Units of measure
* UNITSOFMEASUREX = "Information on update for UNITSOFMEASURE
* INTERNATIONALARTNOS = "International Article Numbers (EANs)
* MATERIALLONGTEXT = "Long texts
* TAXCLASSIFICATIONS = "Tax classifications
* RETURNMESSAGES = "All messages
* PRTDATA = "Production resource/tool (PRT) fields in the material master
* PRTDATAX = "Information on update for PRTDATAX
IMPORTING Parameters details for BAPI_MATERIAL_SAVEDATA
HEADDATA - Header segment with control information
Data type: BAPIMATHEADOptional: No
Call by Reference: No ( called with pass by value option)
STORAGELOCATIONDATA - Storage-location-specific material data
Data type: BAPI_MARDOptional: Yes
Call by Reference: No ( called with pass by value option)
STORAGELOCATIONDATAX - Information on update for STORAGELOCATIONDATA
Data type: BAPI_MARDXOptional: Yes
Call by Reference: No ( called with pass by value option)
VALUATIONDATA - Valuation data
Data type: BAPI_MBEWOptional: Yes
Call by Reference: No ( called with pass by value option)
VALUATIONDATAX - Information on update for VALUATIONDATA
Data type: BAPI_MBEWXOptional: Yes
Call by Reference: No ( called with pass by value option)
WAREHOUSENUMBERDATA - Warehouse-number-specific material data
Data type: BAPI_MLGNOptional: Yes
Call by Reference: No ( called with pass by value option)
WAREHOUSENUMBERDATAX - Information on update for WAREHOUSEDATA
Data type: BAPI_MLGNXOptional: Yes
Call by Reference: No ( called with pass by value option)
SALESDATA - Sales data
Data type: BAPI_MVKEOptional: Yes
Call by Reference: No ( called with pass by value option)
SALESDATAX - Information on update for SALESDATA
Data type: BAPI_MVKEXOptional: Yes
Call by Reference: No ( called with pass by value option)
STORAGETYPEDATA - Storage-type-specific material data
Data type: BAPI_MLGTOptional: Yes
Call by Reference: No ( called with pass by value option)
STORAGETYPEDATAX - Information on update for STORAGETYPEDATA
Data type: BAPI_MLGTXOptional: Yes
Call by Reference: No ( called with pass by value option)
CLIENTDATA - Client-specific material data
Data type: BAPI_MARAOptional: Yes
Call by Reference: No ( called with pass by value option)
FLAG_ONLINE - No ALE Field Selection
Data type: BAPIE1GLOBAL_DATA-TESTRUNDefault: SPACE
Optional: Yes
Call by Reference: No ( called with pass by value option)
FLAG_CAD_CALL - Call From CAD System
Data type: BAPIE1GLOBAL_DATA-TESTRUNDefault: SPACE
Optional: Yes
Call by Reference: No ( called with pass by value option)
NO_DEQUEUE - Screens, display user entry
Data type: BAPIE1GLOBAL_DATA-TESTRUNDefault: SPACE
Optional: Yes
Call by Reference: No ( called with pass by value option)
NO_ROLLBACK_WORK - Override rollback if error occurs
Data type: BAPIE1GLOBAL_DATA-TESTRUNDefault: SPACE
Optional: Yes
Call by Reference: No ( called with pass by value option)
CLIENTDATAX - Information on update for CLIENTDATA
Data type: BAPI_MARAXOptional: Yes
Call by Reference: No ( called with pass by value option)
PLANTDATA - Plant-specific material data
Data type: BAPI_MARCOptional: Yes
Call by Reference: No ( called with pass by value option)
PLANTDATAX - Information on update for PLANTDATA
Data type: BAPI_MARCXOptional: Yes
Call by Reference: No ( called with pass by value option)
FORECASTPARAMETERS - Forecast Parameters
Data type: BAPI_MPOPOptional: Yes
Call by Reference: No ( called with pass by value option)
FORECASTPARAMETERSX - Information on update for FORECASTDATA
Data type: BAPI_MPOPXOptional: Yes
Call by Reference: No ( called with pass by value option)
PLANNINGDATA - Planning data
Data type: BAPI_MPGDOptional: Yes
Call by Reference: No ( called with pass by value option)
PLANNINGDATAX - Information on update for PLANNINGDATA
Data type: BAPI_MPGDXOptional: Yes
Call by Reference: No ( called with pass by value option)
EXPORTING Parameters details for BAPI_MATERIAL_SAVEDATA
RETURN - Return parameters
Data type: BAPIRET2Optional: No
Call by Reference: No ( called with pass by value option)
TABLES Parameters details for BAPI_MATERIAL_SAVEDATA
MATERIALDESCRIPTION - Material descriptions
Data type: BAPI_MAKTOptional: Yes
Call by Reference: No ( called with pass by value option)
EXTENSIONIN - Reference Structure for BAPI Parameters EXTENSIONIN/EXTENSIONOUT
Data type: BAPIPAREXOptional: Yes
Call by Reference: No ( called with pass by value option)
EXTENSIONINX - Reference Structure for BAPI Parameters EXTENSIONIN/EXTENSIONOUT
Data type: BAPIPAREXXOptional: Yes
Call by Reference: Yes
UNITSOFMEASURE - Units of measure
Data type: BAPI_MARMOptional: Yes
Call by Reference: No ( called with pass by value option)
UNITSOFMEASUREX - Information on update for UNITSOFMEASURE
Data type: BAPI_MARMXOptional: Yes
Call by Reference: No ( called with pass by value option)
INTERNATIONALARTNOS - International Article Numbers (EANs)
Data type: BAPI_MEANOptional: Yes
Call by Reference: No ( called with pass by value option)
MATERIALLONGTEXT - Long texts
Data type: BAPI_MLTXOptional: Yes
Call by Reference: No ( called with pass by value option)
TAXCLASSIFICATIONS - Tax classifications
Data type: BAPI_MLANOptional: Yes
Call by Reference: No ( called with pass by value option)
RETURNMESSAGES - All messages
Data type: BAPI_MATRETURN2Optional: Yes
Call by Reference: Yes
PRTDATA - Production resource/tool (PRT) fields in the material master
Data type: BAPI_MFHMOptional: Yes
Call by Reference: No ( called with pass by value option)
PRTDATAX - Information on update for PRTDATAX
Data type: BAPI_MFHMXOptional: Yes
Call by Reference: No ( called with pass by value option)
Copy and paste ABAP code example for BAPI_MATERIAL_SAVEDATA Function Module
The ABAP code below is a full code listing to execute function module POPUP_TO_CONFIRM including all data declarations. The code uses the original data declarations rather than the latest in-line data DECLARATION SYNTAX but I have included an ABAP code snippet at the end to show how declarations would look using the newer method of declaring data variables on the fly. 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), which i why i have stuck to the origianl for this example.DATA: | ||||
lv_return | TYPE BAPIRET2, " | |||
lv_headdata | TYPE BAPIMATHEAD, " | |||
lt_materialdescription | TYPE STANDARD TABLE OF BAPI_MAKT, " | |||
lt_extensionin | TYPE STANDARD TABLE OF BAPIPAREX, " | |||
lv_storagelocationdata | TYPE BAPI_MARD, " | |||
lt_extensioninx | TYPE STANDARD TABLE OF BAPIPAREXX, " | |||
lv_storagelocationdatax | TYPE BAPI_MARDX, " | |||
lv_valuationdata | TYPE BAPI_MBEW, " | |||
lv_valuationdatax | TYPE BAPI_MBEWX, " | |||
lv_warehousenumberdata | TYPE BAPI_MLGN, " | |||
lv_warehousenumberdatax | TYPE BAPI_MLGNX, " | |||
lv_salesdata | TYPE BAPI_MVKE, " | |||
lv_salesdatax | TYPE BAPI_MVKEX, " | |||
lv_storagetypedata | TYPE BAPI_MLGT, " | |||
lv_storagetypedatax | TYPE BAPI_MLGTX, " | |||
lv_clientdata | TYPE BAPI_MARA, " | |||
lt_unitsofmeasure | TYPE STANDARD TABLE OF BAPI_MARM, " | |||
lv_flag_online | TYPE BAPIE1GLOBAL_DATA-TESTRUN, " SPACE | |||
lv_flag_cad_call | TYPE BAPIE1GLOBAL_DATA-TESTRUN, " SPACE | |||
lv_no_dequeue | TYPE BAPIE1GLOBAL_DATA-TESTRUN, " SPACE | |||
lv_no_rollback_work | TYPE BAPIE1GLOBAL_DATA-TESTRUN, " SPACE | |||
lv_clientdatax | TYPE BAPI_MARAX, " | |||
lt_unitsofmeasurex | TYPE STANDARD TABLE OF BAPI_MARMX, " | |||
lv_plantdata | TYPE BAPI_MARC, " | |||
lt_internationalartnos | TYPE STANDARD TABLE OF BAPI_MEAN, " | |||
lv_plantdatax | TYPE BAPI_MARCX, " | |||
lt_materiallongtext | TYPE STANDARD TABLE OF BAPI_MLTX, " | |||
lv_forecastparameters | TYPE BAPI_MPOP, " | |||
lt_taxclassifications | TYPE STANDARD TABLE OF BAPI_MLAN, " | |||
lt_returnmessages | TYPE STANDARD TABLE OF BAPI_MATRETURN2, " | |||
lv_forecastparametersx | TYPE BAPI_MPOPX, " | |||
lt_prtdata | TYPE STANDARD TABLE OF BAPI_MFHM, " | |||
lv_planningdata | TYPE BAPI_MPGD, " | |||
lt_prtdatax | TYPE STANDARD TABLE OF BAPI_MFHMX, " | |||
lv_planningdatax | TYPE BAPI_MPGDX. " |
  CALL FUNCTION 'BAPI_MATERIAL_SAVEDATA' "Create and Change Material Master Data |
EXPORTING | ||
HEADDATA | = lv_headdata | |
STORAGELOCATIONDATA | = lv_storagelocationdata | |
STORAGELOCATIONDATAX | = lv_storagelocationdatax | |
VALUATIONDATA | = lv_valuationdata | |
VALUATIONDATAX | = lv_valuationdatax | |
WAREHOUSENUMBERDATA | = lv_warehousenumberdata | |
WAREHOUSENUMBERDATAX | = lv_warehousenumberdatax | |
SALESDATA | = lv_salesdata | |
SALESDATAX | = lv_salesdatax | |
STORAGETYPEDATA | = lv_storagetypedata | |
STORAGETYPEDATAX | = lv_storagetypedatax | |
CLIENTDATA | = lv_clientdata | |
FLAG_ONLINE | = lv_flag_online | |
FLAG_CAD_CALL | = lv_flag_cad_call | |
NO_DEQUEUE | = lv_no_dequeue | |
NO_ROLLBACK_WORK | = lv_no_rollback_work | |
CLIENTDATAX | = lv_clientdatax | |
PLANTDATA | = lv_plantdata | |
PLANTDATAX | = lv_plantdatax | |
FORECASTPARAMETERS | = lv_forecastparameters | |
FORECASTPARAMETERSX | = lv_forecastparametersx | |
PLANNINGDATA | = lv_planningdata | |
PLANNINGDATAX | = lv_planningdatax | |
IMPORTING | ||
RETURN | = lv_return | |
TABLES | ||
MATERIALDESCRIPTION | = lt_materialdescription | |
EXTENSIONIN | = lt_extensionin | |
EXTENSIONINX | = lt_extensioninx | |
UNITSOFMEASURE | = lt_unitsofmeasure | |
UNITSOFMEASUREX | = lt_unitsofmeasurex | |
INTERNATIONALARTNOS | = lt_internationalartnos | |
MATERIALLONGTEXT | = lt_materiallongtext | |
TAXCLASSIFICATIONS | = lt_taxclassifications | |
RETURNMESSAGES | = lt_returnmessages | |
PRTDATA | = lt_prtdata | |
PRTDATAX | = lt_prtdatax | |
. " BAPI_MATERIAL_SAVEDATA |
ABAP code using 7.40 inline data declarations to call FM BAPI_MATERIAL_SAVEDATA
The below ABAP code uses the newer in-line data declarations. This allows you to see the coding differences/benefits of the later inline syntax. Please note some of the newer syntax below, such as the @DATA is not available until 4.70 EHP 8."SELECT single TESTRUN FROM BAPIE1GLOBAL_DATA INTO @DATA(ld_flag_online). | ||||
DATA(ld_flag_online) | = ' '. | |||
"SELECT single TESTRUN FROM BAPIE1GLOBAL_DATA INTO @DATA(ld_flag_cad_call). | ||||
DATA(ld_flag_cad_call) | = ' '. | |||
"SELECT single TESTRUN FROM BAPIE1GLOBAL_DATA INTO @DATA(ld_no_dequeue). | ||||
DATA(ld_no_dequeue) | = ' '. | |||
"SELECT single TESTRUN FROM BAPIE1GLOBAL_DATA INTO @DATA(ld_no_rollback_work). | ||||
DATA(ld_no_rollback_work) | = ' '. | |||
Search for further information about these or an SAP related objects