PM Program Custom development Interface

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

Short answer: 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.

Estimated effort
M · 5–7 working days
System
ECC and S/4HANA
Tables
6
Scope
Global
Built by
NeKuDos Teknoloji
Last updated

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.

Who uses it? Maintenance storeroom leads, maintenance planners and warehouse teams that pick spare parts with handheld terminals.

Closest standard alternatives

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

Tables used

The tables the program reads and updates. ECC and S/4HANA differences are marked separately.

TableRoleAccessSystem
RESBReservation/Dependent RequirementsMaintenance order reservations: open quantity and final issue (updated by the BAPI)Read / writeECC + S/4
AFIHMaintenance Order HeaderReservation belongs to a maintenance orderReadECC + S/4
AUFKOrder Master DataOrder object number (released/TECO check)ReadECC + S/4
MARDStorage Location Data for MaterialUnrestricted stock in the storage locationReadECC + S/4
MKPFMaterial Document HeaderMaterial document headerWriteECC + S/4
MSEGMaterial Document ItemMaterial document item: movement 261, order, reservationWriteECC + S/4

S/4HANA notes

  • MARD → MATDOC: In S/4HANA stock quantities are no longer stored physically; reading MARD returns values calculated on the fly from MATDOC through a compatibility view. Reads still work, but test performance on very large selections.
  • MKPF → MATDOC: In S/4HANA new material documents are written to MATDOC; reading MKPF works through a compatibility view. Use MATDOC or I_MaterialDocumentItem_2 directly in new reports.
  • MSEG → MATDOC: In S/4HANA MATDOC replaces MSEG; reading MSEG works through a compatibility view but is slow at high volumes.

BAPIs and functions used

  • BAPI_GOODSMVT_CREATEPost Goods Movement. Posts the 261 goods issue with reservation reference
  • BAPI_TRANSACTION_COMMITCommit a BAPI transaction. Saves successful documents permanently
  • BAPI_TRANSACTION_ROLLBACKRoll Back BAPI Transaction. Rolls back in test mode and for failed groups

Selection screen parameters

ParameterDescriptionTypeReference fieldRequiredExample
P_PATHInbound file folder (application server)Single value—Yes/interface/pm/pick_in/
P_BUDATPosting date (blank = today)Single valueMKPF-BUDATNo—
P_BWARTMovement typeSingle valueMSEG-BWARTYes261
P_FINALSet final issue on full pickCheckbox—NoX
P_TESTTest mode (check without posting)Checkbox—No—

Input file columns

The columns of the upload template and the SAP fields they are written to. Columns with an asterisk are mandatory.

#ColumnTarget fieldRequired
1ReservationMSEG-RSNUMYes
2Reservation itemMSEG-RSPOSYes
3Maintenance orderMSEG-AUFNRNo
4MaterialMSEG-MATNRYes
5Picked quantityMSEG-MENGEYes
6PlantMSEG-WERKSNo
7Storage locationMSEG-LGORTYes
8BatchMSEG-CHARGNo

Sample upload file

1Reservation *Reservation item *Maintenance orderMaterial *Picked quantity *PlantStorage location *Batch
2000048211000014001302SP-1045210000050
3000048211000024001302SP-2210110000050
4000048213500014001303SP-0890410000050B2026-114
A view built with fictional sample data; not real system data.

Result list columns

#ColumnSource
1RowCalculated Row number in the file
2Maintenance orderMSEG-AUFNR
3ReservationRESB-RSNUM
4MaterialRESB-MATNR
5Picked quantityMSEG-MENGE
6Open after postingCalculated RESB-BDMNG − RESB-ENMNG − picked quantity
7Material documentMSEG-MBLNR
8StatusCalculated Posted, test passed, on hold (no stock) or error
9MessageCalculated BAPI return message or check error

Sample result list

RowMaintenance orderReservationMaterialPicked quantityOpen after postingMaterial documentStatusMessage
240013020000482110SP-1045204900073311PostedFinal issue set
340013020000482110SP-2210114900073311PostedPartial issue, reservation open
440013030000482135SP-089044On holdUnrestricted stock in storage location 0050 is 1 PC
A view built with fictional sample data; not real system data.

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.

Performance notes

Run the program as a background job every 10–15 minutes; each run processes only new files. Do the RESB and MARD checks in one read with the reservation and material list from the file. To avoid lock errors on the same material, the job should run as a single instance.

Features

  • Test mode (check without posting)
  • Line-by-line result and error log
  • Download failed lines as a separate file Failed and held rows are written to a separate file and retried in the next run.
  • Runs as a background job The program is scheduled as a background job running every 10–15 minutes.

Authorization objects

  • M_MSEG_BWAPost goods movements by movement type
  • M_MSEG_WWAPost 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.

Packages that include this solution

PM Package Custom

Maintenance Notification-to-Confirmation Pack

A five-component pack that speeds up maintenance work from notification to confirmation: open notifications without an order, mass maintenance order …

5 components · v1.0

Related reports

PM Report Custom ALV report

Spare Parts Consumption and Cost by Equipment Report

A custom ALV report that totals goods issues to maintenance orders by equipment and functional location, showing which equipment consumes which spare …

MSEG · AUFK · AFIH · ILOA

Let us build this program for your system

Briefly describe your system and expectations. We will clarify the scope and come back with an effort and price quote.

Related report: Automatic Spare Parts Goods Issue to Maintenance Orders from Warehouse Pick Confirmation (Interface)