MM Program Custom development Form

Subcontracting Dispatch, Dispatch Order Printout and Stock at Subcontractor Tracking Program

Short answer: A custom program that proposes the components of subcontracting purchase orders, posts the transfer to the subcontractor (541) in bulk, prints a dispatch order for each shipment and tracks, per subcontractor and document, the quantity sent, consumed and still at the subcontractor together with the finished quantity received back. The subcontracting process is run from one screen and period-end reconciliation with the subcontractor becomes easier.

Estimated effort
L · 10–15 working days
System
ECC and S/4HANA
Tables
9
Scope
Global
Built by
NeKuDos Teknoloji
Last updated

Why is the standard not enough?

ME2O monitors subcontracting components and can start the 541 transfer, but it does not send the components of several orders in one step with batch selection or print a dispatch order in the company layout; in MIGO every shipment is entered by hand. MBLB shows the stock at the subcontractor but does not show which shipment belongs to which order or the finished goods received back in the same list. The custom program combines dispatch, printout and tracking.

Who uses it? Subcontracting coordinators, purchasing, warehouse and production planning teams.

Closest standard alternatives

  • ME2O SC Stock Monitoring (Vendor). Monitors subcontracting components and starts the transfer; no bulk dispatch across orders and no corporate dispatch order.
  • MBLB Stocks at Subcontractor. Lists stock at the subcontractor; does not relate shipments to orders or to finished goods received back.

Tables used

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

TableRoleAccessSystem
EKPOPurchasing Document ItemOpen subcontracting order items (item category 3)ReadECC + S/4
RESBReservation/Dependent RequirementsComponent requirements of the subcontracting orderReadECC + S/4
MSLBSpecial Stocks with VendorComponent stock at the subcontractorReadECC + S/4
MCHBBatch StocksUnrestricted stock of the batches to sendReadECC + S/4
MKPFMaterial Document HeaderDispatch material document header (written via BAPI)WriteECC only
MSEGMaterial Document Item541 dispatch items; 542 and 543 movements for trackingRead / writeECC only
MATDOCMaterial Documents (S/4HANA)In S/4HANA the dispatch document is written to this tableRead / writeS/4HANA only
EKBEPurchasing Document HistoryFinished quantity received on the subcontracting orderReadECC + S/4
LFA1Vendor Master (General Section)Subcontractor name and address (dispatch order)ReadECC + S/4

S/4HANA notes

  • MSLB → MATDOC: In S/4HANA special stock at vendor is no longer persisted in MSLB; it is calculated from MATDOC and the name MSLB is read through the compatibility view NSDM_V_MSLB. Reading code keeps working, but the table must not be written directly.
  • MCHB → MATDOC: In S/4HANA batch stock quantities are calculated from MATDOC through a compatibility view; reads work, but test performance on 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. Transfers the components to the subcontractor with movement 541
  • BAPI_TRANSACTION_COMMITCommit a BAPI transaction. Commits the dispatch document
  • SSF_FUNCTION_MODULE_NAMEGet Smart Form Function Module Name. Finds the generated function name of the dispatch order form

Selection screen parameters

ParameterDescriptionTypeReference fieldRequiredExample
S_LIFNRSubcontractorRange / multipleEKKO-LIFNRYes100812
S_WERKSPlantRange / multipleEKPO-WERKSYes1000
S_EBELNSubcontracting orderRange / multipleEKPO-EBELNNo4500021501
S_EINDTDelivery dateRange / multipleEKET-EINDTNo16.11.2026 – 30.11.2026
P_MSLBDeduct stock at subcontractor from the proposalCheckbox—NoX
P_TESTTest mode (check without posting)Checkbox—NoX
R_TRACKTracking viewRadio button—No—

Result list columns

#ColumnSource
1SubcontractorMSLB-LIFNR
2OrderEKPO-EBELN
3ItemEKPO-EBELP
4Finished materialEKPO-MATNR
5ComponentRESB-MATNR
6BatchMSEG-CHARG
7Sent (541)Calculated Σ 541 − Σ 542 quantity
8Consumed (543)Calculated Σ 543 quantity
9Stock at subcontractorMSLB-LBLAB
10Finished receivedCalculated Σ EKBE goods receipt quantity
11Material documentMSEG-MBLNR
12StatusCalculated Sent, closed or error

Sample result list

SubcontractorOrderItemFinished materialComponentBatchSent (541)Consumed (543)Stock at subcontractorFinished receivedMaterial documentStatus
100812450002150110BR-2100SC-3300L2610-221,2007804207604900031240Sent, dispatch order printed
100812450002150120BR-2150SC-3310500050004900031240Sent
100905450002153310BY-0710HM-1001L2611-033003000295Closed
100905450002154010BY-0720HM-10010000Error: insufficient unrestricted stock (180 KG)
A view built with fictional sample data; not real system data.

How does the program work?

  1. Selection: open subcontracting order items (EKPO-PSTYP = 3) are read by subcontractor, plant and delivery date; the component requirements of each item come from RESB via order number and item.
  2. Proposed quantity to send = component requirement − quantity already sent; optionally the stock already at the subcontractor (MSLB) is deducted. The user corrects quantity and batch in the ALV; batches are proposed from unrestricted stock in MCHB.
  3. Posting: the selected lines are posted per subcontractor in one material document with the order-referenced 541 movement via BAPI_GOODSMVT_CREATE.
  4. A dispatch order form is printed for the resulting material document: subcontractor address, order, components, batches, quantities and packaging. Optionally the document is emailed as a PDF to the subcontractor.
  5. Tracking view: per subcontractor and material the quantity sent (541), consumed (543) and returned (542) with the current stock in MSLB; per order the finished quantity received (EKBE) and the open finished quantity.

Performance notes

Read RESB only for the selected order items via order number and item. In the tracking view, aggregate the 541/542/543 movements from MSEG once by subcontractor and date range; in S/4HANA this aggregation runs in the database on MATDOC.

Features

  • Test mode (check without posting)
  • Line-by-line result and error log
  • ALV list (sort, filter, subtotals) The dispatch proposal and tracking view are edited in an ALV.
  • Send the result by email The dispatch order can be emailed to the subcontractor as a PDF.
  • Export to Excel

Authorization objects

  • M_MSEG_BWAAuthorization for movement type 541
  • M_MSEG_WMBGoods movement authorization by plant
  • M_BEST_WRKOrder display authorization by plant

Frequently asked questions

Does the dispatch order replace the legal delivery note?

The dispatch order is an internal document showing which order the goods were sent for. If a legal delivery note or e-delivery note is required, the dispatch material document is passed to the existing delivery note integration; the program can be extended to trigger that step.

Can the stock at the subcontractor be tracked by batch?

Yes. MSLB keeps the stock at the subcontractor per batch; the tracking view shows sent and consumed quantities by batch. This makes it easier to trace which finished goods a batch-managed raw material went into.

Does it work on S/4HANA?

Yes. MSLB and MSEG are read as compatibility views in S/4HANA, the dispatch document is written to MATDOC and BAPI_GOODSMVT_CREATE is used the same way.

Related reports

MM Report Custom ALV report

Open Purchase Orders by Vendor Report

A custom ALV report that shows, per vendor, the quantity not yet received, the open order value and the days of delay since the delivery date in a …

EKKO · EKPO · EKET · LFA1

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: Subcontracting Dispatch, Dispatch Order Printout and Stock at Subcontractor Tracking Program