Sub topic 15
Tracing documents and PO history
This chapter assumes you can create a purchase order, post a goods receipt and enter an invoice, as covered in earlier chapters. You should also know what the GR/IR account is.
Why tracing matters
Each procure-to-pay step creates its own document. A purchase requisition becomes a purchase order, which leads to a material document, an invoice document and a payment. These documents are linked, and you will use the links to answer questions such as "Was this order delivered?", "Why was the invoice blocked?" and "Has the supplier been paid?"
Two views show the links:
- Document flow shows the chain of documents around one document, including follow-on documents in other modules.
- PO history is a list at item level of every goods receipt and invoice posted against that item.
The document chain
Reading the PO history
Open the order in ME23N, select an item and choose the Purchase Order History tab. It lists each goods receipt and invoice receipt with its document number, posting date, quantity and amount. Choosing Document flow shows the wider chain, and double-clicking a document opens it.
The history is stored in table EKBE. The key field is VGABE, the transaction or event type. Value 1 is a goods receipt and 2 is an invoice receipt. The debit/credit indicator SHKZG matters too. A reversal is posted with indicator H, so a plain sum of quantities will overstate what was delivered.
REPORT z_po_history.
PARAMETERS p_ebeln TYPE ekko-ebeln OBLIGATORY.
SELECT ebeln, ebelp, vgabe, shkzg, belnr, buzei, menge
FROM ekbe
WHERE ebeln = @p_ebeln
ORDER BY ebelp, belnr
INTO TABLE @DATA(lt_history).
LOOP AT lt_history INTO DATA(ls_hist).
" VGABE 1 = goods receipt, 2 = invoice receipt
" SHKZG H = credit (a reversal or return)
WRITE: / ls_hist-ebelp, ls_hist-vgabe, ls_hist-shkzg,
ls_hist-belnr, ls_hist-menge.
ENDLOOP.Common errors
- Looking for the payment in PO history. The history shows only goods receipts and invoices. Find the payment through the clearing document on the supplier line item, for example in the Fiori app Manage Supplier Line Items.
- Ignoring reversals. A cancelled goods receipt adds a new history row. It does not delete the original.
- Checking the wrong level. History is kept per item. An order with several items needs each one checked.
- Expecting EKBE to be the only source. In S/4HANA, material movements are stored in MATDOC. EKBE remains the purchasing view of them.
Exercise
An item shows two EKBE rows with VGABE 1 and quantity 10 each, and one of them has SHKZG H. How much has been delivered, and where would you find the supplier payment?
Show answer
The net delivered quantity is 0, because the H row reverses the other 10. The payment does not appear in PO history. You find it as the clearing document on the supplier line item.