MATDOC table — MATDOC Material Document Table in S/4HANA
MATDOC is the S/4HANA table that stores material document header and item data together, replacing the separate MKPF and MSEG tables of the classic data model. MSEG and MKPF still exist as compatibility views built on MATDOC, so old reports keep working, but the physical data for every goods movement now lives in this one wide table.
MATDOC is the consolidated material document table introduced with the S/4HANA simplification of inventory management, merging what used to be split across MKPF and MSEG. This page covers its structure, the joins used to reconcile stock, and the mistakes consultants make when they treat it as a drop-in replacement for MSEG.
Published 15 Sept 2026· 1,160 words
What it stores
One row in MATDOC represents one item of one material document, carrying both the header attributes that used to sit in MKPF (posting date, document date, entry user, entry timestamp) and the item attributes that used to sit in MSEG (material, plant, storage location, movement type, quantity, value). It is the single source of truth for every goods movement posted through goods receipt, goods issue, transfer posting, or physical inventory adjustment. Because it was built for the merged finance and material ledger data model, it also carries parallel currency and quantity fields that MSEG never had, so a document that touches multiple valuation views or ledgers can populate several extension columns for the same movement.
Key fields
- MANDT - client
- MBLNR - material document number
- MJAHR - material document year, part of the key together with MBLNR
- ZEILE - item number within the document
- BWART - movement type, controls how the posting is interpreted
- MATNR - material number
- WERKS - plant
- LGORT - storage location
- CHARG - batch number, if the material is batch managed
- MENGE - quantity posted, in the unit given by MEINS
- MEINS - unit of measure for MENGE
- SHKZG - debit or credit indicator, controls the sign of the stock movement
- DMBTR - amount in local currency
- WAERS - currency key
- BUDAT - posting date
- BLDAT - document date
- EBELN and EBELP - purchase order number and item, populated for PO-referenced movements
- KDAUF and KDPOS - sales order number and item, populated for sales order stock movements
How it joins the data model
- MATDOC-MATNR = MARA-MATNR for material master text and basic data
- MATDOC-MATNR/WERKS = MARC-MATNR/WERKS for plant-specific material data
- MATDOC-MATNR/WERKS/LGORT = MARD-MATNR/WERKS/LGORT for storage location stock
- MATDOC-EBELN/EBELP = EKPO-EBELN/EBELP for the purchase order line the movement was posted against
- MATDOC-MATNR/WERKS joins to MBEW-MATNR/BWKEY for valuation and moving average or standard price
- MSEG and MKPF are compatibility views keyed the same way as MATDOC on MBLNR/MJAHR/ZEILE, so any old join written against MSEG still resolves against MATDOC underneath
How to read it safely
Always restrict on MANDT implicitly and never select the whole table without a plant, material, or date range. MATDOC is one of the largest tables in an S/4HANA system because every goods movement of every company posts a row here, so a query without WERKS or a BUDAT range will scan far more than intended even with HANA underneath. The most selective single restriction is MBLNR plus MJAHR when a specific document is known. For a period or material analysis, restrict on MATNR, WERKS, and a BUDAT range before adding movement type filters. Do not assume the extension fields for parallel currency and quantity are always populated, since data migrated from a classic system before conversion may leave some of them blank.
How to prove it in the data
Symptom: stock for a material in a plant changed unexpectedly on a given day. Select MATDOC with MATNR equal to the material, WERKS equal to the plant, and BUDAT equal to the date in question. Read BWART to identify the movement type, MENGE and SHKZG together to get the signed quantity delta, and EBELN/EBELP if the row should be tied to a purchase order. If several rows appear under the same MBLNR and MJAHR, the document had multiple items, often from batch split or account assignment split, and each must be summed separately before comparing to the stock overview.
ECC vs S/4HANA
MATDOC was introduced as part of the S/4HANA simplification of inventory management and material ledger, replacing the physical storage of MKPF and MSEG with one wide table. MSEG and MKPF remain available as compatibility views built on top of MATDOC, so existing custom reports and interfaces that read them continue to function without change. New fields, particularly the parallel currency and additional valuation quantity columns needed for the merged material ledger, exist only in MATDOC and are not exposed through the classic views, so any development that needs that data has to query MATDOC or a released CDS view directly rather than MSEG.
Common pitfalls
- Treating MATDOC as a one-for-one replacement for MSEG in custom ABAP: field lists and internal structure differ, and code that does SELECT * against MATDOC directly can pull in extension fields that break existing internal table definitions. Reading through the MSEG compatibility view is safer for legacy logic.
- Assuming quantity sign is implied by movement type alone. It is SHKZG, not BWART, that determines debit or credit, and two documents with the same movement type can carry opposite signs depending on the transaction that generated them.
- Ignoring that a single document can post to multiple currency and valuation fields simultaneously because of the merged material ledger model, so summing only DMBTR can miss a group currency or profit center valuation difference that only shows up in a parallel amount field.
- Trying to insert or update MATDOC directly, or worse, MSEG directly, from a custom program. MSEG is now a view and any direct write attempt will fail or, if it somehow succeeds against MATDOC, will bypass the account determination and material ledger logic that the standard posting function module enforces.
- Counting distinct MBLNR values and assuming that equals the number of stock movements. Batch splits, valuation type splits, and account assignment splits all create multiple ZEILE entries under one document number, so the correct movement count is at item level.
- Selecting by MBLNR without MJAHR. Document numbers are reused across fiscal years by number range, so omitting the year returns the wrong document or an incomplete result set.
Whose problem this is
The MM or inventory management functional consultant owns questions about whether a movement type, quantity, or valuation on a given document is correct. Custom code that queries MATDOC directly, or that breaks because it assumed MSEG structure, is a technical or Basis-adjacent problem for the ABAP team. During an S/4HANA conversion, the migration or data validation workstream owns reconciling that stock quantities and values carried over correctly from the old MSEG-based data into MATDOC.
Related SAP objects
Reviewed pages this object connects to in the ERPClimb knowledge graph.
Source: ERPClimb — https://erpclimb.com/sap-tables/matdocERPClimb is an independent platform and is not affiliated with SAP SE. Reference pages are written and reviewed by SAP consultants for learning and troubleshooting.