Now accepting guest editorial from SAP, Oracle, Workday and ServiceNow practitioners.Pitch a guide
The Sign-Off Table

Lesson 5 of 6

Data model note: one table for material documents

11 min

Listen to this lesson

0:00 / 7:40

Business users can skip table names most of the time, but one inventory change in SAP S/4HANA explains a lot of behavior and a lot of conversion work: material documents are now stored in a single table, MATDOC, and stock quantities are calculated from it.

Before and after

TopicSAP ECCSAP S/4HANA
Material document headerMKPFMATDOC (header and item data together)
Material document itemsMSEGMATDOC
Stock quantitiesStored totals in aggregate tables (per plant, storage location, batch, special stock)Calculated from MATDOC on the fly
Reading old tablesDirectThrough compatibility views that return the same structure
Goods movement transactionsMIGO plus MB1A, MB1B, MB1C and othersMIGO and Fiori apps; the old MB posting transactions are replaced by MIGO
How inventory data is stored before and after the move to SAP S/4HANA.
The Sign-Off Table · thesignofftable.com/academy/sap-mm-203

In ECC every goods movement wrote a header row, item rows, and then updated stock totals in several aggregate tables. Those updates were a bottleneck for high-volume postings because each total row had to be locked. In SAP S/4HANA a goods movement inserts rows into MATDOC, and stock is derived from the material documents when someone asks for it. SAP positions this as simpler and faster for posting.

Why posting got lighter: ECC locked and updated totals rows on every movement, S/4HANA only inserts material document rows.
The Sign-Off Table · thesignofftable.com/academy/sap-mm-203
Apps and reportsMMBE, Stock - Single Material, MB52, custom reports
Compatibility viewsPresent the old table structures for reading
CDS viewsCalculate stock from material documents
MATDOCOne row per material document item, with header data
How stock figures are produced in SAP S/4HANA.
The Sign-Off Table · thesignofftable.com/academy/sap-mm-203

Two technical details are worth knowing when developers or data teams ask. First, the compatibility views have names of their own: reads of MSEG are redirected to a CDS view whose DDL source is NSDM_DDL_MSEG, and the old stock aggregates such as MARD are served the same way (for example NSDM_V_MARD). Second, to keep stock queries fast, SAP S/4HANA keeps a compact extract table, MATDOC_EXTRACT, that the stock CDS views read instead of scanning every material document. SAP documents the change in the simplification item for inventory management data model changes (SAP Note 2206980); read it for your release before a conversion.

What this means for custom reports and programs

Because compatibility views exist, many custom reports that read MKPF, MSEG or stock aggregate tables keep working. Three kinds of custom code need attention:

  • Programs that write directly to stock or material document tables. They must be redesigned to use standard posting functions.
  • Programs that read large volumes through compatibility views in loops, which can be slow; they may need to read MATDOC or CDS views directly.
  • Programs that depend on specific aggregate tables or fields that no longer behave the same way.
Triage for each custom stock program found in the code check.
The Sign-Off Table · thesignofftable.com/academy/sap-mm-203

During conversion, historical material documents are migrated into MATDOC, so the material document history is still there after go-live. That migration is part of the technical conversion and its runtime is significant for companies with many years of movements. Archiving old material documents before conversion can shorten it.

  1. Before conversionCustom code checkFind code reading or writing MKPF, MSEG and stock aggregate tables
  2. Before conversionArchivingArchive old material documents to reduce migration volume
  3. ConversionData migrationMKPF/MSEG history moved into MATDOC
  4. After conversionReconciliationStock quantities and values compared with pre-conversion figures
Where the MATDOC change shows up in a conversion project.
The Sign-Off Table · thesignofftable.com/academy/sap-mm-203

Obsolete MB transactions and what replaces them

ECC transactionPurposeUse in SAP S/4HANA
MB01, MB0AGoods receipt for a POMIGO (A01, reference Purchase Order) or Post Goods Receipt for Purchasing Document
MB1AGoods issueMIGO (A07 Goods Issue), for example movement type 201 or 261
MB1BTransfer postingMIGO (A08 Transfer Posting) or Transfer Stock - In-Plant / Cross-Plant
MB1COther goods receiptsMIGO (A01, reference Other), for example 501 or 561
MB11Goods movement (general)MIGO
MB31Goods receipt for a production orderMIGO (reference Order) or the confirmation
MB51, MB52, MB5B, MMBEReportsStill available; Fiori apps sit alongside them

The MB posting transactions are replaced by MIGO (SAP Note 1804812). Reports such as MB51 and MB5B remain.

Clean core adds a forward-looking rule for Kenji's team: new extensions should read inventory through SAP's released CDS views and APIs (in ABAP Development Tools, check a view's API state before you build on it), not through MATDOC or the compatibility views directly. A Z report that selects from MSEG may still run after the conversion, but it is the kind of object the custom code cleanup should retire or rebuild.

What would you do?

A developer says Contoso's custom stock report must be rewritten because "MSEG doesn't exist anymore in S/4HANA." Is that accurate?

For day-to-day users little changes: MIGO, MMBE and the Fiori stock apps work as before, and material document numbers keep their format. The difference shows in conversion work and in technical reports. If your team owns custom stock reports, interfaces that read goods movements or extracts to a data warehouse, list them now and ask for each: does it only read, how much data does it read, and has its output been compared after conversion?

Key points
  • Material documents are stored in MATDOC; MKPF and MSEG are replaced.
  • Stock quantities are calculated from material documents, not stored in aggregate tables.
  • Compatibility views keep many reads working; direct writes must be redesigned.
  • Reconcile stock quantities, values and custom reports across the conversion.
  • The MB posting transactions are obsolete: post with MIGO or the Fiori apps.

Check your understanding · not graded

Lesson check

  1. 1. Which table stores material documents in SAP S/4HANA?

  2. 2. How are stock quantities determined in SAP S/4HANA?

  3. 3. Which custom code needs the most urgent redesign?

  4. 4. What happens to historical material documents at conversion?