Sub topic 12
Cancellations, reversals and returns in the flow
This chapter assumes you can read the document flow in the SAP GUI, know that VBFA and EKBE store the links, and understand that an accounting document points back to its source through AWTYP and AWKEY. It builds on item-level links and partial processing.
Nothing is deleted, a new document is added
Posted documents are not removed when a process is undone. SAP creates a new document that references the original one, and both stay in the flow. Cancelling a goods issue, cancelling an invoice, and returning goods all follow this rule. To read a flow correctly, you need to recognize which new document undoes which.
| Business action | Typical transaction | Document created | Link recorded |
|---|---|---|---|
| Cancel a billing document | VF11 | Cancellation invoice (category N) | VBFA, linked to the original invoice |
| Reverse a goods issue | VL09 | Material document with a reversal movement type | VBFA entry with category h |
| Reverse a goods receipt for a PO | MIGO (movement type 102) | Material document | EKBE row with VGABE 1 and a negative quantity or debit/credit flag S |
| Customer return | Return order (category H) | Return order, then return delivery and credit memo | VBFA chain from the original order or invoice |
Reversals in the sales flow
When you cancel a billing document with VF11, SAP creates a cancellation document of category N. The flow shows it as a successor of the original invoice. The accounting document of the cancelled invoice also gets a reversal accounting document, and the original is marked as reversed.
The original billing document is not deleted, and it does not disappear from the flow. The order can usually be billed again, because the billed quantity is reduced by the cancellation.
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 the query returns a row, VBELN holds the cancellation document number.
Returns
A return starts with its own order type, a returns order (category H). It can reference the original invoice or order. The follow-on documents are a returns delivery (category T) and, usually, a credit memo (category O). The returns do not cancel the original documents. They add a second chain next to the first. Both chains share the original document as a common ancestor in VBFA.
Reversals in the purchasing flow
In purchase order history, a reversed goods receipt appears as an additional EKBE row. The original row stays. The reversal row has the same VGABE value, and its SHKZG field (debit/credit indicator) is set to H instead of S, so the quantities offset each other.
DATA lv_po TYPE ebeln VALUE '4500000123'.
SELECT ebelp, vgabe, belnr, buzei, shkzg, menge
FROM ekbe
WHERE ebeln = @lv_po
AND vgabe = '1'
ORDER BY ebelp, belnr, buzei
INTO TABLE @DATA(lt_gr).To get the net received quantity, add MENGE for SHKZG = 'S' and subtract it for SHKZG = 'H'. Summing MENGE without checking SHKZG overstates what was received.
Common errors
- Counting every successor as a valid document. Check for cancellation or reversal rows before you report a quantity or amount.
- Looking for a deleted document. A cancelled document still exists. Look for the reversal that references it.
- Expecting a return to appear as a cancellation. A return is a separate chain, not an undo of the original.
- Forgetting the accounting side. A cancelled invoice also produces a reversal accounting document, which you find through AWTYP and AWKEY.
Exercise
A purchase order item shows two EKBE rows with VGABE = 1. One has SHKZG = S and MENGE = 10. The other has SHKZG = H and MENGE = 4. How much has been received net, and what does the second row represent?
Show answer
The net received quantity is 6. The second row is a reversal of part of the goods receipt, and it offsets the original quantity.
Exercise
A billing document was cancelled with VF11. Which document category do you look for in VBFA to find the cancellation, and does the original billing document still exist?
Show answer
Look for category N as the subsequent document category. The original billing document still exists, and it stays in the flow along with its cancellation.