What happens to MKPF and MSEG when you move inventory to S/4HANA (MATDOC)?

Inventory is a quieter change than finance, but the custom code around goods movements is where conversions surprise teams.

By Chris Benson — 30 years in SAP SD5 min read

The short answer

In S/4HANA, material documents are stored in a single table, MATDOC, which replaces the ECC header and item pair MKPF and MSEG. Many persisted stock aggregates and history tables from ECC, such as the period-end stock tables, are no longer maintained as stored data and are instead derived from MATDOC at read time. SAP keeps compatibility views under the old names so many standard and custom reads continue to work. Custom code that writes directly to the old tables, or that depends on the removed aggregates, is a conversion issue, and reads that still work can behave and perform differently against a view. The practical migration task is to find the custom inventory code that touches these structures, check it against the simplification items, and regression test the goods movement processes that actually changed.

What is MATDOC, in plain terms?

Think of ECC inventory as a filing cabinet with a document folder (MKPF and MSEG) plus a set of running-balance cards kept up to date on every movement: current stock by plant, storage location, batch, vendor-owned stock, and so on. Every goods movement wrote the document and also updated the cards. S/4HANA keeps the document and treats the balance as a question you ask the document history, rather than a card you maintain.

That document history is MATDOC, a single table holding header and item data together. Because S/4HANA runs on an in-memory database, stock quantities can be calculated from the movements when needed instead of being stored and updated on every posting.

What changes for standard processes?

For users, goods receipts, issues, transfers, and physical inventory look familiar. The change is underneath: fewer table updates per posting, so less lock contention when many movements hit the same material, and stock readings that come from one source of truth. The material ledger is also part of the S/4HANA inventory valuation model, and its postings flow into the Universal Journal, which connects this topic to the finance changes in a conversion.

A related, separate change is the extended material number length of up to 40 characters, available from S/4HANA 1709 onward. It is optional to activate, but any custom code, interface, or report with a hard-coded 18-character material field needs review before anyone switches it on.

Where does the migration risk sit?

SAP supplies compatibility views so that reads of the old table names often keep working. That helps, but it is not a guarantee. The risk concentrates in three places: custom programs that insert or update the old document or aggregate tables directly, custom reports that read the retired aggregates and now run slowly or return different results, and interfaces and enhancements that assume the old document structure.

These are exactly the objects an ABAP Test Cockpit run against the simplification database is designed to find. The result is a worklist, not a verdict: some findings are a small adjustment, and some are custom inventory logic that nobody has run in years and can simply be retired.

  • Search custom code for direct reads and writes of MKPF, MSEG, and the retired stock aggregate tables.
  • Check enhancements and BAdI implementations in goods movement posting (for example MIGO-related logic) against current S/4HANA behavior.
  • Review interfaces to warehouse, shipping, and third-party systems that exchange material document data.
  • Decide whether to activate the 40-character material number now or later, and audit hard-coded field lengths first.
  • Add goods receipt, goods issue, transfer posting, and physical inventory to the regression scope.

How do you scope it without reading every program?

Start from usage. Pull execution evidence for custom inventory objects, cross it with the ATC findings, and sort the results into retire, adjust, and re-implement. Objects with no recent execution and no downstream consumer are retirement candidates, which shrinks both the remediation and the test plan. In a reference estate, a live ECC system analyzed with our tooling, that usage-first filter removed a large share of custom objects from scope; a customer's numbers come from their own system, so treat that as an illustration of the method rather than a forecast.

The same list drives the test plan. A short set of goods movement scenarios that touch changed code is far cheaper to regress than the whole logistics chain.

Frequently asked

Will our existing reports on MKPF and MSEG stop working after conversion?

Many will keep working because SAP provides compatibility views under the old names. Do not assume all of them will. Reports that read removed aggregates, or that were tuned around the old table structure, can return different results or run slower, so check them against the simplification items and regression test the ones the business uses.

Do we have to activate the 40-character material number at conversion?

No, it is a separate, optional decision available from S/4HANA 1709 onward. Many organizations convert first and activate later. The prerequisite either way is an audit of custom code, interfaces, and reports for hard-coded 18-character material fields.

Is inventory a reason to choose greenfield over brownfield?

Rarely on its own. MATDOC is handled by the conversion itself, and the exposure is mostly custom code and interfaces. If your goods movement customizations are extensive and poorly understood, that is a signal to assess them first, which informs the brownfield versus greenfield choice alongside finance, data quality, and process fit.

See your own Clean Core Score.

Run the free S/4 readiness scan in under a minute — no system access required.

Keep reading