# Mass Stock Transfer Upload Between Storage Locations, Bins and Materials

> A program that posts storage location to storage location, bin to bin and material to material stock transfers in bulk from one Excel template. Every row is pre-checked for stock, batch and authorization, a test run shows the outcome, the real run creates the material documents and failed rows are written to a separate file.

- Type: Program, Custom development, Mass upload
- Module: MM
- Estimated effort: M (6–9 working days)
- Last updated: 2026-11-18
- URL: https://nekuhub.com/en/programs/mass-stock-transfer-upload-storage-locations-bins-materials/


## Why is the standard not enough?

MIGO and MB1B make you enter transfers item by item; reorganising a warehouse, closing a storage location or merging material codes with hundreds of rows takes hours, and when something fails it is unclear which rows were posted. LT01 and the EWM screens also move stock between bins one at a time. The standard has no mass transfer tool that reads a file, checks stock availability before posting and returns a result per row.

### Closest standard alternatives

- MIGO: Posts transfers on screen item by item; does not read a file or pre-check in bulk.
- MB1B: Transfer posting screen in ECC; also needs one document and manual entry.
- LT01: Creates bin-to-bin transfer orders one at a time in LE-WM.

## Tables used

| Table | Role | Access | Join | System |
|---|---|---|---|---|
| MKPF | Material document header: document and posting date, header text (ECC) | Write | - | ECC only |
| MSEG | Material document item: movement type, issuing/receiving storage location, receiving material (UMMAT) and batch (UMCHA) (ECC) | Write | MSEG-MBLNR = MKPF-MBLNR AND MSEG-MJAHR = MKPF-MJAHR | ECC only |
| MATDOC | Material document header and items (S/4HANA) | Write | - | S/4HANA only |
| MARD | Unrestricted, quality and blocked stock per storage location | Read | MARD-MATNR = MSEG-MATNR AND MARD-WERKS = MSEG-WERKS AND MARD-LGORT = MSEG-LGORT | ECC + S/4 |
| MCHB | Batch stock per storage location | Read | MCHB-MATNR = MSEG-MATNR AND MCHB-CHARG = MSEG-CHARG | ECC + S/4 |
| MARA | Material type, base unit, deletion flag | Read | - | ECC + S/4 |
| T001L | Storage location definition and warehouse number assignment | Read | - | ECC + S/4 |
| LQUA | LE-WM bin stock (source bin check) | Read | - | ECC + S/4 |
| /SCWM/AQUA | EWM bin stock (result check in EWM warehouses) | Read | - | ECC + S/4 |

## BAPIs and functions used

- ALSM_EXCEL_TO_INTERNAL_TABLE: Reads the Excel template
- BAPI_GOODSMVT_CREATE: Posts the transfer with GM_CODE 04; called with TESTRUN in the test run
- L_TO_CREATE_SINGLE: Creates bin-to-bin transfer orders in LE-WM warehouses
- BAPI_TRANSACTION_COMMIT: Saves a successful group
- BAPI_TRANSACTION_ROLLBACK: Rolls back a failed group or the test run

## Selection screen parameters

| Parameter | Description | Type | Reference field | Required |
|---|---|---|---|---|
| P_FILE | Excel file | Single value | - | Yes |
| P_BLDAT | Document date | Single value | MKPF-BLDAT | Yes |
| P_BUDAT | Posting date | Single value | MKPF-BUDAT | Yes |
| P_TEST | Test run (do not post) | Checkbox | - | No |

## Input file columns

| Column | Target field | Required |
|---|---|---|
| Movement type | MSEG-BWART | Yes |
| Material | MSEG-MATNR | Yes |
| Plant | MSEG-WERKS | Yes |
| Issuing storage location | MSEG-LGORT | Yes |
| Batch | MSEG-CHARG | No |
| Receiving storage location | MSEG-UMLGO | No |
| Receiving material | MSEG-UMMAT | No |
| Receiving batch | MSEG-UMCHA | No |
| Source bin | LQUA-LGPLA | No |
| Destination bin | MSEG-LGPLA | No |
| Quantity | MSEG-ERFMG | Yes |
| Unit | MSEG-ERFME | Yes |
| Text | MSEG-SGTXT | No |

## Result list columns

| Column | Source |
|---|---|
| Row | Calculated: Row number in the file |
| Movement type | MSEG-BWART |
| Material | MSEG-MATNR |
| From | Calculated: Storage location / bin / material |
| To | Calculated: Storage location / bin / material |
| Quantity | MSEG-ERFMG |
| Document | Calculated: Material document (MSEG-MBLNR) or transfer order number |
| Status | Calculated: Posted, test passed or error |
| Message | Calculated: BAPI or check message |

## How does the program work?

1. The user fills in the template: movement type, material, plant, issuing storage location, batch, receiving storage location or receiving material, receiving batch, optional source and destination bin, quantity, unit and text. The file is read with ALSM_EXCEL_TO_INTERNAL_TABLE.
2. Every row is checked: do the material and plant exist in MARA/MARC, is the issuing storage location defined in T001L, is the unrestricted stock in MARD (MCHB for batch-managed materials) sufficient, and does the total quantity exceed stock when the same stock is used in several rows of the file. For material-to-material transfers (309) the base unit and batch management of both materials are compared.
3. Movement types are limited to a list allowed during installation (for example 311 storage location to storage location, 309 material to material, 301 plant to plant). The user's authorization for movement type and plant is checked before posting.
4. In the real run, rows are grouped by issuing storage location and document date, and each group is posted as one material document with BAPI_GOODSMVT_CREATE (GM_CODE 04); BAPI_TRANSACTION_COMMIT follows each successful group. In the test run the same BAPI is called with TESTRUN and nothing is saved.
5. For LE-WM managed storage locations, bin-to-bin rows (with a WM movement type such as 999 in the movement type column) create a transfer order with L_TO_CREATE_SINGLE; stock in the source bin is checked in LQUA. In EWM managed warehouses a bin transfer is a warehouse task in EWM; the program routes these rows to EWM and verifies the result in /SCWM/AQUA.
6. The result list shows the material document or transfer order number, status and message per row. Failed rows can be downloaded to a separate file in the same template layout, corrected and uploaded again. In S/4HANA the material document is written to MATDOC; because the program only uses the BAPI, no change is needed.

## Authorization objects

- M_MSEG_BWA: Goods movement authorization by movement type
- M_MSEG_WWA: Goods movement authorization by plant
- M_MSEG_LGO: Goods movement authorization by storage location
- L_LGNUM: LE-WM warehouse number authorization (bin transfers)

## Frequently asked questions

### Can one file contain both storage location and material transfers?

Yes. The movement type is given per row; the program groups rows by movement type, issuing storage location and date and creates a separate material document for each group.

### If one row fails, are the others posted?

Posting happens per group. If a row in a group fails, that group is rolled back and the other groups are posted. If preferred, the installation can be set so that every row becomes its own document.

### How does it work in warehouses that use EWM?

In EWM, stock at bin level is kept in EWM. Storage location transfers are posted in ERP and passed to EWM; bin-to-bin moves are created as EWM warehouse tasks. The program looks at each row's storage location and routes it to the right side.

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