ERPClimb logoERPClimb
Inventory Management
MM / P2Padvanced 3 min read

MM Inventory Management Part 5: S/4HANA MATDOC, Reconciliation and Production Troubleshooting

Preview · a free account unlocks the full lesson

Key takeaway

Inventory in S/4HANA: the MATDOC table replacing MKPF/MSEG and aggregate tables, compatibility views for custom code, reconciliation of stock quantities and values with G/L, period-end checks and troubleshooting stock and value inconsistencies in production.

In this lessonShow sections

Visual overview

MM Inventory Management Part 5: S/4HANA MATDOC, Reconciliation and Production Troubleshooting — learning sheetFlow: Run MB5L for a company code → Compare with G/L balances → Investigate differences by document. Key ideas: DATA MODEL; CUSTOM CODE; RECONCILIATION; PERIOD-END. Watch out: Writing directly to inventory tables in custom code is not allowed in S/4HANA's model.ERPClimb.com / MM / LESSON 5/5 / LEARNING SHEETMM Inventory Management Part 5: S/4HANA MATDOC,Reconciliation and Production Troubleshooting1 · HOW IT FLOWS1Run MB5L for a companycode2Compare with G/L balances3Investigate differencesby document2 · KEY IDEAS EXPLAINEDData ModelMATDOC as single source; aggregates calculated onthe fly.Custom CodeCompatibility views; adapt writes andperformance-critical reads.ReconciliationStock value (MB5L) vs G/L inventory accounts; MB5Bhistoric stock.Period-EndMMPV, GR/IR, stock in transfer, negative stockchecks.3 · REMEMBER · WATCH OUTRememberIn S/4HANA, material documents are stored in MATDOC; old tables(MKPF/MSEG, stock aggregates) are served via compatibility views.Custom code reading old tables usually works via views but should bechecked for performance and changes.Reconcile stock values with G/L regularly (e.g. MB5L list of stockvalues, MB5B stock on posting date).!Watch outWriting directly to inventory tablesin custom code is not allowed inS/4HANA's model.4 · IN A REAL PROJECTA custom ECC report reading material aggregates slowed dramatically after conversion because it readcompatibility views in loops. Rewriting it to use MATDOC-based CDS views restored performance.Original ERPClimb learning sheet • Verify against your SAP release and edition

Explanation

Part 4 of this series covered stock transfers; this final part covers S/4HANA's data model, reconciliation, and troubleshooting. In S/4HANA, material documents are stored in a single table, MATDOC, with the old MKPF/MSEG tables and stock aggregate tables served through compatibility views rather than being populated directly.

Custom code that reads those old tables generally keeps working through these views, but it's still worth checking for performance impact and for any behavioral changes, and custom code must never write directly to the old inventory tables, since that bypasses S/4HANA's data model entirely.

Reconciling stock values against the general ledger should happen regularly, using MB5L for a list of current stock values and MB5B to see stock on a particular posting date, both compared against the G/L inventory accounts. Period-end activities include running the period closing program (MMPV), checking GR/IR, reviewing stock in transfer, and checking for negative stock.

When inconsistencies do show up, troubleshooting starts with analyzing the actual material documents through MB51, looking for reversals or missing FI documents, before turning to SAP notes or dedicated tools for inconsistency correction — fixing the underlying tables directly is not the way to resolve it.

Working through this means running MB5L for a company code, comparing the result against the G/L balances, and investigating any difference document by document, with the goal that stock values reconcile with the G/L every period.

Free account

Create a free account to keep reading

You have read the opening of this lesson. A free ERPClimb account unlocks the rest of it, every other lesson and topic, and your learning history, so you can pick up exactly where you stopped. No card needed.

  • Code example
  • Real project scenario
  • Common mistakes
  • Best practices
  • Interview angle

One tap with Google works too. Every topic keeps its first lesson open to everyone.

Keep exploring

Referenced SAP objects

Reviewed reference pages for the objects this page mentions.

Check before use: lesson examples are educational, not a guarantee of correctness for your SAP edition or release. Sample code has not been executed on your SAP system. Confirm API availability, syntax, authorizations and business impact in an approved development or test environment.