Sub topic 17
Monitoring the process and spotting stuck documents
This chapter assumes you know the order-to-cash (O2C) steps from earlier chapters: sales order, delivery, goods issue, billing, accounting document and incoming payment. You should also be able to read basic SQL. The goal is to find documents that stopped moving, work out why, and check the result in the tables.
What "stuck" means
A document is stuck when the next step should have happened but has not. Each gap in the flow has a typical cause.
| Gap | Typical cause |
|---|---|
| Order exists, no delivery | Delivery block, credit block, no stock, missing ship-to data |
| Delivery exists, no goods issue | Picking not confirmed, batch or serial number missing, storage location error |
| Goods issue posted, no invoice | Billing block, incomplete billing data, pricing error, billing due list not run |
| Invoice exists, no accounting document | Account determination error, closed posting period, billing status "blocked for accounting" |
| Open receivable past due | No payment received, payment not matched, clearing not run |
Monitoring means checking these gaps regularly, so that a problem is found while it is still small.
Standard worklists
SAP provides worklists for most gaps. They list documents that are due for the next step, so they double as monitoring tools. Transaction codes work in SAP GUI, and Fiori apps exist for many of the same tasks. Exact app names depend on your release, so search the launchpad if a name below differs.
| Question | Transaction | What it shows |
|---|---|---|
| Which orders are blocked or not delivered? | VA05, VA05N | List of sales orders with status filters |
| Which orders are due for delivery? | VL10A, VL10C | Delivery due list, with the reason a line cannot be processed |
| Which deliveries are not goods issued? | VL06G | Outbound deliveries for goods issue |
| Which deliveries are due for billing? | VF04 | Billing due list |
| Which billing documents are not in accounting? | VFX3 | Billing documents blocked for accounting |
| Which orders are incomplete? | V.02 | Incomplete sales orders |
| Which customer items are open? | FBL5N | Customer line items |
| Where is a document in the process? | VA03, then Display Document Flow | Predecessors and successors |
The billing due list (VF04) is a good example of how these tools work. A delivery that does not appear there is either already billed, blocked, or not yet goods issued. A delivery that appears with an error log has a data problem that you must fix before billing can run.
Reading status fields
Every SD document has status fields that record how far it has progressed. The overall processing status of an order and the delivery status are the most useful ones for monitoring. In the item table VBAP, the status of an item is summarized in fields such as GBSTA (overall status) in older releases. In S/4HANA, status values are held in the document tables themselves for many documents. Check which fields exist in your system with the Data Dictionary (SE11) before you rely on a field name in a query.
The status value is usually a single letter. A blank means not relevant, A means not yet processed, B means partially processed and C means completely processed. This pattern is consistent across many status fields, but confirm it in the domain of the field you use.
Finding gaps with document flow
A reliable approach that does not depend on status fields is to compare the document flow table VBFA with the order. If an order has no successor of the type you expect, the process has not reached that step.
The following query lists the immediate successors of one order and the type of each, as shown in the topic's earlier example.
DATA(lv_vbeln) = CONV vbeln_va( '0000012345' ).
SELECT vbelv, posnv, vbeln, posnn, vbtyp_n
FROM vbfa
WHERE vbelv = @lv_vbeln
INTO TABLE @DATA(lt_flow).In VBTYP_N, J identifies a delivery and M identifies an invoice. If the result has J rows and no M rows, the order was delivered but not billed. Remember that VBFA stores direct successors, so an invoice follows the delivery, not the order. To see the invoice for an order you must follow the chain one level further.
You can turn this into a monitoring query that finds orders with no delivery at all. This one lists order headers created in a date range that have no successor of type J.
DATA(lv_from) = CONV erdat( '20261101' ).
DATA(lv_to) = CONV erdat( '20261130' ).
SELECT h~vbeln, h~auart, h~kunnr, h~erdat
FROM vbak AS h
WHERE h~erdat BETWEEN @lv_from AND @lv_to
AND NOT EXISTS ( SELECT vbeln FROM vbfa
WHERE vbelv = h~vbeln
AND vbtyp_n = 'J' )
INTO TABLE @DATA(lt_undelivered).Not every order should have a delivery. Quotations, contracts and service orders do not, so filter on the document category (VBTYP) or order type (AUART) that fits your process, or the list will contain false alarms.
Checking the accounting side
A billing document that exists but has no accounting document is a serious gap, because revenue and the receivable are missing from the ledger. The billing header table VBRK holds the accounting document number in field BELNR. A blank value for a billing document that should be posted means the posting did not happen.
To confirm what a posted billing document produced, read the Universal Journal in table ACDOCA, as shown in the earlier chapters.
DATA(lv_billing) = CONV vbeln_vf( '0090001234' ).
SELECT rbukrs, gjahr, belnr, docln, racct, hsl
FROM acdoca
WHERE rldnr = '0L'
AND awtyp = 'VBRK'
AND awref = @lv_billing
INTO TABLE @DATA(lt_journal).If this returns no rows for a billing document that VBRK says was posted, check that you used the right ledger and the right reference. Also check that the document is not in a different client or company code than you assumed.
The sum of the amounts by account is a quick reconciliation. Revenue accounts should carry the net value of the invoice and the receivable account should carry the gross value. A difference points to tax or pricing conditions that were not posted as expected.
Monitoring open items
The last step in the process is payment. FBL5N lists open items for a customer. Sort by net due date to see what is overdue. In S/4HANA, the Manage Customer Line Items Fiori app offers the same view, and the Days Sales Outstanding analysis summarizes how long receivables stay open.
Common causes of items that stay open after the customer has paid:
- The payment was posted on account and not matched to the invoice.
- The payment reference did not contain the invoice number, so automatic clearing could not match it.
- A partial payment left a residual item.
- The payment was made against a credit memo or a different invoice than the one expected.
Run the automatic clearing program (F.13) after fixing the cause, or clear manually from the customer account.
Common errors and how to avoid them
- Relying on one status field. A status can lag behind reality when a document is partly processed. Cross-check with VBFA.
- Counting orders that should never be delivered. Always restrict by order type.
- Reading VBFA as a full chain. It lists direct successors. Use the document flow display, or repeat the query for each level.
- Ignoring the error log. Due lists show a log for rejected items. The log names the missing field or setting.
- Fixing symptoms in the database. Never update SD tables directly. Correct the cause, such as master data or account determination, and then reprocess the document.
- Running no schedule. A due list that nobody opens does not monitor anything. Schedule the lists as background jobs and send the result to the responsible team.
A practical routine
A simple weekly routine covers most problems:
- Open VA05N for blocked orders and clear or escalate each block.
- Open VL10A for deliveries that cannot be created and read the log.
- Open VL06G for deliveries not goods issued after the planned date.
- Open VF04 and process or fix the billing due list.
- Open VFX3 for invoices not transferred to accounting.
- Open FBL5N for overdue items and start dunning or follow-up.
Exercise
An order has delivery document rows in VBFA with VBTYPN = 'J', but you find no rows with VBTYPN = 'M' when you query VBFA with the order number as VBELV. Does this prove the order was not billed? What do you check next?
Show answer
No. VBFA stores direct successors only, and an invoice normally follows the delivery rather than the order. Query VBFA again with the delivery number as VBELV and look for VBTYP_N = 'M'. If there is still no invoice, check the billing due list (VF04) for the delivery and read its error log, and check for a billing block.
Exercise
A billing document shows a number in VBRK-BELNR, but your ACDOCA query by AWTYP = 'VBRK' and AWREF returns no rows. List two things to verify.
Show answer
First, confirm the ledger filter: use the leading ledger 0L, or the ledger that actually holds the posting. Second, confirm that the billing document number is entered with its leading zeros and that you are reading the correct client and company code. You can also check that the accounting document exists in the document header and was not reversed.