LSMW in SAP S/4HANA, in short
LSMW, the Legacy System Migration Workbench (transaction LSMW), loads flat files into SAP in 14 steps for a recording object, through one of four import methods: batch or direct input, batch input recording, BAPI or IDoc. It still runs in S/4HANA on-premise, but SAP Note 2287723 says loading S/4HANA with it is "not recommended and at the customer's own risk".
- SAP's tool for the initial S/4HANA load is the Migration Cockpit. S/4HANA Cloud, public edition has no LSMW at all.
- For the loads that keep arriving after go-live, PostNow.ai posts from Excel. It uses a BAPI or a recorded transaction under the user's own SAP login and writes SAP's message back to each row.
What is LSMW in SAP?
LSMW, the Legacy System Migration Workbench, is a workbench in SAP, not a load program. It pays to be exact about that, because it decides which LSMW jobs move to PostNow.ai and which belong in the Migration Cockpit. Transaction LSMW walks you through a fixed list of steps that read a file, map it to SAP fields, convert it and hand it to one of SAP's own posting routes. LSMW never posts anything itself: at the end there is always a batch input session, a direct input program or an IDoc doing the work.
Everything lives in a three-level tree that you pick on the first screen. The project is usually one per migration or functional area (ZMIG_S4, say). The subproject groups related loads, such as all MM master data. The object is one load, such as material basic data, and the steps belong to the object. Objects can be exported from one system and imported into another, which is how many of them travelled from ECC into S/4HANA without anyone re-recording them.
The part of LSMW that took real thinking is the mapping in steps 5 and 6: which source field feeds which SAP field, plus the fixed values, translations and small ABAP routines that convert legacy values. That mapping is worth keeping when an object is retired, even when the object itself is not. The LSMW alternatives guide covers how to inventory an estate and pull the mapping out before you switch it off.
What are the four LSMW import methods?
LSMW has four import methods: batch input recording, standard batch or direct input, business object method (BAPI) and IDoc. In LSMW you choose the method in step 1, and it decides what you map to in steps 4 and 5 and what the last steps are. PostNow.ai posts through two of the same routes, a BAPI or a recorded transaction, but posts one document at a time, calling the BAPI over RFC or replaying the recording with CALL TRANSACTION, instead of generating a session or IDocs, so the table below doubles as a map of what carries over.
| Import method | You map to | What posts the data | Last steps of the object | Watch out for |
|---|---|---|---|---|
| Batch input recording | The fields of a recording you make of the transaction, e.g. MM01 | A batch input session, processed in SM35 | Create Batch Input Session, Run Batch Input Session | Works for almost any SAP GUI transaction, but only for the screens as recorded |
| Standard batch / direct input | SAP's load structure for a standard object, e.g. object 0020 Material master with program RMDATIND | A batch input session or a direct input program | Create and run a session, or start the direct input program | Only exists for the objects SAP shipped a program for |
| Business object method (BAPI) | A BAPI picked as business object and method, e.g. BUS1001006 / SAVEDATA, which is BAPI_MATERIAL_SAVEDATA | IDocs generated from your data, then processed by the BAPI | Start IDoc Generation, Start IDoc Processing, Create IDoc Overview, Start IDoc Follow-Up | No screens involved, so screen changes do not break it; needs IDoc inbound settings first |
| IDoc | An inbound IDoc message type and basic type | Standard IDoc inbound processing | The same four IDoc steps | Only for objects that already have an inbound IDoc |
The two IDoc-based methods need a one-time setup in each system, under Settings > IDoc Inbound Processing in LSMW: a file port, a partner type and a partner number (LSMW guides use type US), then Activate IDoc Inbound Processing. Skip it and the first IDoc step fails with a missing-partner message. Recording-based objects need none of this, which is one reason most LSMW objects in the wild were built on recordings.
LSMW steps: the 14 steps of a batch input recording object
A batch input recording object in LSMW has 14 steps, from Maintain Object Attributes to Run Batch Input Session. LSMW shows every possible step until step 1 fixes the method; a recording object then shows these 14. If you have built a PostNow.ai template, steps 2 to 5 will look familiar: the Excel header row does the job of the source structure and source fields, and the mapping pane does the job of structure relations and field mapping. Some releases label them "Define ..." instead of "Maintain ...". The order is the same.
Maintain Object Attributes
Name the object, choose Batch Input Recording, and create or pick the recording from the recordings overview. Changing the method later means redoing every step that follows, so settle it here.
Maintain Source Structures
Declare the shape of the incoming file: one structure for a flat file, or a header structure with an item structure under it.
Maintain Source Fields
List each column with a type and length. Table maintenance lets you paste the whole list at once, which saves an afternoon on a 60-column file.
Maintain Structure Relations
Connect each source structure to the target it feeds. For a recording the target is the recording itself.
Maintain Field Mapping and Conversion Rules
For every target field, say where the value comes from: a source field, a constant, a translation or a routine. Extras > Auto Field Mapping proposes matches by name. If no source fields appear here at all, step 3 or 4 is incomplete.
Maintain Fixed Values, Translations, User-Defined Routines
Reusable conversion assets: a named constant, a legacy-to-SAP value table, or a small ABAP form. Objects in the same project can share them.
Specify Files
Point LSMW at the file, either on your PC (frontend) or on the application server, and describe it: delimiter (usually tab), whether field names sit in the first row, and the code page.
Assign Files
Attach each file from step 7 to a source structure from step 2. With header and item files, this is where you say which is which.
Read Data
LSMW reads the file into its own storage. You can limit it to a range of records, which is how you test on three rows before running three thousand. Nothing in SAP changes yet.
Display Read Data
Check the records as read. A shifted column, a wrong delimiter or a header row read as data shows up here.
Convert Data
Apply the rules from steps 5 and 6 and produce records in the target layout. Still nothing posted.
Display Converted Data
The last look before anything is created. A translation that did not fire or a constant left blank shows up as an empty or wrong target field.
Create Batch Input Session
Generate the session from the converted data: one transaction per record, queued but not yet run. Tick Keep batch input folder(s) if you want the session kept in
SM35after it has been processed.Run Batch Input Session
Process the session in
SM35, in the foreground, with errors only, or in the background. The session log shows each transaction and its messages. A record that fails stops only its own transaction, and the rest of the session carries on.
Business object (BAPI) and IDoc objects swap steps 13 and 14 for four IDoc steps: Start IDoc Generation, Start IDoc Processing, Create IDoc Overview and Start IDoc Follow-Up. You read the result from the IDoc status instead of a session log: 53 means the application document was posted, 51 means it was not.
How to run a recording-based LSMW: a material master example
We use the same three materials later on the page to show the PostNow.ai version of this load, so you can compare the two directly. The job: create basic data for three new finished goods through MM01 in an S/4HANA on-premise test client.
| Setting | Value |
|---|---|
| Project / subproject / object | ZMIG_S4 / MM / MAT_BASIC |
| Import method | Batch Input Recording |
| Recording | ZMM01_BASIC, transaction MM01 |
| Source structure | ZMAT_SRC (one flat structure) |
| File | mat_basic.txt on the PC, tab-delimited, field names in row 1 |
The source file has one row per material:
| MATNR | MBRSH | MTART | MAKTX | MEINS | MATKL |
|---|---|---|---|---|---|
| TG-1001 | M | FERT | Gear housing 40 mm | EA | GEAR |
| TG-1002 | M | FERT | Gear housing 60 mm | EA | GEAR |
| TG-1003 | M | FERT | Drive shaft 12 mm | EA | SHAFT |
- Record (step 1). Create recording
ZMM01_BASICforMM01. On the initial screen enter materialTG-1001, industry sectorMand material typeFERT. In Select View(s) tick only Basic Data 1, then enter the description, base unitEAand material group, and save. Back in the recording, use Default All so every field you touched gets a field name, and remove anything you will not map. Assign the recording to the object. - Declare the file (steps 2 and 3). Create
ZMAT_SRCwith fieldsMATNR(C 40),MBRSH(C 1),MTART(C 4),MAKTX(C 40),MEINS(C 3) andMATKL(C 9). DeclareMATNRas 40 characters even if your numbers are short today; see the S/4HANA section for why. - Map (steps 4 to 6). Relate
ZMAT_SRCto the recording and run Auto Field Mapping. Check the result field by field:MATNRtoRMMG1-MATNR,MBRSHtoRMMG1-MBRSH,MTARTtoRMMG1-MTART,MAKTXtoMAKT-MAKTX,MEINStoMARA-MEINS,MATKLtoMARA-MATKL. The legacy groups GEAR and SHAFT are not SAP material groups, so add a translation in step 6 (GEAR toL001, SHAFT toL002) and use it in theMATKLrule. - Attach the file (steps 7 and 8). Specify
mat_basic.txtas legacy data on the PC, tab as separator, field names at the start of the file. Assign it toZMAT_SRC. - Read and convert (steps 9 to 12). Read the file and confirm three records. Convert, then open the converted data and check that
MATKLshowsL001andL002, not the legacy codes. - Post (steps 13 and 14). Create the session with Keep batch input folder(s) ticked. In
SM35, process it once with Display errors only and the default screen size, so screens look the way they did when you recorded. Once three transactions show as processed, openTG-1001inMM03and check the description and material group.
Two things catch people on this object. First, the Select View(s) popup is recorded by line position (the field is MSICHTAUSW-KZSEL(01) for the first line). If another material type or user shows the views in a different order, the same recording ticks a different view. Keep one material type per object, or re-record. Second, a session that processed cleanly can still hold wrong data if a screen gained or lost a field since the recording was made. That is why you check the result in MM03, not just the log.
Is LSMW available in S/4HANA? Its status under SAP Note 2287723
Yes, LSMW is still available in SAP S/4HANA on-premise and private cloud, under the same transaction LSMW, but not in S/4HANA Cloud, public edition. SAP Note 2287723, which covers LSMW in S/4HANA on-premise, says using it to load data into S/4HANA is "not recommended and at the customer's own risk". SAP's recommended tool for migrating data into S/4HANA is the Migration Cockpit. If you use LSMW anyway, the job of proving the data is consistent is yours. PostNow.ai templates post through a BAPI or a recorded transaction directly, so this status only affects the LSMW objects you already own.
| System | LSMW present? | SAP's position | SAP's tool for the initial load |
|---|---|---|---|
| SAP ECC | Yes | Standard tool | LSMW, among others |
| S/4HANA on-premise and private cloud | Yes | Not recommended for loading S/4HANA; at the customer's own risk (Note 2287723) | Migration Cockpit (Migrate Your Data app) |
| S/4HANA Cloud, public edition | No | Not available | Migration Cockpit |
An object that worked in ECC is not a working object in S/4HANA until it has run in an S/4HANA test client and someone has checked the output. BAPI-based objects hold up best, because a BAPI has no screens, but they need that test too. Recording-based objects usually break in one of these three places.
Customer and vendor recordings
In S/4HANA, customers and suppliers are maintained as business partners in transaction BP, and XD01, XK01 and their siblings hand over to BP. A recording of the classic transaction has nothing left to replay against. Re-recording in BP does not help either, because SAP does not support batch input for BP. The load has to move to the Migration Cockpit's business partner objects or to a BAPI-based route. The customer master upload guide covers what changes.
Screens that changed
A recording stores values by screen and field. Where S/4HANA moved a field or added a screen, the session either stops with a batch input error or, worse, completes with a value in the wrong place. Transactions that moved to Fiori apps are out of reach entirely, because there are no SAP GUI screens to record. The BDC recording guide covers how to record so a replay holds up.
The 40-character material number
S/4HANA extended MATNR from 18 to 40 characters in the database. The longer number is off by default and has to be activated, and purely numeric material numbers stay limited to 18. An LSMW object that declared an 18-character source field cuts off anything longer once the extension is switched on, so check steps 3 and 5 on every object that carries a material number.
LSMW errors you will meet, and the fix
PostNow.ai shows SAP's message next to the Excel row that caused it. LSMW shows the same SAP messages, but you find them in the SM35 session log or the IDoc status records. These are the ones that come up most on LSMW objects.
| Message or symptom | Where you see it | What it means | Fix |
|---|---|---|---|
00 344 No batch input data for screen & & | Session log in SM35 | The transaction showed a screen the recording did not expect. Typical causes are a changed screen sequence, a different material type or user settings. | Process the session in the foreground to see which screen appears, then re-record with the same settings the load will use. |
00 349 Field ... does not exist in dynpro ... | Session log | The recording fills a field that is not on that screen any more, often after an upgrade or a field status change. | Re-record the transaction in the target system and redo the mapping for the changed screen. |
| No source fields appear in field mapping | Step 5 | The source structure, its fields or the structure relation is missing. | Complete steps 2 to 4, then return to step 5. |
| "There is no partner ... of type ..." | Start IDoc Generation or Processing (BAPI and IDoc methods) | IDoc inbound processing is not set up for this system. | Settings > IDoc Inbound Processing: maintain port, partner type and partner number, and activate inbound processing. |
| IDoc status 51, application document not posted | Create IDoc Overview, or WE02 | The BAPI rejected the data. The status record carries the application message. | Correct the data or customising, then reprocess with Start IDoc Follow-Up or BD87. |
XD01 or XK01 hands over to BP | Session in S/4HANA | Customer and supplier maintenance runs through the business partner. | Move the load to the Migration Cockpit or a BAPI-based route. Do not try to record BP. |
| The session ran without errors, but the data is wrong | Only in the result | A screen changed and a value landed in another field, or a translation did not fire. | Compare step 12 with the posted record (MM03, SE16N), then fix the mapping or re-record. |
When to keep an LSMW object and when to move it
Keep a working LSMW object while you stay on ECC, and move it when you convert to S/4HANA, when it breaks, or when it loads customers or suppliers. PostNow.ai covers the recurring loads that land on finance and master data teams after go-live; the Migration Cockpit covers the cutover itself. Pick by the job, not by habit. The LSMW alternative guide compares the replacements in more depth and covers retiring an existing LSMW estate; SAP data loads after go-live covers the deltas, corrections and new records that follow a cutover.
| Your situation | Use | Why |
|---|---|---|
| Recurring loads after go-live from Excel: new materials, price or master data changes, journals, reposting failed rows | PostNow.ai, with a BAPI template or a recorded transaction | The person who owns the data runs it from Excel under their own SAP login, and the result comes back per row. No session, IDoc or project to maintain. |
| Initial load into a new S/4HANA system | SAP S/4HANA Migration Cockpit | SAP's tool for this, with delivered migration objects, staging tables and direct transfer. SAP's FAQ says it was designed for the initial load, and changing data already in the system is not its scope. See the Migration Cockpit guide. |
| You are staying on ECC and an LSMW object still works | Keep the LSMW object | Rebuilding a working load gains nothing until the conversion. Document its mapping now, while the person who built it is still around. |
| Converting ECC to S/4HANA and you own LSMW objects | Review each object: retire it, move it to the Migration Cockpit (cutover) or to a BAPI-based Excel template (recurring) | Note 2287723 puts any LSMW use in S/4HANA at your own risk, and recordings of changed transactions fail. The SAP data migration guide covers planning the move. |
| Customers or suppliers in S/4HANA | Migration Cockpit business partner objects (initial load), or a BAPI-based route for ongoing changes | XD01 and XK01 hand over to BP, and BP does not support batch input. |
| S/4HANA Cloud, public edition | Migration Cockpit | LSMW is not available there. |
How PostNow.ai handles the loads LSMW used to run
PostNow.ai keeps the useful half of LSMW, the mapping, and drops the read, convert and session steps. Here are the same three materials from the example above, loaded through BAPI_MATERIAL_SAVEDATA:
- Pick the route. In BAPI mode, search the function module by name in your system and select
BAPI_MATERIAL_SAVEDATA. For a transaction with no suitable BAPI, record it instead: PostNow.ai records throughSHDBand replays the recording with CALL TRANSACTION inside SAP, started from SAP GUI on your computer, so recording mode needs SAP GUI scripting enabled. - Map the columns. Map the Excel columns to the BAPI fields: material, industry sector and material type in
HEADDATA, base unit and material group inCLIENTDATA, and the description and language inMATERIALDESCRIPTION. Set the basic view flag as a default value. PostNow.ai fills the matching X structure (CLIENTDATAX) for you. Convert GEAR and SHAFT toL001andL002in the sheet itself, for example with a lookup column. - Validate. Validate checks the file without calling SAP: required fields, type, length, characters, date format, decimals and allowed values. Errors are marked on the cell and in the Run Log. Opt-in Pre-Validation also checks that values such as the material group exist in SAP.
- Simulate. In BAPI mode, Simulate calls the BAPI and then issues
BAPI_TRANSACTION_ROLLBACK, so you see SAP's own answer without creating anything. - Run. Each document is committed only if SAP returns no error or abort message. Otherwise it is rolled back. Every row gets SAP's message in the Run Log column. If you press Run again, rows already marked as posted are offered as Skip posted rows, Post again or Cancel.
- Fix and retry. Correct the rows marked ERROR and use Retry Failed, which re-posts only those rows. It scans from the current Start Row, so set Start Row back to 2 after a pilot.
PostNow.ai replaces steps 9 to 14 of the LSMW object with a direct post, because there is nothing to stage. The data goes from the sheet to SAP one document at a time, and the answer lands next to the row that caused it. A designer builds the template; operators get a published, run-only copy. The SAP mass upload guide covers choosing BAPI or recording per object.
What to plan for when you move an LSMW load
Plan for these points when you move an LSMW load to PostNow.ai:
- Use the LSMW mapping as the specification. Build the PostNow.ai template from your step 5 and 6 mapping: map the BAPI fields, or record the transaction again.
- Convert legacy codes in the sheet. PostNow.ai per-field rules cover trim, default value, leading zeros, uppercase and date format. Do legacy-to-SAP code mapping, the job of LSMW translations and routines, in the sheet before you post.
- Use the Migration Cockpit for the initial S/4HANA load. PostNow.ai runs the loads that come after go-live.
- Stop keeps what is already posted. Documents posted before you press Stop stay in SAP, as they would with a half-processed LSMW session.
- Install the recording function modules once. BAPI mode installs nothing in SAP; it needs RFC access and the user's normal authorisations for the object. Recording mode uses PostNow.ai's
ZPOSTNOW_*ABAP objects, installed once per system, and SAP GUI scripting on the user's computer. Recordings replay with synchronous update, so each row's message is written after SAP's update has finished. - Prefer a BAPI where one exists. A PostNow.ai recording follows the screens as recorded, just like an LSMW recording. Where a BAPI exists, it is the safer choice in S/4HANA.
Frequently asked questions
Can I replace an LSMW recording with an Excel upload in S/4HANA?
What is LSMW in SAP?
Is LSMW available in S/4HANA?
What are the 14 steps of LSMW?
What are the four import methods in LSMW?
How do I create an LSMW recording?
Why does my LSMW object fail after moving to S/4HANA?
What is the difference between LSMW and the Migration Cockpit?
Load it from Excel instead
PostNow.ai posts through a BAPI or a recorded transaction under your own SAP login, and writes SAP's message back to every row.

