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

> 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.

- Type: Program, Custom development, Form
- Module: MM
- Estimated effort: L (10–15 working days)
- Last updated: 2026-11-17
- URL: https://nekuhub.com/en/programs/subcontracting-dispatch-order-and-stock-at-subcontractor-tracking/


## 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.

### Closest standard alternatives

- ME2O: Monitors subcontracting components and starts the transfer; no bulk dispatch across orders and no corporate dispatch order.
- MBLB: Lists stock at the subcontractor; does not relate shipments to orders or to finished goods received back.

## Tables used

| Table | Role | Access | Join | System |
|---|---|---|---|---|
| EKPO | Open subcontracting order items (item category 3) | Read | - | ECC + S/4 |
| RESB | Component requirements of the subcontracting order | Read | RESB-EBELN = EKPO-EBELN AND RESB-EBELP = EKPO-EBELP | ECC + S/4 |
| MSLB | Component stock at the subcontractor | Read | MSLB-LIFNR = EKKO-LIFNR AND MSLB-MATNR = RESB-MATNR AND MSLB-WERKS = RESB-WERKS | ECC + S/4 |
| MCHB | Unrestricted stock of the batches to send | Read | MCHB-MATNR = RESB-MATNR AND MCHB-WERKS = RESB-WERKS | ECC + S/4 |
| MKPF | Dispatch material document header (written via BAPI) | Write | - | ECC only |
| MSEG | 541 dispatch items; 542 and 543 movements for tracking | Read / write | MSEG-MBLNR = MKPF-MBLNR AND MSEG-MJAHR = MKPF-MJAHR | ECC only |
| MATDOC | In S/4HANA the dispatch document is written to this table | Read / write | - | S/4HANA only |
| EKBE | Finished quantity received on the subcontracting order | Read | EKBE-EBELN = EKPO-EBELN AND EKBE-EBELP = EKPO-EBELP | ECC + S/4 |
| LFA1 | Subcontractor name and address (dispatch order) | Read | LFA1-LIFNR = MSLB-LIFNR | ECC + S/4 |

## BAPIs and functions used

- BAPI_GOODSMVT_CREATE: Transfers the components to the subcontractor with movement 541
- BAPI_TRANSACTION_COMMIT: Commits the dispatch document
- SSF_FUNCTION_MODULE_NAME: Finds the generated function name of the dispatch order form

## Selection screen parameters

| Parameter | Description | Type | Reference field | Required |
|---|---|---|---|---|
| S_LIFNR | Subcontractor | Range / multiple | EKKO-LIFNR | Yes |
| S_WERKS | Plant | Range / multiple | EKPO-WERKS | Yes |
| S_EBELN | Subcontracting order | Range / multiple | EKPO-EBELN | No |
| S_EINDT | Delivery date | Range / multiple | EKET-EINDT | No |
| P_MSLB | Deduct stock at subcontractor from the proposal | Checkbox | - | No |
| P_TEST | Test mode (check without posting) | Checkbox | - | No |
| R_TRACK | Tracking view | Radio button | - | No |

## Result list columns

| Column | Source |
|---|---|
| Subcontractor | MSLB-LIFNR |
| Order | EKPO-EBELN |
| Item | EKPO-EBELP |
| Finished material | EKPO-MATNR |
| Component | RESB-MATNR |
| Batch | MSEG-CHARG |
| Sent (541) | Calculated: Σ 541 − Σ 542 quantity |
| Consumed (543) | Calculated: Σ 543 quantity |
| Stock at subcontractor | MSLB-LBLAB |
| Finished received | Calculated: Σ EKBE goods receipt quantity |
| Material document | MSEG-MBLNR |
| Status | Calculated: Sent, closed or error |

## 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.

## Authorization objects

- M_MSEG_BWA: Authorization for movement type 541
- M_MSEG_WMB: Goods movement authorization by plant
- M_BEST_WRK: Order 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.

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