Sub topic 3
How Accounting Documents Point Back to Their Source
Assume you know basic SAP GUI navigation, SD, MM, FI, document headers and items, and simple ABAP SELECT statements.
Accounting References and Copy Control
An FI accounting document records the financial impact of a business event. Its header table, BKPF, contains reference fields that point to the source document. For example, an accounting document created from billing commonly has AWTYP = 'VBRK'. AWKEY contains the billing document key, often including the billing number.
| Field | Meaning |
|---|---|
| `BKPF-AWTYP` | Reference transaction or source object |
| `BKPF-AWKEY` | Reference key for the source document |
| `BKPF-BELNR` | Accounting document number |
| `BKPF-GJAHR` | Fiscal year |
Copy control determines which documents may follow others. It controls permitted source and target document types, copying requirements, data-transfer routines, and quantity or status rules. For example, a billing document may copy data from a delivery or sales order only when the relevant configuration and processing status allow it.
Item-Level Links and Exceptions
Document links usually exist at both header and item level. A sales order item can produce several delivery items, and one delivery can be billed in multiple invoices. Quantities and status values explain whether processing is complete.
Cancellations and returns add more links rather than deleting the original history. A cancellation document reverses an earlier business effect. A return order or return delivery represents goods moving back. Always inspect document category, item references, quantities, and posting status.
Tracing Links with ABAP
Use the accounting reference fields to locate FI documents for a billing document:
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).For sales-document links, query VBFA. For purchasing history, query EKBE, where VGABE distinguishes goods receipts, invoice receipts, and later debits or credits.
Troubleshooting and S/4HANA
If the flow looks incomplete, check item numbers, document status, cancellation links, copy-control settings, and whether the expected posting actually occurred. A missing FI reference may indicate that billing is not posted to accounting, not that the source document is absent.
In SAP S/4HANA, the business concepts remain, but many applications use CDS views and compatibility views instead of direct table-oriented reporting. Verify the supported interface and authorization before building new code around a classic table.
Exercise
Which BKPF fields help find the accounting document created from a billing document?
Show answer
Use AWTYP to identify the billing reference transaction and AWKEY to match the billing document key.