Sub topic 8
How purchasing, sales, and inventory postings reach the general ledger
This chapter assumes you know the Universal Journal (ACDOCA), company codes, and G/L accounts from earlier chapters. It also assumes you know basic debit and credit logic.
The working model
Logistics users do not post to the general ledger by hand. They post business documents, such as a goods receipt or a billing document. S/4HANA then creates a journal entry for each one. The account determination rules decide which G/L accounts the entry uses.
Account determination works in three steps:
- The system reads the material's valuation class and the movement type or transaction key.
- It looks up the G/L account assigned to that combination in the chart of accounts.
- It posts the lines to ACDOCA with the logistics document as the reference.
For inventory and purchasing, the transaction keys are BSX (inventory), WRX (goods receipt/invoice receipt clearing), and PRD (price differences). For sales, the revenue accounts come from condition-based account determination in billing.
Procure-to-pay example
Take a purchase order for 10 units at 100 each, with a standard valuation.
| Step | Document | Debit | Credit |
|---|---|---|---|
| Goods receipt | Material document | Inventory (BSX) 1,000 | GR/IR clearing (WRX) 1,000 |
| Invoice receipt | Supplier invoice | GR/IR clearing (WRX) 1,000 | Accounts payable 1,000 |
| Payment | Outgoing payment | Accounts payable 1,000 | Bank 1,000 |
The GR/IR account is a clearing account. Its balance should return to zero once both the receipt and the invoice are posted. A balance that stays open points to a missing invoice or a missing receipt.
Order-to-cash example
A sales order itself posts nothing. Two later steps create entries:
- Goods issue (delivery): debits cost of goods sold and credits inventory, valued at the material's price.
- Billing: debits accounts receivable and credits revenue, plus tax if it applies.
Checking the link
Every logistics-driven line keeps a reference to its source document. You can list the lines for one company code and see which origin created them. The reference fields are awtyp (reference transaction, for example MKPF for a material document or VBRK for a billing document) and awref (reference document number).
SELECT awtyp,
COUNT( * ) AS line_count,
SUM( hsl ) AS amount
FROM acdoca
WHERE rldnr = '0L'
AND rbukrs = '1010'
AND gjahr = '2025'
GROUP BY awtyp
ORDER BY awtyp
INTO TABLE @DATA(lt_by_origin).The company code and year are sample values. Because hsl is signed, the sum for one origin is a net figure.
Common errors
- Missing account determination. A posting stops with an error when no G/L account exists for the valuation class and transaction key. Fix the assignment, then repeat the posting.
- Closed posting period. The logistics posting date falls in a period that period control has closed. Open the period or use an allowed date.
- GR/IR balance never clears. Check for invoices posted against the wrong purchase order item, or goods received without an invoice.
- Inventory and G/L differ. Valuation changes, such as price changes, post to the G/L. Compare the material ledger or stock value with the inventory account.
Exercise
A goods receipt for 10 units at a standard price of 100 is posted, and no invoice has arrived yet. Which accounts are affected, and what is the GR/IR balance?
Show answer
Inventory (BSX) is debited 1,000 and GR/IR clearing (WRX) is credited 1,000. The GR/IR account shows a credit balance of 1,000 until the invoice receipt clears it.