Sub topic 15
What changes in SAP S/4HANA
This chapter assumes you can read VBFA, EKBE and BKPF in SE16N, and you know the order-to-cash and procure-to-pay chains from earlier chapters. It also assumes basic ABAP SELECT syntax. It covers what moves in the data model when you go from SAP ECC to SAP S/4HANA, and what that means for tracing document links.
The short version
The idea of document flow is the same in S/4HANA. A follow-on document still carries a reference to its predecessor, and you still find the link in VBFA, EKBE or the accounting reference fields.
The storage underneath changed. Some tables became compatibility views, some status fields moved, and the accounting data now lives in one central table. Queries that only read the link tables mostly keep working. Code that writes to tables, depends on index tables, or assumes a specific table layout may not.
| Area | In ECC | In S/4HANA |
|---|---|---|
| Sales document links | VBFA | VBFA, unchanged in role |
| Purchase order history | EKBE | EKBE, unchanged in role |
| Material documents | MKPF (header) and MSEG (items) | MATDOC holds both. MKPF and MSEG are compatibility views |
| Accounting documents | BKPF and BSEG plus index tables such as BSIS and BSID | ACDOCA is the primary store. BKPF stays. The index tables become views |
| Sales document status | VBUK and VBUP | Status fields are in the header and item tables. VBUK and VBUP are views |
| Customers and vendors | KNA1 and LFA1 as masters | Business partner is the leading object, linked through customer-vendor integration |
What stays the same
Three things you learned in earlier chapters still apply.
- VBFA still links a sales order to its delivery, billing document and goods movement through VBELV, POSNV, VBELN, POSNN and VBTYP_N.
- EKBE still records goods receipts (VGABE 1), invoice receipts (VGABE 2) and subsequent debits or credits (VGABE 3) per PO item.
- BKPF still holds AWTYP and AWKEY. For a billing document, AWTYP is
VBRKand AWKEY is the billing document number.
The SAP GUI transactions VA03, VL03N, VF03, ME23N and FB03 still work. The document flow button in these transactions still shows the same chain. Fiori apps for sales orders and purchase orders show a process flow that is built from the same links.
Material documents move to MATDOC
In ECC, a goods movement wrote a header row to MKPF and item rows to MSEG. It also updated stock aggregate tables such as MARD and MARC. In S/4HANA, MATDOC stores both header and item data in one table. Stock quantities are no longer kept as updated totals. They are calculated from MATDOC, through compatibility views.
This matters for document flow in three ways.
- Reads of MKPF and MSEG still work, because those names are now views over MATDOC. A SELECT such as the one in the next section does not need to change.
- Writes do not work. A custom program that does INSERT, UPDATE or DELETE on MKPF or MSEG fails or is blocked. Post goods movements through BAPIGOODSMVTCREATE or the standard transactions.
- Custom fields and indexes you added to MSEG in ECC need to be reviewed during the conversion. They are not carried over automatically in the same way.
The links around a material document are unchanged. EKBE rows for goods receipts still point to the material document through BELNR (material document number) and GJAHR (material document year). VBFA rows for goods issue (VBTYP_N R) still point from the delivery to the material document.
DATA lv_po TYPE ebeln VALUE '4500000123'.
SELECT mblnr, mjahr, zeile, bwart, menge
FROM mseg
WHERE ebeln = @lv_po
ORDER BY mjahr, mblnr, zeile
INTO TABLE @DATA(lt_matdocs).This query works in both releases. In S/4HANA it reads through the compatibility view, so it returns the same rows as in ECC. For new development, check whether SAP provides a released CDS view for material documents in your release, and prefer it over the compatibility view.
Accounting moves to the Universal Journal
In ECC, an accounting document was spread over BKPF (header), BSEG (items), secondary index tables (BSIS, BSAS, BSID, BSAD, BSIK, BSAK) and separate controlling and ledger tables. In S/4HANA, ACDOCA is the central line item table, called the Universal Journal. It combines financial accounting, controlling, asset accounting and the material ledger in one place.
BKPF still exists and is still the header. This is why the accounting reference lookup from earlier chapters keeps working:
DATA lv_awkey TYPE awkey VALUE '0090000123'.
SELECT bukrs, belnr, gjahr, awtyp, awkey
FROM bkpf
WHERE awtyp = 'VBRK'
AND awkey = @lv_awkey
INTO TABLE @DATA(lt_fi_docs).ACDOCA carries its own reference fields, including AWTYP, AWREF and AWORG. They hold the same kind of information as the BKPF fields, but on line item level. If you need to know which source line produced a given accounting line, ACDOCA is the better source in S/4HANA. Check how AWREF and AWORG are filled for each reference transaction in your system before you rely on them, because the content differs by source document type.
For goods movements, the reference is built differently from billing. AWTYP is MKPF, and AWKEY is the material document number followed by the year, 14 characters in total. A lookup from a material document to its accounting document looks like this:
DATA: lv_mblnr TYPE mblnr VALUE '4900000321',
lv_mjahr TYPE mjahr VALUE '2026'.
DATA(lv_key) = CONV awkey( |{ lv_mblnr }{ lv_mjahr }| ).
SELECT bukrs, belnr, gjahr, awtyp, awkey
FROM bkpf
WHERE awtyp = 'MKPF'
AND awkey = @lv_key
INTO TABLE @DATA(lt_gr_fi).The index tables BSIS, BSID and the others are now compatibility views over ACDOCA. Reading them still works. Do not rely on them for performance tuning, because the open and cleared logic is evaluated on the fly.
Status fields move into the document tables
In ECC, the processing status of a sales document sat in VBUK (header) and VBUP (item). Fields such as delivery status or billing status were read from there. In S/4HANA, these fields are part of the header and item tables, for example VBAK, VBAP, LIKP, LIPS and VBRK. VBUK and VBUP remain as views so that existing code keeps running.
For document flow, this removes a join. When you check whether an order is fully delivered or billed, you read the status from the order itself. The links still come from VBFA, but the status no longer needs a second table.
Business partners in documents
S/4HANA uses the business partner as the leading master data object. Customers and vendors are created as business partners with a customer or vendor role. Customer-vendor integration keeps KNA1 and LFA1 filled, so document tables that store KUNNR or LIFNR still work. Document flow does not depend on partner data. You only notice the change if a document cannot be created because the partner is missing a role or a required view.
How the storage changes
Gotchas when you trace links
- Do not read the compatibility views as if they were tables when you check performance. A SELECT on MSEG without a selective key can be slow, because the view maps to MATDOC.
- Do not write to compatibility views. Writes that worked on MKPF, MSEG, VBUK or the BSIS family do not carry over.
- Do not assume one accounting document per source document. The Universal Journal and material ledger can change how many accounting lines a single goods movement produces. Count documents by the reference key, not by an assumed one-to-one pairing.
- Do check custom code with the ABAP Test Cockpit and the S/4HANA readiness checks before conversion. They report direct table access that no longer works.
- Do keep using VBFA, EKBE and the BKPF reference fields as the entry points. They are still the supported way to follow a chain.
Exercise
A custom report in ECC reads the delivery status from VBUK and finds the goods issue document through VBFA (VBTYP_N = 'R'), then reads MKPF and MSEG for the movement details. It also inserts a log row into MSEG. Which parts of this report still work unchanged after conversion to S/4HANA, and which part must change?
Show answer
The VBFA read still works, because VBFA keeps its role and layout. The VBUK read still works because VBUK is a compatibility view, although new code should read the status field from the delivery header LIKP. The reads of MKPF and MSEG still work because they are views over MATDOC. The INSERT into MSEG must change, because the compatibility view does not accept writes. Replace it with a standard posting such as BAPIGOODSMVTCREATE, or move the log to a custom table.
Exercise
You have a material document 4900000321 from year 2026 and need the accounting document it created. Which table and which two selection conditions do you use, and how is the reference key built?
Show answer
Select from BKPF with AWTYP = 'MKPF' and AWKEY equal to the material document number followed by the year (14 characters, here '49000003212026'). This works in ECC and in S/4HANA, because BKPF remains the accounting header. In S/4HANA you can also read ACDOCA for line level references.