Sub topic 10
Posting goods issue
This chapter covers the step where a picked delivery leaves your stock and the first accounting entry of the process is posted. It assumes you have read the delivery chapter. You should be able to read a debit/credit entry and a simple ABAP SELECT.
What goods issue does
Posting goods issue (PGI) is the formal confirmation that the goods have left the plant. You trigger it on an outbound delivery, usually in transaction VL02N, in a Fiori app such as Manage Outbound Deliveries, or through a batch job. A single PGI performs several updates in one logical unit of work:
- It creates a material document with movement type 601 (goods issue for delivery).
- It reduces unrestricted-use stock in the plant and storage location.
- It creates an accounting document that debits cost of goods sold and credits inventory.
- It sets the goods movement status of the delivery to "completely processed".
- It removes the delivery requirement and the related stock reservation from the planning view.
- It makes the delivery relevant for billing, so it appears in the billing due list.
- It adds a goods movement entry to the document flow.
If any of these updates fails, none of them is saved. That is why a PGI error message, such as a missing account or a closed posting period, stops the whole posting.
Preconditions
PGI only works when the delivery is ready. The system checks these points:
- Picking is complete for every item. If the picked quantity is lower than the delivery quantity, you can either post a partial PGI or adjust the delivery quantity to the picked quantity.
- Batch and serial number requirements are met, if the material needs them.
- The delivery has no active block, such as a credit block or a delivery block on the order.
- The posting period is open for the material and for accounting.
- Stock is available. If stock is insufficient and negative stocks are not allowed for the plant, the posting is rejected.
Posting with a quantity lower than the delivery quantity is a common way to handle short picks. The remaining quantity needs a new delivery, or the order item is closed through a rejection reason.
What changes in stock
The material document records the movement. For a standard sale from warehouse stock, it reduces unrestricted-use stock in the issuing storage location. Movement type 601 relates to different stock categories:
| Situation | Stock reduced | Typical note |
|---|---|---|
| Standard sale from warehouse | Unrestricted-use stock | Movement type 601 |
| Make-to-order sale | Sales order stock | Linked to order and item |
| Consignment issue | Consignment stock at the customer | Different movement type, no billing |
| Free-of-charge delivery | Unrestricted-use stock | Item category drives billing relevance |
In S/4HANA, material documents are stored in the table MATDOC. The older tables MKPF and MSEG still exist as compatibility views, so older reports keep working. Stock quantities are calculated from MATDOC instead of being kept in separate aggregate tables.
What changes in accounting
The material valuation of the item controls the accounting entry. For a material valued at a moving average price of 40.00 per unit, issuing 10 units gives:
| Account | Debit | Credit |
|---|---|---|
| Cost of goods sold (account key GBB, modifier VAX) | 400.00 | |
| Inventory (account key BSX) | 400.00 |
The amount comes from the price of the material, not from the selling price. Account determination finds the G/L accounts from the valuation class of the material, the plant (valuation area), and the movement type. Revenue is not posted at PGI. Revenue and the customer receivable appear only when the billing document is created.
The accounting entry is written to the Universal Journal table ACDOCA. Its reference fields point back to the source: awtyp is MKPF, awref holds the material document number, and aworg holds the material document year.
Verifying the posting with code
This report reads the material document lines of a delivery from MATDOC, then reads the Universal Journal lines created by that material document. The delivery number is a parameter.
REPORT zo2c_pgi_check.
PARAMETERS p_vbeln TYPE likp-vbeln OBLIGATORY.
START-OF-SELECTION.
SELECT mblnr, mjahr, zeile, bwart, matnr, werks, lgort, menge, meins
FROM matdoc
WHERE vbeln_im = @p_vbeln
AND bwart = '601'
INTO TABLE @DATA(lt_mat).
IF lt_mat IS INITIAL.
WRITE / 'No goods issue found for this delivery.'.
RETURN.
ENDIF.
cl_demo_output=>write( lt_mat ).
DATA(lv_mblnr) = lt_mat[ 1 ]-mblnr.
DATA(lv_mjahr) = lt_mat[ 1 ]-mjahr.
SELECT rbukrs, gjahr, belnr, docln, racct, drcrk, hsl
FROM acdoca
WHERE rldnr = '0L'
AND awtyp = 'MKPF'
AND awref = @lv_mblnr
AND aworg = @lv_mjahr
INTO TABLE @DATA(lt_journal).
cl_demo_output=>write( lt_journal ).
cl_demo_output=>display( ).If the first query returns lines but the second returns none, the material document exists but no accounting document was created. This can happen for materials without valuation. For a valuated material, the cost of goods sold line and the inventory line should have the same amount with opposite debit/credit indicators.
Document flow after PGI
The delivery gets a successor in the document flow. In VBFA, the material document appears with vbtyp_n = 'R' (goods movement). You can read it with the same query pattern used in the document flow chapter, filtering on the delivery as predecessor. Note that the delivery itself has document category J, while the sales order has category C.
Reversing a goods issue
You cannot delete a posted goods issue. You reverse it. In VL09, or through the matching Fiori function, you cancel the goods issue for the delivery. The system posts a material document with movement type 602, which returns the stock and creates a reversing accounting entry. Rules to remember:
- You cannot reverse PGI if a billing document already exists for the delivery. Cancel the billing document first.
- Reversal uses the posting date of the original document or a new date, depending on whether the original period is still open.
- After reversal, the delivery goes back to "not yet processed" for the goods movement status. You can then change the quantity or delete the delivery.
Common errors
| Symptom | Likely cause | Check |
|---|---|---|
| "Stock is insufficient" | Picked from stock that was booked elsewhere, or negative stock not allowed | Stock overview for the plant and storage location |
| "Account not defined" | Missing GBB/VAX or BSX entry | Account determination for the valuation class |
| "Posting period not open" | Material or finance period closed | Period control settings |
| PGI not possible, status "not picked" | Picking not confirmed | Delivery item picking status |
| Delivery missing from billing due list | Item category is not billing relevant, or no PGI yet | Item category and delivery status |
Exercise
A delivery for 10 units of a material valued at a moving average price of 40.00 is posted for goods issue. The selling price is 70.00 per unit. Which amounts does the PGI accounting document contain, which movement type is used, and why can the delivery still be reversed later?
Show answer
The accounting document debits cost of goods sold with 400.00 and credits inventory with 400.00. It uses the valuation price (10 x 40.00), not the selling price, and no revenue is posted. The movement type is 601. The delivery can be reversed with movement type 602 as long as no billing document exists for it. If an invoice exists, you must cancel the billing document first.
Exercise
In the ABAP report above, the MATDOC query returns lines but the ACDOCA query returns nothing. Name two possible reasons and where you would look.
Show answer
The material may not be valuated (no accounting relevance), so no accounting document was created. Alternatively, the filter may be wrong: for example, the material document year in aworg does not match, or the ledger is not 0L. Check the valuation settings of the material and compare the reference fields of the material document with those in ACDOCA.