Sub topic 16
What changed from ECC: MATDOC, Universal Journal, Business Partner
This chapter assumes you know the classic ECC purchasing flow: requisition, purchase order, goods receipt, invoice receipt and payment. It also assumes you know the basic ledger vocabulary of debit, credit and account. The aim is to show what S/4HANA changed underneath that flow, so you know which tables, transactions and master data objects to expect.
The business steps are the same. The data model that records them is not.
The three changes at a glance
| Area | ECC | S/4HANA |
|---|---|---|
| Supplier master | Vendor master (LFA1, LFB1, LFM1) maintained with XK01/MK01 | Business Partner (transaction BP) is the leading object. Vendor tables are kept in sync. |
| Material documents | Header MKPF, items MSEG, plus aggregate stock tables such as MARD and MCHB | One table, MATDOC. Stock is derived from the document items. |
| Accounting line items | FI in BSEG, CO in COEP, assets in ANEP, material ledger in its own tables | One table, ACDOCA (the Universal Journal) |
Business Partner replaces the vendor master
In ECC you created a supplier in the vendor master and used separate transactions for the accounting and purchasing views. In S/4HANA you create a Business Partner (BP). The BP is the central object for suppliers, customers and contacts. Its roles decide which views are available:
- FLVN00 (Supplier, FI) holds the company code data used by accounts payable.
- FLVN01 (Supplier) holds the purchasing organization data used by procurement.
The old vendor tables still exist, because purchasing and payment code still read them. Customer/vendor integration (CVI) writes a vendor record every time you save a BP that has a supplier role. This keeps the two models consistent.
Practical consequences for P2P:
- The vendor transactions such as XK01 and MK01 are obsolete. Use BP, or the Fiori app "Maintain Business Partner".
- Number ranges matter. SAP recommends that the BP number equals the vendor number, so that the number you see on a purchase order is the BP number.
- A supplier created without the FLVN01 role cannot be used on a purchase order, even if its FI role is complete. This is a common cause of "vendor not maintained for purchasing organization" errors after a migration.
- One BP can be both customer and supplier. Netting and credit checks can then work on one record.
MATDOC replaces MKPF and MSEG
In ECC, a goods movement wrote a header to MKPF and items to MSEG. It also updated aggregate tables with current stock, such as MARD (plant and storage location), MCHB (batches) and MKOL (special stock). Updating those aggregates caused database locks when many users posted to the same material.
In S/4HANA, goods movements are inserted into MATDOC and nothing is updated in place. Current stock is calculated from the document items when you ask for it. In-memory column storage makes this fast. This removes most of the locking and removes the aggregate tables as stored data.
For your own code:
- MKPF and MSEG still exist as compatibility views over MATDOC, so old reports keep running. Do not rely on them for new development.
- Stock aggregates such as MARD are also exposed as views. Writing to them is not possible.
- Material numbers can be up to 40 characters long. Check field lengths in any custom code that copies material numbers into 18-character fields.
Universal Journal replaces separate line item tables
In ECC, one invoice posting could create a line in BSEG for FI, a line in COEP for Controlling, and more lines in asset and material ledger tables. Reconciling these sources was a regular month-end task.
In S/4HANA, every posting writes to ACDOCA. The table has the general ledger fields and also the cost center, profit center, order, WBS element and, for purchasing postings, the purchase order number (EBELN) and item (EBELP). Consequences:
- FI and CO are always in agreement for the same posting. There is no reconciliation ledger.
- Cost elements are G/L accounts. Primary cost elements are G/L accounts with a cost element type.
- The material ledger is mandatory. It writes to ACDOCA too, which lets you see price differences and revaluations at line level.
- Index tables such as BSIK and BSAK (open and cleared supplier items) are compatibility views. Supplier balances and totals tables like GLT0 are also views or replaced by CDS-based calculations.
- BKPF and BSEG still hold the accounting document header and original lines. ACDOCA is the line item source for reporting.
The ledger itself is identified by RLDNR. The leading ledger is normally 0L. Filter on it, or you can see duplicate lines when non-leading ledgers are active.
Seeing it in a goods receipt
Post a goods receipt for a purchase order (movement type 101) and the system creates three connected things in one database transaction. A material document in MATDOC gets the quantity. An accounting document gets the value, debiting the stock account and crediting GR/IR. Lines for both go to ACDOCA. The PO history in EKBE still gets its entry, as covered in the PO history chapter.
The report below lists the Universal Journal lines for one purchase order.
REPORT zp2p_acdoca_lines.
PARAMETERS p_ebeln TYPE ebeln OBLIGATORY.
START-OF-SELECTION.
SELECT rbukrs, gjahr, belnr, docln, racct, ebelp, drcrk, hsl
FROM acdoca
WHERE rldnr = '0L'
AND ebeln = @p_ebeln
ORDER BY belnr, docln
INTO TABLE @DATA(lt_lines).
IF lt_lines IS INITIAL.
WRITE / 'No leading-ledger lines found for this purchase order.'.
ENDIF.
LOOP AT lt_lines INTO DATA(ls_line).
" DRCRK: S = debit, H = credit
WRITE: / ls_line-rbukrs, ls_line-gjahr, ls_line-belnr, ls_line-docln,
ls_line-racct, ls_line-ebelp, ls_line-drcrk, ls_line-hsl.
ENDLOOP.After a goods receipt you should see a debit on the inventory account and a credit on the GR/IR account. After the invoice, the GR/IR line is cleared and a credit appears for the supplier.
Common errors during migration and testing
- Missing role. The supplier has FLVN00 but not FLVN01, so purchasing rejects it.
- Old report returns no data. The report read an aggregate table directly and the table is now a view with restricted fields. Re-point it to MATDOC or a CDS view.
- Doubled amounts in custom queries. A second ledger exists, and the query has no
RLDNRfilter. - Truncated material numbers. Custom structures still use 18 characters.
- Missing cost element master data. Cost elements are now G/L accounts, so they must be created in the G/L account master.
Exercise
A colleague posts a goods receipt for a purchase order and then queries MKPF in a new custom report. It works. Why is it still a poor choice for new development, and which table holds the data?
Show answer
In S/4HANA, MKPF is only a compatibility view. The data is stored in MATDOC, and the views exist so that old code keeps working. New code should read MATDOC or a released CDS view and should not depend on the compatibility view.
Exercise
A query on ACDOCA for one purchase order returns every amount twice. What is the most likely cause and the fix?
Show answer
The system has more than one ledger, and the query has no ledger filter, so lines from the leading ledger and a non-leading ledger are both returned. Add rldnr = '0L', or the ledger you actually need, to the WHERE clause.
Exercise
You create a supplier in BP with only the role FLVN00. Can you create a purchase order for it? Explain.
Show answer
No. FLVN00 provides the accounting (company code) view only. Purchasing needs the supplier role FLVN01 with purchasing organization data, so the PO is rejected until you extend the BP with that role.