Sub topic 12
Cancellations, Reversals and Returns in the Flow
This chapter assumes you can read a document flow in the SAP GUI (VA03, "Display Document Flow"), know the header and item layout of VBAK/VBAP and EKKO/EKPO, and can run a basic SELECT in SE16N or ABAP. You should also know the order-to-cash and procure-to-pay chains from earlier chapters.
Real processes do not run in a straight line. Goods are returned, invoices are cancelled, and deliveries are reversed. SAP does not delete the original documents. It adds new documents and links them to the old ones. Reading a flow with corrections in it means knowing which kind of correction you are looking at.
Three kinds of correction
SAP uses three different mechanisms. They look similar in the flow but behave differently.
| Mechanism | What it does | New document | Original document |
|---|---|---|---|
| Cancellation | Undoes a document with a dedicated cancel transaction | Cancel document with its own category | Stays, marked as cancelled |
| Reversal | Posts the opposite of a posting | Reversal document with opposite sign | Stays, flagged as reversed |
| Return | Business process where the customer or vendor sends goods back | Full returns chain with its own documents | Unchanged |
A cancellation or reversal corrects a mistake or undoes a step. A return is a new business transaction. It has its own order type, its own delivery, and its own credit memo. Mixing these up is the most common reading error.
Cancelling a billing document
In SD, you cancel an invoice by creating a cancellation document. This is a billing document of category N (invoice cancellation), created with VF11. In the flow, the cancellation follows the invoice and points back to it.
In VBFA, the link to the cancelled invoice has these characteristics:
- VBELV and POSNV hold the original invoice and item.
- VBELN and POSNN hold the cancellation document and item.
- VBTYP_N is
N, the category of the cancellation.
The invoice's accounting document is also reversed. Both billing documents have their own accounting documents. The cancellation accounting document links to the cancellation billing document through AWTYP and AWKEY, exactly as an ordinary invoice does. The cancelled invoice is released again for billing. A new invoice can then be created for the same delivery or order.
DATA lv_invoice TYPE vbeln_vf VALUE '0090000123'.
SELECT vbelv, posnv, vbeln, posnn, vbtyp_n
FROM vbfa
WHERE vbelv = @lv_invoice
AND vbtyp_n = 'N'
INTO TABLE @DATA(lt_cancellations).If this returns a row, the invoice was cancelled. The VBELN column holds the cancellation document number.
Reversing a goods issue or goods receipt
A material document is not cancelled with a flow-specific cancel transaction. You post a reversing material document with movement type 102 or 122 for a goods receipt, or 602 for a goods issue, or use the reversal transaction for deliveries.
For outbound deliveries, the reversal of goods issue is done with VL09. The delivery stays. Its goods movement status goes back to "not yet processed", and a reversing material document is created. This has two consequences.
- The delivery itself is not deleted and does not get a new delivery number.
- A new material document is created for the reversal. It references the original through its own material document fields, so check MSEG as well as VBFA.
For purchase orders, the reversal of a goods receipt appears in EKBE as a new row, not as a change to the old row. The reversal row has the same VGABE as the original (1 for goods receipt), but with the debit/credit indicator SHKZG set to H where the original had S. The quantity MENGE is positive in both rows. SHKZG carries the direction.
DATA lv_po TYPE ebeln VALUE '4500000123'.
SELECT ebelp, vgabe, gjahr, belnr, buzei, shkzg, menge
FROM ekbe
WHERE ebeln = @lv_po
AND vgabe = '1'
ORDER BY ebelp, gjahr, belnr, buzei
INTO TABLE @DATA(lt_gr_rows).To get the net received quantity, add the quantities with sign. Rows with S count as plus and rows with H count as minus.
Cancelling a supplier invoice
In MM invoice verification, you cancel an invoice document with MR8M. The system creates a cancellation document and sets a reversal reference on the original. The EKBE rows have VGABE 2. The cancellation row carries the opposite SHKZG, in the same way as the goods receipt reversal above. The purchase order item becomes open for invoicing again.
The FI document of the original invoice is also reversed. It is not reversed on its own in FI. Reverse it through MR8M, not through FB08 for a posting that came from MM. If you use FB08 on a document from another module, the subledger and the source document drift apart.
Returns in sales
A sales return starts a separate chain. The customer sends goods back, and you process them through a returns order (document category H). The usual sequence is:
- Returns order, created with reference to the original invoice or sales order.
- Returns delivery, category T, with a goods receipt posting that brings the stock back.
- Credit memo (category O), which creates the accounting document that reduces the receivable.
The returns order points back to the original document. Since the returns order was created with reference, VBFA holds a link from the original invoice to the returns order. The returns chain then continues as its own flow with the returns order as the root.
DATA lv_invoice TYPE vbeln_vf VALUE '0090000123'.
SELECT vbelv, posnv, vbeln, posnn, vbtyp_n
FROM vbfa
WHERE vbelv = @lv_invoice
AND vbtyp_n IN ('H', 'O')
INTO TABLE @DATA(lt_returns).Several useful rules apply.
- Copy control for the returns order decides which source documents are allowed. A returns order cannot reference every document type.
- The returns order usually has a billing block, set by the order type, until someone approves the credit.
- The credit memo carries the value. The returns delivery carries the stock. Either one can exist without the other. A credit memo can be issued with no goods coming back, and goods can be received before the credit is approved.
Returns in purchasing
In purchasing, you return goods to a vendor with a return item in the PO (the RETPO indicator on the item) and a goods issue to the vendor with movement type 122. The vendor then sends a credit memo, which you post in invoice verification as a credit memo. In EKBE, the goods issue to the vendor appears with VGABE 1 and SHKZG = H. The credit memo appears with VGABE 2 and SHKZG = H.
The difference from a reversal is the reason. A reversal at movement type 102 undoes a booking error. A return at movement type 122 records that real goods really went back. Reports and audits often need to tell the two apart.
Reading a corrected flow
The following diagram shows a sales chain with one cancelled invoice and a return.
When you read a flow like this, apply a short checklist.
- Find each cancellation document and match it to the document it cancels.
- Net the quantities and values. A cancelled invoice plus its cancellation nets to zero.
- Check whether a replacement document exists. If not, the delivery or order may be open for billing again.
- Treat returns as a second chain. Check their status separately.
Common errors
- Reading the cancelled invoice as billed. In VBFA, the original invoice is still there. Check for an
Nfollow-on, or check the cancellation flag on VBRK. - Summing EKBE quantities without SHKZG. The quantity is always positive. Without the sign, a reversed receipt counts twice.
- Expecting the flow to show a return as a change. A return adds a new chain. The original rows do not change.
- Reversing in FI a posting that came from SD or MM. Always cancel in the source module so the links stay consistent.
Exercise
A purchase order item has three EKBE rows with VGABE = 1: a goods receipt of 10 pieces with SHKZG = S, a reversal of 10 pieces with SHKZG = H, and a new goods receipt of 6 pieces with SHKZG = S. What is the net received quantity, and why can a sum of MENGE alone give the wrong answer?
Show answer
The net quantity is 6 (10 - 10 + 6). MENGE is stored as a positive number in every row, and SHKZG gives the direction. A plain sum of MENGE returns 26, which counts the reversed receipt as a receipt.
Exercise
You find a billing document in VBFA with a follow-on row where VBTYP_N = 'N'. What does this tell you, and what do you check next to see whether the delivery can be billed again?
Show answer
The invoice was cancelled, and the VBELN of that row is the cancellation document. Next, check that a new, non-cancelled invoice does not already exist for the same delivery. If none exists, the delivery is open for billing again and its billing status shows it.