Inventory Management
MM / P2Padvanced

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

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.

Explanation

📌 KEY POINTS
✅ In 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 be checked for performance and changes.

✅ Reconcile stock values with G/L regularly (e.g. MB5L list of stock values, MB5B stock on posting date).

✅ Troubleshooting inconsistencies starts with document analysis, not direct table fixes.

⚠️ Writing directly to inventory tables in custom code is not allowed in S/4HANA's model.

━━━━━━━━━━━━━━━━━━━━
▶ WHERE WE ARE

Part 4 covered transfers. Now S/4HANA data and reconciliation.

━━━━━━━━━━━━━━━━━━━━
▶ 1. DATA MODEL

  • MATDOC as single source; aggregates calculated on the fly.

━━━━━━━━━━━━━━━━━━━━
▶ 2. CUSTOM CODE

  • Compatibility views; adapt writes and performance-critical reads.

━━━━━━━━━━━━━━━━━━━━
▶ 3. RECONCILIATION

  • Stock value (MB5L) vs G/L inventory accounts; MB5B historic stock.

━━━━━━━━━━━━━━━━━━━━
▶ 4. PERIOD-END

  • MMPV, GR/IR, stock in transfer, negative stock checks.

━━━━━━━━━━━━━━━━━━━━
▶ 5. TROUBLESHOOTING

  • Analyse documents (MB51), reversals, missing FI docs; SAP notes/tools for inconsistencies.

━━━━━━━━━━━━━━━━━━━━
▶ STEP BY STEP

  1. Run MB5L for a company code.
  2. Compare with G/L balances.
  3. Investigate differences by document.

✅ CHECKPOINT: stock values reconcile with G/L each period.

Code example

ABAP Code
===== STEP 1: data model =====MATDOC (material document items) | compatibility views for MKPF/MSEG/MARD etc. (NSDM_V_*) ===== STEP 2: reconciliation =====MB5L stock values vs G/L | MB5B stock on posting date | FAGLB03 balances ===== STEP 3: period-end checklist =====MMPV period opened | GR/IR reviewed | stock in transfer cleared | negative stock resolved

Real project scenario

A custom ECC report reading material aggregates slowed dramatically after conversion because it read compatibility views in loops. Rewriting it to use MATDOC-based CDS views restored performance.

Common mistakes

  • Assuming old tables are physical.
  • Direct table updates.
  • No stock/G/L reconciliation.
  • Ignoring custom code performance.
  • Skipping period-end checks.

Best practices

  • Use MATDOC/CDS views.
  • Check custom code with ATC.
  • Reconcile monthly.
  • Use a period-end checklist.
  • Analyse by document.

Interview angle

Questions: "What changed in S/4HANA inventory management?", "How do you reconcile stock with G/L?", "What happens to custom code on MSEG?"
Strong answer: MATDOC and compatibility views, custom code impact, MB5L/MB5B reconciliation, period-end, troubleshooting approach.

Practice this lesson

Quick check

1. How do you reconcile inventory values with the G/L at period-end?

2. After conversion, a custom report reading stock aggregate tables is very slow. What is the likely reason and fix?

3. In S/4HANA, where are material document items stored?

Interview questions

1. After S/4HANA conversion, inventory reports are slow and finance questions stock values. How do you handle inventory data and reconciliation?

Answer it in your own words first, then compare.

2. During cutover, stock migration for a plant integrated with PP (with active production orders) shows discrepancies between migrated stock quantities and legacy inventory once the first post-go-live goods movements occur. As the lead consultant, what would you investigate?

Answer it in your own words first, then compare.

Practice more with Interview AI →

Reference-verified: the steps are checked against official SAP documentation and tutorials, and object and field names in the sample code are checked for consistency. The code has not been compiled or run on an SAP system by ERPClimb. Syntax marked release-dependent varies by SAP release, so check it in your own system.

More lessons in this topic

Interview questions on this topic

Related SAP topics