SAP TUTORIAL  |  Data Migration (LSMW)

SAP LSMW: Legacy System Migration Workbench Tutorial

LSMW (Legacy System Migration Workbench) is a free, built-in SAP tool that simplifies moving data from a legacy or non-SAP system into SAP. It works like a structured, guided translator: you define how your legacy data maps onto SAP's data structures, and LSMW handles reading, converting, and loading that data through SAP's standard transaction processing. This guide walks through all 14 steps of LSMW with real screenshots from a material master (MM01) recording example, then goes deeper into when to use LSMW versus other migration methods, common errors, and a full prevention checklist. If you encounter any errors in SAP, feel free to send a screenshot to pramod@learntosap.com for help.

✅ What Is LSMW, and Why It's Still Widely Used

LSMW simplifies data migration by giving functional consultants a graphical, step-by-step interface, rather than requiring custom ABAP development for every migration project. It supports several distinct import methods - Batch Input Recording, Direct Input, BAPI, and IDoc - letting you choose the technique that best fits the specific SAP object you're loading, from material masters and customers to G/L accounts and HR records.

SAP LSMW transaction initial screen overview

🔧 Getting Started: Creating a Project, Subproject, and Object

Every LSMW migration is organized under a three-level hierarchy - Project, Subproject, and Object - which lets you group related migrations together (for example, all Finance data migration under one project) while keeping each individual migration task, like loading materials, as its own distinct object with its own 14-step configuration.

Create a Project

Enter transaction LSMW, type a project name, and select the New Entry button to create it.

SAP LSMW create new project screen SAP LSMW project name entry

Create a Subproject

Within the project, create a subproject to group a related set of objects.

SAP LSMW create subproject screen

Create an Object

Create the specific migration object - this is where you'll choose your import method (Batch Input Recording, Direct Input, BAPI, or IDoc) based on the SAP data type you're loading.

SAP LSMW create object screen with import method selection

Select Continue to proceed into the 14-step process.

SAP LSMW continue button after object creation

✅ The LSMW 14-Step Process, Overview

Once the object is created, LSMW presents its full 14-step process, walking you from defining the target transaction through to actually executing the load. Steps are typically completed top to bottom in order, though you can revisit earlier steps if something needs correcting.

SAP LSMW 14-step process overview screen
1

Maintain Object Attributes

Select Maintain Object Attributes and choose Execute. This is where you define the import method for this specific object - in this example, Batch Input Recording, which works by recording a real transaction (here, MM01 for material creation) and later replaying it automatically with data drawn from your legacy file.

SAP LSMW maintain object attributes execute screen SAP LSMW select batch input recording method

Select Display/Change, then choose the second option, Batch Input Recording, as the import method.

SAP LSMW display change batch input recording option

Select Recording Overview to see any existing recordings, or to create a new one.

SAP LSMW recording overview screen

Select Create Recording.

SAP LSMW create recording button SAP LSMW create recording name entry

Enter the transaction code you want to record - in this example, MM01 for material master creation.

SAP LSMW enter transaction code MM01 for recording SAP LSMW MM01 recording in progress

Select the Default All button to accept default field values for the recording, then save.

SAP LSMW default all fields button during recording

Once saved, select the back button to return to the object attributes screen with your new recording now attached.

SAP LSMW recording saved and attached to object
2

Maintain Source Structures

Select Execute to open the Maintain Source Structures step.

SAP LSMW maintain source structures execute screen SAP LSMW source structures overview screen

Select Create Structure and give it a name (for example, ZAC_SS) - this structure will represent the shape of your legacy data file.

SAP LSMW create source structure named entry
3

Maintain Source Fields

This step defines the individual fields within your source structure, matching the actual columns in your legacy data file.

SAP LSMW maintain source fields screen

Select Object Overview, then choose the relevant table to reference which fields the target transaction expects.

SAP LSMW object overview table selection

Select the table using Ctrl+Y, then copy it into Excel format for easier field-by-field review.

SAP LSMW select table with Ctrl Y for Excel copy SAP LSMW table copied to Excel format

Select Change, then Table Maintenance, and go to Excel to select and copy the source data.

SAP LSMW change button for table maintenance SAP LSMW table maintenance screen SAP LSMW selecting source data in Excel

Paste the copied field list into LSMW's source field table, then save.

SAP LSMW paste source fields into table
4

Maintain Structure Relations

This step links your newly created source structure to the SAP target structure that LSMW generated from your MM01 recording. Select the relationship and save.

SAP LSMW maintain structure relations screen SAP LSMW structure relationship selected and saved
5

Maintain Field Mapping and Conversion Rules

Select Execute, then Change, to enter field mapping mode.

SAP LSMW field mapping execute screen SAP LSMW field mapping change mode

In change mode, go to the Extras tab and select Auto Field Mapping, which lets LSMW automatically match source fields to target fields wherever the names correspond, saving considerable manual mapping time.

SAP LSMW extras tab auto field mapping option SAP LSMW auto field mapping results

Next, prepare your actual legacy upload data - copy the source data and paste it into a plain text file (Notepad), which will be read by LSMW during the file specification step.

SAP LSMW copy uploading data SAP LSMW paste data into notepad text file
6

Maintain Fixed Values, Translations, User-Defined Routines

This step is part of LSMW's standard 14-step process, sitting between field mapping and file specification, though it's easy to overlook since it doesn't always require action for a simple migration. It lets you define three additional kinds of transformation logic beyond a direct field-to-field mapping:

  • Fixed values - a constant value applied to every record, useful when a target field should always receive the same value regardless of what's in the legacy data (for example, always setting a specific plant or material status).
  • Translations - a lookup table converting a legacy code into its corresponding SAP code, useful when your legacy system used different codes for the same concept (for example, translating legacy unit-of-measure codes into SAP's standard units).
  • User-defined routines - custom ABAP logic for transformation needs too complex for a simple fixed value or translation table, such as conditional logic based on multiple source fields.

For straightforward migrations where source and target fields map directly with matching values, this step can be skipped entirely - it exists specifically for the more complex transformation scenarios that a simple field mapping alone can't handle.

7

Specify Files

Select Execute, then Change mode, to specify the legacy data file LSMW will read from.

SAP LSMW specify files execute screen SAP LSMW specify files change mode

Select Legacy Data File, then browse and select the text file prepared in the previous step.

SAP LSMW select legacy data file option SAP LSMW browse and select legacy file

Save, then select the Tabulator option to specify the file's delimiter format.

SAP LSMW save file specification SAP LSMW tabulator delimiter option
8

Assign Files

This step assigns the file specified in Step 7 to its corresponding source structure, confirming LSMW knows exactly which file feeds which structure.

SAP LSMW assign files screen SAP LSMW file assignment confirmation
9

Read Data

This step reads the legacy data file into LSMW's internal processing structures, based on all the configuration completed so far.

SAP LSMW read data execute screen SAP LSMW reading legacy data file SAP LSMW read data completion screen
10

Display Read Data

Review the raw data exactly as read from your legacy file, before any conversion or mapping has been applied. This is a useful checkpoint to catch a file format or delimiter issue early.

SAP LSMW display read data screen SAP LSMW raw legacy data display
11

Convert Data

This step applies the field mapping and any conversion rules or routines defined in Steps 5 and 6, transforming the raw legacy data into SAP-ready format.

SAP LSMW convert data execute screen SAP LSMW data conversion in progress SAP LSMW convert data completion
12

Display Converted Data

Review the fully converted data - this is your last checkpoint to confirm every field mapped and converted correctly before actually creating a batch input session that will post to SAP.

SAP LSMW display converted data screen SAP LSMW converted data review SAP LSMW converted data ready for batch input
13

Create Batch Input Session

This step generates a batch input session - a queued set of transactions ready to be executed against SAP, built from the converted data reviewed in Step 12.

SAP LSMW create batch input session screen SAP LSMW batch input session created confirmation
14

Run Batch Input Session

Select the session line, then select Process, choose Background, select Dynpro Standard Size, and select Process to execute the session - this is the step that actually creates your material master records (or whatever object you're migrating) in SAP.

SAP LSMW run batch input session process options SAP LSMW batch input session execution complete

🔄 LSMW's Four Import Methods: Which One to Choose

MethodHow It WorksBest Suited For
Batch Input RecordingRecords a real SAP transaction (like MM01) and replays it automatically with legacy dataSimple to medium-complexity objects where a stable, unchanging transaction screen exists; the method used throughout this guide
Direct InputUses predefined SAP programs built specifically for certain objects, bypassing the screen-by-screen recording approachObjects with a dedicated Direct Input program available (such as material master), generally faster and more robust than recording
BAPICalls a Business Application Programming Interface - a stable, supported API - to create or change dataObjects with a well-supported BAPI, offering better error handling and stability across SAP version upgrades than recording
IDocGenerates and posts Intermediate Documents, SAP's standard interface format for data exchangeScenarios integrating with existing IDoc-based interfaces, or objects where IDoc processing is the standard SAP-recommended approach

Batch Input Recording, used in this guide's example, is often the most approachable starting point for consultants new to LSMW, since it doesn't require knowing which BAPI or Direct Input program applies to a given object - you simply record the transaction screens as a normal user would complete them. However, Direct Input and BAPI methods are generally considered more robust for production migrations, since they're less sensitive to screen layout changes (such as a custom transaction variant or an SAP support pack altering screen fields) that can break a recording unexpectedly.

📱 LSMW vs. the SAP S/4HANA Migration Cockpit

For organizations working in or migrating to SAP S/4HANA, it's worth understanding how LSMW relates to the newer Migration Cockpit (transaction LTMC, or the equivalent Fiori app). SAP's official recommendation for new S/4HANA data loads is generally the Migration Cockpit, which uses predefined migration objects specifically validated against S/4HANA's simplified data model, offering built-in data validation and a more modern, guided experience than LSMW's screen-recording approach.

That said, LSMW remains genuinely useful in several scenarios: for SAP ECC systems not yet on S/4HANA, for migration objects the Migration Cockpit doesn't yet cover with a predefined object, or for organizations with existing, well-tested LSMW recordings from previous projects that don't need to be rebuilt from scratch. Many SAP consultants maintain proficiency in both tools, choosing whichever best fits the specific object and system version involved in a given project - understanding LSMW's step-by-step logic, as covered throughout this guide, also makes the conceptually similar Migration Cockpit easier to learn, since both tools address the same fundamental data migration challenge with different levels of built-in tooling.

🔒 Governance: Who Should Run LSMW Loads in Production

Because a batch input session executes real transactions against SAP - creating actual material masters, customers, or other records exactly as if a user had typed them in manually - LSMW access to production systems is typically restricted to a small group of data migration specialists or senior functional consultants, separate from general transaction access. A poorly tested recording or an incorrect field mapping doesn't just fail cleanly; it can create genuinely incorrect master data at scale, which is considerably more time-consuming to clean up after the fact than to prevent through careful testing beforehand.

Most organizations require any production LSMW load to be tested first against a sandbox or quality system with a representative data sample, with a documented sign-off before the same object/mapping is used against production - exactly the discipline reflected in this guide's prevention checklist. Given how much of LSMW's process depends on manual review (Display Read Data, Display Converted Data), having a second, independent reviewer check these outputs before Step 13 (Create Batch Input Session) is also a common, worthwhile control for anything beyond a small, low-risk load.

🧪 Why Testing in a Sandbox First Matters More Than It Seems

It's tempting, especially under project deadline pressure, to build an LSMW object once and move straight to a full production load, particularly if the first few test records looked correct. This guide's real-world scenario is a useful caution against that instinct - a recording that worked perfectly for weeks can break unexpectedly due to a completely unrelated system change, and the only way to catch that kind of issue before it affects thousands of real records is genuine testing against a representative volume, not just a handful of hand-picked samples.

A reasonable testing approach scales the sample size to the load's risk: for a small, low-volume load, testing a dozen or so representative records covering the range of data variations expected (different material types, different plants, different edge cases like missing optional fields) is often sufficient. For a large, business-critical load - migrating an entire customer base, or thousands of materials as in this guide's real-world scenario - testing against a much larger, statistically meaningful sample, run close in time to the actual planned production load (to minimize the window for an unrelated system change to intervene), meaningfully reduces risk.

Beyond just confirming records load without technical error, sandbox testing should also verify the loaded data is functionally correct - not just "the batch input session completed," but "the resulting material master actually behaves correctly in a subsequent transaction," such as creating a test purchase order or sales order against a newly loaded material to confirm downstream processes work as expected, not just that the initial load technically succeeded.

❗ Common Errors and Issues When Working With LSMW

💼 Real-World Scenario: A Recording That Broke Mid-Project

Smita Pawar, an SAP MM consultant, built an LSMW recording for MM01 early in a data migration project and successfully tested it against a small sample of test materials. Several weeks later, partway through the actual production load of several thousand materials, the batch input session began failing on nearly every record with a screen-sequence error that hadn't appeared during initial testing.

Investigating, Smita discovered that a transport applied to the production system in the intervening weeks - part of an unrelated project - had added a new custom field to the MM01 screen sequence via a screen exit, inserting an extra field the original recording had no awareness of. Because Batch Input Recording works by replaying an exact sequence of screen interactions, this seemingly unrelated screen change broke the recording's ability to navigate through MM01 correctly, even though the underlying data being loaded hadn't changed at all.

Smita re-recorded the MM01 transaction to include the new field (defaulting it appropriately for the migration), updated the field mapping to account for the change, and re-tested before resuming the production load. This scenario illustrates exactly why Batch Input Recording, while approachable, carries real fragility risk for longer migration projects - any screen layout change during the project timeline, even one unrelated to the migration itself, can silently break a recording, which is worth factoring into project risk planning, especially for migrations spanning many weeks where other unrelated system changes are likely to occur.

✅ Prevention Checklist for LSMW Projects

🎓 Interview-Style Questions and Answers

Q: What are the four import methods available in LSMW, and how do you choose between them?
Batch Input Recording, Direct Input, BAPI, and IDoc. The choice depends on the specific SAP object being loaded, available tooling for that object, and how long-lived or high-volume the migration is - Direct Input and BAPI are generally more robust for production use than recording.

Q: Why is Batch Input Recording considered more fragile than Direct Input or BAPI?
Because it works by replaying an exact sequence of screen interactions, any change to the target transaction's screen layout - even one unrelated to the migration project - can break the recording, as illustrated in this guide's real-world scenario.

Q: What is the purpose of separating Convert Data and Create Batch Input Session into two distinct steps?
Separating them lets you review the fully converted data (via Display Converted Data) before anything is actually queued for execution against SAP, providing a final checkpoint to catch mapping or conversion errors before live data creation.

Q: What is the difference between LSMW and the S/4HANA Migration Cockpit?
LSMW is SAP's older, general-purpose migration tool usable in both ECC and S/4HANA, based on recording, Direct Input, BAPI, or IDoc methods. The Migration Cockpit is S/4HANA's newer, purpose-built tool with predefined, validated migration objects, generally SAP's recommended approach for new S/4HANA implementations.

📚 Quick Glossary of LSMW Terms

🎯 Conclusion

LSMW remains one of the most accessible ways to migrate legacy data into SAP without custom ABAP development, thanks to its structured 14-step process covering everything from object attributes through batch input execution. Whether you're loading a handful of test materials or thousands of production records, working carefully through each step - especially the Display Read Data and Display Converted Data checkpoints - is what separates a smooth migration from a frustrating one. Keep this guide bookmarked as a reference for your next LSMW project.

❓ Frequently Asked Questions

LSMW (Legacy System Migration Workbench) is a free SAP tool used to migrate data from a legacy (non-SAP or old SAP) system into SAP, using a structured 14-step process covering object attributes, source data mapping, conversion rules, and batch input processing, without requiring custom ABAP development for most standard migration scenarios.
LSMW supports Batch Input Recording (recording a transaction like MM01 and replaying it with new data), Direct Input programs (predefined SAP programs for specific objects like material master), BAPI (Business Application Programming Interface calls), and IDoc (Intermediate Document) processing, each suited to different data objects and complexity levels.
No, not for most standard migrations. LSMW is designed to be usable by functional consultants without programming background, through its guided 14-step process. Basic ABAP knowledge becomes useful only for complex custom conversion routines in more advanced scenarios.
LSMW is SAP's older, general-purpose data migration tool, usable in both ECC and S/4HANA. The Migration Cockpit (LTMC) is S/4HANA's newer, purpose-built migration tool with predefined migration objects validated against S/4HANA's simplified data model. For new S/4HANA implementations, SAP recommends the Migration Cockpit; LSMW remains useful for objects the Migration Cockpit doesn't yet cover, or for ECC systems.
LSMW commonly uses a tab-delimited or comma-delimited text file exported from the legacy system or a spreadsheet, specified during the Specify Files step. The exact delimiter and structure must match what was defined in the Maintain Source Structures and Maintain Source Fields steps.
A batch input session is a queued set of transactions ready to be executed against SAP, created after data has been read and converted. Separating creation from execution lets you review the converted data (via Display Converted Data) before anything is actually posted to SAP, giving a final checkpoint to catch errors before live data creation.