Sub topic 11
Item-level links, partial deliveries and partial invoices
This chapter assumes you can read the SAP GUI document flow, know the header and item structure of SD documents, and can run a basic ABAP SELECT. Document flow links are stored per item, not per header. That is how SAP records partial processing.
Links connect items
Every row in VBFA links one preceding item to one subsequent item. The preceding side is VBELV and POSNV. The subsequent side is VBELN and POSNN. VBTYP_N holds the category of the subsequent document. Quantities and values for the link sit in columns such as RFMNG (the referenced quantity) and RFWRT (the referenced value).
A header-level view hides this. An order with three items can have item 10 fully delivered, item 20 half delivered and item 30 not touched. The flow shows a delivery for the order, but only the item rows tell you which items it covers.
Partial deliveries
Suppose a sales order has item 10 for 100 pieces. Stock allows 60 now and 40 later. Two deliveries are created, and VBFA holds two rows for item 10, one per delivery. The order item stays open until the full quantity is delivered.
Partial invoices
Billing can also split. A delivery of 60 pieces can be billed once, or in several invoices if the billing type and copy control allow it. Billing can also combine items from several deliveries into one invoice. Each pairing creates its own VBFA row, so one invoice item can have several predecessors.
Reading the quantities
This query lists the follow-on items for one order item, with the quantity each link carries.
DATA lv_order TYPE vbeln_va VALUE '0000004711'.
DATA lv_item TYPE posnr_va VALUE '000010'.
SELECT vbelv, posnv, vbeln, posnn, vbtyp_n, rfmng, meins
FROM vbfa
WHERE vbelv = @lv_order
AND posnv = @lv_item
ORDER BY vbeln, posnn
INTO TABLE @DATA(lt_links).Sum RFMNG per category to see how much was delivered or billed. Compare it with the order quantity to find the open part. Do not add rows of different categories together. A delivery row and an invoice row for the same goods would be counted twice.
The same idea in purchasing
EKBE works per purchase order item as well. A PO item for 100 pieces can have goods receipts for 70 and 30, and invoice receipts that do not match those quantities. Each posting is a row, and MENGE holds its quantity. Group by EBELP and VGABE before you compare.
| Question | Where to look | Column |
|---|---|---|
| How much of an order item is delivered? | VBFA, category J rows | RFMNG |
| How much is billed? | VBFA, category M rows | RFMNG |
| How much of a PO item is received? | EKBE, VGABE = 1 | MENGE |
| How much is invoiced? | EKBE, VGABE = 2 | MENGE |
Common errors
- Reading only the header row in the GUI and concluding that an item was processed.
- Summing quantities across categories, or across units of measure that differ (check MEINS).
- Forgetting that reversals appear as extra rows. A cancelled delivery does not remove the original link, so a plain sum overstates the processed quantity. The next chapter covers this.
- Assuming items keep their numbers. A follow-on item can have a different POSNN from its source item.
Exercise
Order 4711 item 10 is for 100 pieces. VBFA has two delivery rows with RFMNG 60 and 40, and one invoice row with RFMNG 60. How much is still open for delivery and for billing?
Show answer
Nothing is open for delivery, because 60 + 40 = 100. For billing, 40 pieces are open, because only 60 pieces are invoiced. Sum the delivery rows and the invoice rows separately, not together.