# Purchase Order Goods Receipt Upload from File Program

> A custom interface program that posts order, item, quantity, storage location, batch and delivery note rows from a warehouse system, a supplier delivery note file or Excel as goods receipts (101) for purchase orders in bulk. It never posts the same delivery note twice, checks in test mode first and lists the material document number of every row.

- Type: Program, Custom development, Interface
- Module: MM
- Estimated effort: M (4–6 working days)
- Last updated: 2026-11-17
- URL: https://nekuhub.com/en/programs/purchase-order-goods-receipt-upload-from-file-program/


## Why is the standard not enough?

MIGO posts each goods receipt on screen one at a time; MB01 in ECC also works one document at a time. There is no standard transaction that reads confirmed receipt rows from a file sent by an external warehouse system or handheld terminal, checks them against the open order quantity, prevents duplicate postings and runs as a nightly job. Busy warehouses therefore spend hours on manual MIGO entry.

### Closest standard alternatives

- MIGO: Posts a goods receipt on screen as one document; does not read a file and does not prevent duplicates.
- MB01: Posts goods receipts for orders one at a time in ECC; replaced by MIGO in S/4HANA.

## Tables used

| Table | Role | Access | Join | System |
|---|---|---|---|---|
| MKPF | Material document header: posting date, delivery note; also read for the duplicate check | Write | - | ECC + S/4 |
| MSEG | Material document item: order reference, quantity, storage location, batch | Write | MSEG-MBLNR = MKPF-MBLNR AND MSEG-MJAHR = MKPF-MJAHR | ECC + S/4 |
| EKBE | Order history: earlier receipts (open quantity) and the new receipt entry | Write | EKBE-EBELN = MSEG-EBELN AND EKBE-EBELP = MSEG-EBELP | ECC + S/4 |
| EKPO | Order item: quantity, tolerance, deletion and delivery completed flags | Read | EKPO-EBELN = MSEG-EBELN AND EKPO-EBELP = MSEG-EBELP | ECC + S/4 |

## BAPIs and functions used

- BAPI_GOODSMVT_CREATE: Posts the goods receipt for the order (101) as one document per delivery note
- BAPI_TRANSACTION_COMMIT: Saves successful goods receipts permanently
- BAPI_TRANSACTION_ROLLBACK: Rolls back changes in test mode or on error

## Selection screen parameters

| Parameter | Description | Type | Reference field | Required |
|---|---|---|---|---|
| P_FILE | File or server folder | Single value | - | Yes |
| P_SERVER | Read from application server | Checkbox | - | No |
| P_BWART | Movement type | Single value | MSEG-BWART | No |
| P_TEST | Test mode (check without posting) | Checkbox | - | No |
| P_SKIPD | Skip delivery notes already posted | Checkbox | - | No |

## Input file columns

| Column | Target field | Required |
|---|---|---|
| Purchase order | MSEG-EBELN | Yes |
| Item | MSEG-EBELP | Yes |
| Quantity | MSEG-ERFMG | Yes |
| Unit | MSEG-ERFME | No |
| Storage location | MSEG-LGORT | No |
| Batch | MSEG-CHARG | No |
| Posting date | MKPF-BUDAT | Yes |
| Document date | MKPF-BLDAT | No |
| Delivery note | MKPF-XBLNR | Yes |
| Header text | MKPF-BKTXT | No |

## Result list columns

| Column | Source |
|---|---|
| Row | Calculated: Row number in the file |
| Purchase order | MSEG-EBELN |
| Item | MSEG-EBELP |
| Material | MSEG-MATNR |
| Quantity | MSEG-ERFMG |
| Delivery note | MKPF-XBLNR |
| Material document | MKPF-MBLNR |
| Document year | MKPF-MJAHR |
| Status | Calculated: Posted, skipped (duplicate) or error |
| Message | Calculated: First error or success message from the BAPI return table |

## How does the program work?

1. The file is read from the user's PC or, in a background job, from a folder on the application server; each row carries order, item, quantity, unit, storage location, batch, posting date, document date, delivery note number and header text.
2. Checks: the EKPO item must exist, must not be deleted (LOEKZ) or delivery-completed (ELIKZ); open quantity = EKPO-MENGE − Σ EKBE goods receipts (VGABE = 1); the quantity must not exceed the over-delivery tolerance; batch-managed materials need a batch.
3. Duplicate check: if a non-reversed (MSEG-SMBLN) 101 movement already exists for the same delivery note (MKPF-XBLNR), order and item, the row is skipped.
4. Rows are grouped by delivery note, and for each delivery note BAPI_GOODSMVT_CREATE is called with movement code 01, movement type 101 and the order reference; in test mode it runs with the BAPI test flag and BAPI_TRANSACTION_ROLLBACK follows.
5. In a real run BAPI_TRANSACTION_COMMIT is done per delivery note; the material document and year (MBLNR, MJAHR) are written to the result list. The processed file is moved to an archive folder and failed rows are written to a separate file.

## Authorization objects

- M_MSEG_BWA: Goods movement authorization by movement type
- M_MSEG_WWA: Goods movement authorization by plant

## Frequently asked questions

### Can receipts be posted to quality inspection or blocked stock?

Yes. By adding a stock type column to the file, the receipt can be directed to unrestricted, quality inspection or blocked stock; for materials with active inspection the stock type comes from the material setting.

### Can the delivery completed flag be set from the file?

Yes. With an optional column, rows marked as final delivery send the delivery completed indicator to the BAPI and the order item is closed.

### Does the program work on S/4HANA?

Yes. BAPI_GOODSMVT_CREATE is also supported on S/4HANA and writes the document to MATDOC; the MKPF and MSEG reads work through compatibility views.

---
Let us build this program for your system: https://nekuhub.com/en/request-a-quote/?report=mm-goods-receipt-upload
