SAP BAPIObjectBAPI_MATERIAL_SAVEDATAModuleMM_P2P

BAPI_MATERIAL_SAVEDATA — Create or change a material master record

BAPI_MATERIAL_SAVEDATA creates or changes a material master record, mirroring what MM01 and MM02 do on screen. It accepts a set of view-specific structures (basic data, plant, storage location, valuation, sales) plus matching X-structures that flag which fields are actually being written, and reports outcome messages in a RETURN table rather than raising an exception.

This page covers what BAPI_MATERIAL_SAVEDATA does to the material master, its parameter structures and their X-counterparts, why commit handling trips up so many first implementations, and how sloppy RETURN table checks cause materials to look created when they were not. It also flags where the BAPI's limits push work onto sibling calls for long text and classification.

Published 16 Sept 2026· 1,005 words

What it does

BAPI_MATERIAL_SAVEDATA acts on the material master object spanning MARA, MARC, MARD, MBEW, MVKE and related view tables, and it mirrors the functionality of MM01 for creation and MM02 for change. A single call can create a material header plus any combination of plant, storage location, valuation, sales, and MRP views in one shot, or extend an existing material into a new plant or sales area. It does not create everything a full material record needs on its own: long texts, classification data, and warehouse management view details are handled by separate calls. In practice this BAPI is the workhorse for mass material creation, plant extension, and interface-driven master data loads from legacy systems or during data migration.

Important parameters

  • HEADDATA - material number (blank for internal number assignment), industry sector, material type, and the function indicators that tell the BAPI which views are being maintained in this call
  • CLIENTDATA / CLIENTDATAX - client-level basic data fields (MARA) and the matching flag structure marking which of those fields are actually supplied
  • PLANTDATA / PLANTDATAX - plant-level data (MARC) such as MRP and procurement settings, with its own flag structure
  • STORAGELOCATIONDATA / STORAGELOCATIONDATAX - storage location data (MARD)
  • VALUATIONDATA / VALUATIONDATAX - valuation and accounting data (MBEW)
  • SALESDATA / SALESDATAX - sales organization data (MVKE)
  • FORECASTPARAMETERS, PLANNINGDATA - forecast and MRP planning view fields
  • UNITSOFMEASURE / UNITSOFMEASUREX - table of additional units of measure and conversion factors
  • MATERIALDESCRIPTION - table of material short texts by language
  • TAXCLASSIFICATIONS - table of tax classification indicators by country/departure country
  • RETURN - table of messages describing the outcome, including generated material number for internal assignment cases

Commit behaviour

BAPI_MATERIAL_SAVEDATA does not commit its own work. It builds the change inside the current SAP LUW and expects the caller to issue BAPI_TRANSACTION_COMMIT explicitly afterward. If the caller forgets, the material data sits uncommitted and gets rolled back at the end of the session or program, so the BAPI reports success, the RETURN table looks clean, but nothing persists in the database. This is the single most common reason a custom load program 'works' in testing with a following commit step in the same transaction but fails silently in a batch job where the commit call was left out or placed inside a loop incorrectly, committing too early and locking subsequent calls, or too late and losing the whole batch on error.

Return handling

RETURN is a table, not a single structure, and that is where most interface bugs originate. A call can return several messages at once: a warning about a defaulted unit of measure, an informational message with the generated material number, and an actual error, all in the same table. Code that only inspects RETURN[1] or checks for a non-initial NUMBER field will treat a table full of warnings as success, or worse, miss an error buried after a few informational lines. The correct pattern loops through the full table and tests TYPE for E or A; anything else, including multiple S and W lines, is not a failure by itself. The generated material number for internal number assignment is not returned as a dedicated export parameter — it has to be parsed out of the message text or message variables in RETURN, which is a frequent source of fragile parsing logic when the message text format is assumed rather than checked field by field.

ECC vs S/4HANA

BAPI_MATERIAL_SAVEDATA still works on S/4HANA and remains in active use for custom load programs and legacy interfaces. For newer integration scenarios SAP has published an OData-based material master API intended to replace direct BAPI calls in Fiori and cloud-integration contexts, but it has not fully displaced this BAPI for on-premise batch loads and migration tooling, where it is still the standard choice. Existing interfaces built on it do not need to be rewritten purely because of the S/4HANA move.

Common pitfalls

  • X-structure field left blank when the value field is populated, so the field is silently ignored instead of written, and the resulting material looks half-configured with no error raised
  • Plant extension attempted before the plant itself exists in configuration, producing an error buried mid-table in RETURN that gets missed by shallow return checks
  • Missing BAPI_TRANSACTION_COMMIT after a batch of calls, so a mass load appears to succeed in the log but no records exist afterward
  • Assuming long text or classification data is created by this BAPI when it requires a separate call, leaving materials created without descriptions or class assignments that downstream processes expect
  • Calling repeatedly in a tight loop without managing locks, causing intermittent lock errors on the material master when multiple views for the same material are updated in quick succession

Whose problem this is

This sits with the developer maintaining the interface or load program, since the failure modes are almost always about which X-flags were set, whether commit was called, and how RETURN was parsed. Functional consultants need to supply the exact view combination and field values expected from the source system or spreadsheet, and confirm in the material master transaction whether the resulting record actually matches what was intended.

Related SAP objects

Reviewed pages this object connects to in the ERPClimb knowledge graph.

Source: ERPClimb — https://erpclimb.com/sap-bapis/bapi-material-savedataERPClimb is an independent platform and is not affiliated with SAP SE. Reference pages are written and reviewed by SAP consultants for learning and troubleshooting.