Mass Stock Transfer Upload Between Storage Locations, Bins and Materials
Short answer: 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.
- Estimated effort
- M · 6–9 working days
- System
- ECC and S/4HANA
- Tables
- 9
- Scope
- Global
- Built by
- NeKuDos Teknoloji
- Last updated
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.
Who uses it? Warehouse supervisors, inventory control teams, materials management users correcting stock after counts, and project warehouses.
Closest standard alternatives
Tables used
The tables the program reads and updates. ECC and S/4HANA differences are marked separately.
| Table | Role | Access | System |
|---|---|---|---|
| MKPFMaterial Document Header | Material document header: document and posting date, header text (ECC) | Write | ECC only |
| MSEGMaterial Document Item | Material document item: movement type, issuing/receiving storage location, receiving material (UMMAT) and batch (UMCHA) (ECC) | Write | ECC only |
| MATDOCMaterial Documents (S/4HANA) | Material document header and items (S/4HANA) | Write | S/4HANA only |
| MARDStorage Location Data for Material | Unrestricted, quality and blocked stock per storage location | Read | ECC + S/4 |
| MCHBBatch Stocks | Batch stock per storage location | Read | ECC + S/4 |
| MARAGeneral Material Data | Material type, base unit, deletion flag | Read | ECC + S/4 |
| T001LStorage Locations | Storage location definition and warehouse number assignment | Read | ECC + S/4 |
| LQUAQuants | LE-WM bin stock (source bin check) | Read | ECC + S/4 |
| /SCWM/AQUAEWM Available Quantity | EWM bin stock (result check in EWM warehouses) | Read | ECC + S/4 |
S/4HANA notes
- 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.
- 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.
- MCHB → MATDOC: In S/4HANA batch stock quantities are calculated from MATDOC through a compatibility view; reads work, but test performance on large selections.
BAPIs and functions used
- ALSM_EXCEL_TO_INTERNAL_TABLERead Excel File into Internal Table by Cell. Reads the Excel template
- BAPI_GOODSMVT_CREATEPost Goods Movement. Posts the transfer with GM_CODE 04; called with TESTRUN in the test run
- L_TO_CREATE_SINGLECreate Transfer Order with One Item. Creates bin-to-bin transfer orders in LE-WM warehouses
- BAPI_TRANSACTION_COMMITCommit a BAPI transaction. Saves a successful group
- BAPI_TRANSACTION_ROLLBACKRoll Back BAPI Transaction. Rolls back a failed group or the test run
Selection screen parameters
| Parameter | Description | Type | Reference field | Required | Example |
|---|---|---|---|---|---|
| P_FILE | Excel file | Single value | — | Yes | C:\transfer\depo_duzenleme.xlsx |
| P_BLDAT | Document date | Single value | MKPF-BLDAT | Yes | 18.11.2026 |
| P_BUDAT | Posting date | Single value | MKPF-BUDAT | Yes | 18.11.2026 |
| P_TEST | Test run (do not post) | Checkbox | — | No | X |
Input file columns
The columns of the upload template and the SAP fields they are written to. Columns with an asterisk are mandatory.
| # | Column | Target field | Required |
|---|---|---|---|
| 1 | Movement type | MSEG-BWART | Yes |
| 2 | Material | MSEG-MATNR | Yes |
| 3 | Plant | MSEG-WERKS | Yes |
| 4 | Issuing storage location | MSEG-LGORT | Yes |
| 5 | Batch | MSEG-CHARG | No |
| 6 | Receiving storage location | MSEG-UMLGO | No |
| 7 | Receiving material | MSEG-UMMAT | No |
| 8 | Receiving batch | MSEG-UMCHA | No |
| 9 | Source bin | LQUA-LGPLA | No |
| 10 | Destination bin | MSEG-LGPLA | No |
| 11 | Quantity | MSEG-ERFMG | Yes |
| 12 | Unit | MSEG-ERFME | Yes |
| 13 | Text | MSEG-SGTXT | No |
Sample upload file
| 1 | Movement type * | Material * | Plant * | Issuing storage location * | Batch | Receiving storage location | Receiving material | Receiving batch | Source bin | Destination bin | Quantity * | Unit * | Text |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2 | 311 | HM-10045 | 1000 | 0001 | 0005 | 120 | KG | Shelf reorganisation | |||||
| 3 | 309 | YP-20017 | 1000 | 0002 | P2611-04 | YP-20018 | P2611-04 | 40 | PC | Code merge | |||
| 4 | 999 | AM-30002 | 1000 | 0003 | 01-03-B | 02-11-A | 15 | BOX | Bin change | ||||
| 5 | 311 | HM-10077 | 2000 | 0001 | B2610-12 | 0004 | 600 | M |
Result list columns
| # | Column | Source |
|---|---|---|
| 1 | Row | Calculated Row number in the file |
| 2 | Movement type | MSEG-BWART |
| 3 | Material | MSEG-MATNR |
| 4 | From | Calculated Storage location / bin / material |
| 5 | To | Calculated Storage location / bin / material |
| 6 | Quantity | MSEG-ERFMG |
| 7 | Document | Calculated Material document (MSEG-MBLNR) or transfer order number |
| 8 | Status | Calculated Posted, test passed or error |
| 9 | Message | Calculated BAPI or check message |
Sample result list
| Row | Movement type | Material | From | To | Quantity | Document | Status | Message |
|---|---|---|---|---|---|---|---|---|
| 2 | 311 | HM-10045 | 1000 / 0001 | 1000 / 0005 | 120 | 4900112233 | Posted | Document created |
| 3 | 309 | YP-20017 | YP-20017 / P2611-04 | YP-20018 / P2611-04 | 40 | 4900112234 | Posted | Material-to-material transfer |
| 4 | 999 | AM-30002 | 01-03-B | 02-11-A | 15 | 0000045871 | Posted | Transfer order created |
| 5 | 311 | HM-10077 | 2000 / 0001 | 2000 / 0004 | 600 | Error | Not enough unrestricted stock in batch (available 450 M) |
How does the program work?
- 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.
- 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.
- 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.
- 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.
- 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.
- 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.
Performance notes
Read MARD and MCHB once for the list of materials and storage locations in the file (FOR ALL ENTRIES) instead of one SELECT per row. Groups go to the BAPI one by one; run files with thousands of rows in the background and commit after each group.
Features
- Export to Excel
- Test mode (check without posting) The test run calls the BAPI with TESTRUN; stock and authorization errors appear before posting.
- Line-by-line result and error log
- Download failed lines as a separate file Failed rows can be downloaded in the same template and uploaded again.
- Runs as a background job
Authorization objects
- M_MSEG_BWAGoods movement authorization by movement type
- M_MSEG_WWAGoods movement authorization by plant
- M_MSEG_LGOGoods movement authorization by storage location
- L_LGNUMLE-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.
Related reports
Material Document and Stock Movement Analysis Report by Movement Type, Storage Location and User
A custom ALV report that lists material documents with movement type, storage location, user and account assignment (cost center, order), matches …
Purchase Order Goods Receipt Upload from File Program
A custom interface program that posts order, item, quantity, storage location, batch and delivery note rows from a warehouse system, a supplier …
MB52 – List of Warehouse Stocks on Hand
MB52 is the standard SAP report (program RM07MLBS) that lists current material stocks per plant and storage location by stock type, together with …
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.