Sub topic 6
Following an Order-to-Cash Chain from Order to Payment Posting
This chapter assumes you can navigate the SAP GUI, know what SD, MM and FI cover, and can read a table in SE16N. You should also know how VBFA stores sales links. The goal is to follow one sales order across three modules until the customer payment clears the invoice.
The chain and where each link lives
An order-to-cash chain starts in SD, moves through MM for the goods movement, and ends in FI. Each step creates a document that points back to its predecessor, but the pointers are stored in different places.
| Step | Document | Module | Link stored in |
|---|---|---|---|
| 1 | Sales order | SD | Start of the chain |
| 2 | Delivery | SD | VBFA |
| 3 | Goods issue | MM | VBFA and material document tables |
| 4 | Billing document | SD | VBFA |
| 5 | Accounting document | FI | BKPF reference fields |
| 6 | Customer payment | FI | Clearing fields on the open item |
Step 1: Start in the GUI
Open the sales order in VA03 and choose Environment > Display Document Flow. You see the order, then the delivery, the goods issue, the invoice and the accounting document, each with its status. Double-click a line to jump into that document.
The GUI is convenient, but it hides the keys. To understand the chain, look at the tables.
Step 2: Follow the SD links in VBFA
VBFA stores one row per direct link. The preceding document is in VBELV and POSNV. The subsequent document is in VBELN and POSNN. VBTYP_N tells you the category of the follow-on document.
DATA lv_order TYPE vbeln_va VALUE '0000004711'.
SELECT vbelv, posnv, vbeln, posnn, vbtyp_n
FROM vbfa
WHERE vbelv = @lv_order
INTO TABLE @DATA(lt_followers).This returns only the direct followers, usually the deliveries. To reach the invoice, repeat the query with each delivery number as the starting point. The chain is a series of single hops, not one stored path.
Step 3: Cross into FI with the reference key
The billing document does not store the accounting document number in VBFA in the same way. Instead, the accounting document header in BKPF points back to the billing document. AWTYP holds the reference transaction, which is VBRK for billing. AWKEY holds the billing document number.
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).The result gives you the company code, accounting document number and fiscal year. You need all three to identify the FI document, because BELNR alone is not unique.
Step 4: Payment posting
When the customer pays, FI posts an incoming payment and clears the open receivable item created by the invoice. The link between invoice and payment lives in the clearing fields of the customer line item (AUGBL for the clearing document, AUGDT for the clearing date). The payment is therefore reachable from the accounting document, not from the SD document flow. In the GUI you can reach it through the accounting document display, which lists the clearing document.
Common errors
- Looking for the invoice with only the order number. VBFA gives direct links, so you need the delivery in between.
- Searching BKPF with the wrong AWTYP, or without the exact AWKEY.
- Expecting the payment in the SD flow.
- Assuming one order has one delivery. Partial deliveries create several chains.
Exercise
You have a sales order number and want the payment that cleared its invoice. Name the sequence of lookups and the table or field that connects each hop.
Show answer
Query VBFA from the order to get the delivery, then query VBFA again from the delivery to get the billing document. Search BKPF with AWTYP = 'VBRK' and AWKEY set to the billing document number to find the accounting document. Then read the customer line item for that document and use its clearing fields (AUGBL, AUGDT) to find the payment document.