# Automatic Spare Parts Goods Issue to Maintenance Orders from Warehouse Pick Confirmation (Interface)

> A custom interface program that reads pick confirmations from a warehouse or handheld system and posts goods issues with movement type 261 against maintenance order reservations. It checks reservation, quantity and stock, keeps the reservation open for partial picks, sets the final issue for full picks and lists the material document or error of each row.

- Type: Program, Custom development, Interface
- Module: PM
- Estimated effort: M (5–7 working days)
- Last updated: 2026-11-17
- URL: https://nekuhub.com/en/programs/spare-parts-goods-issue-to-maintenance-order-from-pick-confirmation/


## Why is the standard not enough?

Goods issue to a maintenance order is done by hand in MIGO by entering the reservation number. Although the warehouse picks the part and hands it to the technician, the issue is entered late or not at all; order costs remain incomplete, stock looks wrong and reservations stay open. The standard has no step that turns a pick confirmation into an order goods issue automatically. The custom interface closes this gap.

### Closest standard alternatives

- MIGO: Posts the goods issue against the reservation by hand on screen; does not process pick confirmations automatically.
- MB1A: Older goods issue transaction; requires entry one by one.

## Tables used

| Table | Role | Access | Join | System |
|---|---|---|---|---|
| RESB | Maintenance order reservations: open quantity and final issue (updated by the BAPI) | Read / write | RESB-RSNUM = dosya rezervasyon AND RESB-RSPOS = dosya kalem | ECC + S/4 |
| AFIH | Reservation belongs to a maintenance order | Read | AFIH-AUFNR = RESB-AUFNR | ECC + S/4 |
| AUFK | Order object number (released/TECO check) | Read | AUFK-AUFNR = RESB-AUFNR | ECC + S/4 |
| MARD | Unrestricted stock in the storage location | Read | MARD-MATNR = RESB-MATNR AND MARD-WERKS = RESB-WERKS AND MARD-LGORT = dosya depo yeri | ECC + S/4 |
| MKPF | Material document header | Write | MKPF-MBLNR = yeni belge | ECC + S/4 |
| MSEG | Material document item: movement 261, order, reservation | Write | MSEG-MBLNR = MKPF-MBLNR AND MSEG-MJAHR = MKPF-MJAHR | ECC + S/4 |

## BAPIs and functions used

- BAPI_GOODSMVT_CREATE: Posts the 261 goods issue with reservation reference
- BAPI_TRANSACTION_COMMIT: Saves successful documents permanently
- BAPI_TRANSACTION_ROLLBACK: Rolls back in test mode and for failed groups

## Selection screen parameters

| Parameter | Description | Type | Reference field | Required |
|---|---|---|---|---|
| P_PATH | Inbound file folder (application server) | Single value | - | Yes |
| P_BUDAT | Posting date (blank = today) | Single value | MKPF-BUDAT | No |
| P_BWART | Movement type | Single value | MSEG-BWART | Yes |
| P_FINAL | Set final issue on full pick | Checkbox | - | No |
| P_TEST | Test mode (check without posting) | Checkbox | - | No |

## Input file columns

| Column | Target field | Required |
|---|---|---|
| Reservation | MSEG-RSNUM | Yes |
| Reservation item | MSEG-RSPOS | Yes |
| Maintenance order | MSEG-AUFNR | No |
| Material | MSEG-MATNR | Yes |
| Picked quantity | MSEG-MENGE | Yes |
| Plant | MSEG-WERKS | No |
| Storage location | MSEG-LGORT | Yes |
| Batch | MSEG-CHARG | No |

## Result list columns

| Column | Source |
|---|---|
| Row | Calculated: Row number in the file |
| Maintenance order | MSEG-AUFNR |
| Reservation | RESB-RSNUM |
| Material | RESB-MATNR |
| Picked quantity | MSEG-MENGE |
| Open after posting | Calculated: RESB-BDMNG − RESB-ENMNG − picked quantity |
| Material document | MSEG-MBLNR |
| Status | Calculated: Posted, test passed, on hold (no stock) or error |
| Message | Calculated: BAPI return message or check error |

## How does the program work?

1. Pick confirmations are read as CSV from a folder on the application server or from a staging table/service; each row contains reservation, item, material, quantity, storage location and batch.
2. RESB confirms the reservation item exists, is not deleted and has no final issue flag (XLOEK and KZEAR blank), and that the material matches the row; AFIH confirms the reservation belongs to a maintenance order, and the AUFK-OBJNR status that the order is released and not TECO.
3. Open quantity = BDMNG − ENMNG; if the picked quantity exceeds it, the row fails as 'over-pick'. If unrestricted stock (LABST) in MARD for the storage location is not sufficient, the row is put on hold.
4. Valid rows are grouped by order and posted with BAPI_GOODSMVT_CREATE using movement code '03', movement type 261 and the reservation reference; if the pick covers the open quantity, the final issue flag is set.
5. In test mode the call is rolled back with BAPI_TRANSACTION_ROLLBACK; in a real run each order group is committed separately and the new MKPF/MSEG document number is written to the row.
6. The processed file is moved to an archive folder; failed rows are written to an error file and can be retried in the next run.

## Authorization objects

- M_MSEG_BWA: Post goods movements by movement type
- M_MSEG_WWA: Post goods movements by plant

## Frequently asked questions

### How does it work in systems that use warehouse management (WM/EWM)?

In storage locations with warehouse management, the issue is completed by confirming the transfer order or warehouse task; the interface is then adapted to confirm the warehouse task instead of posting the pick confirmation directly through the BAPI.

### Are unplanned issues without a reservation processed?

The base version only accepts issues with a reservation reference, so every issue is tied to a planned requirement. For unplanned issues, a 261 posting with the order number can be added under a separate approval rule.

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

Yes. BAPI_GOODSMVT_CREATE is supported on S/4HANA; the material document is written to the MATDOC table in S/4HANA, and MKPF and MSEG can still be read as compatibility views.

---
Let us build this program for your system: https://nekuhub.com/en/request-a-quote/?report=pm-spare-parts-issue-from-pick-confirmation
