Sub topic 10
Posting a goods receipt
This chapter assumes you can create a purchase order, know the stock types (unrestricted use, quality inspection, blocked), and can read a debit and credit posting. Here you post the goods receipt (GR) against a purchase order, see what the system creates, and learn why postings fail.
What a goods receipt does
A goods receipt records that ordered goods have physically arrived. One posting triggers three effects:
- It creates a material document that records the stock movement.
- It updates the purchase order item with the received quantity and adds a history entry.
- For valuated materials, it creates an accounting document that books the inventory value.
The GR is the second leg of the three-way match, after the order and before the invoice. The invoice is later checked against the quantity you post here.
Ways to post
In the Fiori launchpad, use the app Post Goods Receipt for Purchase Order. In SAP GUI, transaction MIGO with action Goods Receipt and reference Purchase Order does the same job. Both ask for the same core data:
- Enter the purchase order number, or search by supplier, material, or plant.
- Check each item: quantity, unit of measure, plant, and storage location.
- Set the item to OK (the Item OK checkbox in MIGO).
- Post, and note the material document number.
The movement type for a standard receipt against a purchase order is 101. The movement type controls the stock type, the accounts used, and which fields are required.
Key movement types
| Movement type | Meaning |
|---|---|
| 101 | Goods receipt for a purchase order |
| 102 | Reversal of a 101 |
| 103 | Receipt into GR blocked stock |
| 105 | Release from GR blocked stock |
| 122 | Return delivery to the supplier |
| 161 | Return delivery for a purchase order (returns PO) |
Do not reverse a posting with 102 when the goods really go back to the supplier. A reversal cancels a mistaken posting. A return (122) records a real event and keeps the history truthful.
What the posting creates
In S/4HANA, goods movements are stored in the table MATDOC. The old tables MKPF and MSEG now exist as compatibility views that read from it, so older reports keep working. Stock quantities are calculated from MATDOC rather than kept in separate aggregate tables. One consequence is that concurrent postings to the same material cause fewer database lock conflicts.
For a valuated material, the accounting entry in a typical case is:
| Account | Debit | Credit |
|---|---|---|
| Inventory (transaction key BSX) | Receipt value | |
| GR/IR clearing (transaction key WRX) | Receipt value |
The value is quantity times the order price. The invoice later clears the GR/IR account. The next chapter covers how the system finds these accounts.
The posting also adds an entry to the purchase order history table EKBE. Items with VGABE 1 are goods receipts. The PO item's received quantity is updated, and the PO shows how much is still open.
Account assignment items and non-stock items
Not every item goes to stock. The item category and account assignment decide the result:
- Stock material, no account assignment: the value goes to the inventory account.
- Consumable with account assignment (for example, a cost center): the value goes straight to expense. No stock is created.
- Non-valuated GR: only quantities are recorded. No accounting document is created, and the invoice posts the full value.
If the PO item is flagged for GR-based invoice verification, the invoice can only be matched against receipts, not against the order quantity. Check this flag before blaming the invoice side.
Over- and under-delivery
The PO item has an overdelivery tolerance and an underdelivery tolerance, set as percentages.
- A receipt above the ordered quantity plus the overdelivery tolerance is rejected with an error. If Unlimited overdelivery is set, any quantity is accepted.
- A receipt below the ordered quantity is accepted. Whether the PO stays open depends on the Delivery Completed indicator. It is set automatically when the quantity is inside the underdelivery tolerance, and you can also set it by hand. Once set, the system stops expecting further deliveries.
Posting a goods receipt with a BAPI
The standard function module is BAPI_GOODSMVT_CREATE. The code below posts a receipt of 10 pieces for one PO item. Replace the placeholder values with data that exists in your system.
DATA: lt_item TYPE STANDARD TABLE OF bapi2017_gm_item_create WITH EMPTY KEY,
lt_return TYPE STANDARD TABLE OF bapiret2 WITH EMPTY KEY,
ls_head TYPE bapi2017_gm_head_01,
ls_code TYPE bapi2017_gm_code,
ls_ret TYPE bapi2017_gm_head_ret.
ls_head = VALUE #( pstng_date = sy-datum doc_date = sy-datum ).
ls_code = VALUE #( gm_code = '01' ). " 01 = goods receipt for a purchase order
lt_item = VALUE #( ( po_number = '4500000001' po_item = '00010'
move_type = '101' mvt_ind = 'B'
plant = '1710' stge_loc = '171A'
entry_qnt = 10 entry_uom = 'EA' ) ).
CALL FUNCTION 'BAPI_GOODSMVT_CREATE'
EXPORTING
goodsmvt_header = ls_head
goodsmvt_code = ls_code
IMPORTING
goodsmvt_headret = ls_ret
TABLES
goodsmvt_item = lt_item
return = lt_return.
IF line_exists( lt_return[ type = 'E' ] ) OR line_exists( lt_return[ type = 'A' ] ).
CALL FUNCTION 'BAPI_TRANSACTION_ROLLBACK'.
ELSE.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT' EXPORTING wait = abap_true.
WRITE: / 'Material document', ls_ret-mat_doc, ls_ret-doc_year.
ENDIF.The indicator mvt_ind = 'B' tells the BAPI that the receipt refers to a purchase order. As with the purchase order BAPI, nothing is saved until you commit.
Common errors
- Posting date in a closed period. The material and accounting periods must both be open. Check the period settings for the company code, or post in the current period.
- Over-delivery rejected. The quantity exceeds the tolerance. Correct the quantity, or ask purchasing to change the tolerance on the PO item.
- PO not available for GR. The order may be blocked, not yet released, or the item may be flagged no goods receipt. A PO waiting for release approval cannot be received.
- Wrong storage location or plant. The receipt goes to the plant on the PO item. Change the storage location in the item, not the plant.
- Posting reversed with the wrong tool. Reverse a receipt with 102 only if no invoice has been posted against it for that quantity. Otherwise handle it as a return.
- Account not found. The valuation class of the material has no account for BSX or WRX. That is a configuration gap for the finance team, not a data entry problem.
Exercise
A PO item for 100 pieces has an overdelivery tolerance of 10%. The supplier delivers 115 pieces. What happens when you post movement type 101 for 115, and what would you do?
Show answer
The system rejects the posting with an error, because 115 is above the allowed 110. You can post 110 if the extra pieces are refused, or ask purchasing to raise the tolerance on the PO item. You can also return the surplus to the supplier. Do not use 102 to cut the quantity.
Exercise
Which accounts does a 101 posting for a valuated stock material debit and credit, and which table receives the PO history entry?
Show answer
It debits the inventory account (transaction key BSX) and credits the GR/IR clearing account (transaction key WRX). The history entry goes to EKBE with VGABE 1.