Creating an LSMW (with ABAP Coding)

LSMW i.e. Legacy System Migration Workbench is a tool that supports the transfer of data from non-SAP systems (“Legacy Systems”) to SAP R/3 systems. This can be a one-time transfer as well as a periodic one.

In simple words, if you have a transaction to do, let, for example, update a particular field in let VA02 (Sales Order Change), and you have to do the same thing for multiple Sales Orders in VA02, then LSMW is your tool to do that. You, of course, have MASStransaction, but LSMW has got its own benefits.


  • It is faster.
  • You can run it in the background, foreground and also trigger a stop event in case there is an error.
  • It generates a log in the end.
  • You can write ABAP code for custom validations.
  • You can pass constants, add prefixes/ suffixes to your data record.
  • etc.

Now, let us see, how do we do that?

Steps to follow:

1. Enter the TCode LSMW.

2. Enter a Project, Subproject and Object name. They can be same as in my case, and you can make it different. Some like creating one Project and then adding one Subproject after another.

3. Click on the Create icon next to Execute button and enter a breif description of your LSMW.

4. Now click on execute as highlighted.

5. An LSMW has 13 steps as you can see in the screenshot below:

6. Double click on the individual item or click on Execute button to enter into the steps.

STEP : 1 Define Object Attributes Select the “Batch Input Recording” and click on the highlighted button to create a recording.

Create Recording.

Give a name to your recording.

Enter the Transaction Code/ the TCode.

Record your steps and click on “Save”, and this is how your screen would look like after you save the Transaction. This where you can cross-check if all of your fields have been recorded successfully or not. Even the data records entered can be seen.

Without a miss, click on “Default All”.

If you wish to remove unwanted fields which got captured while you were recording, then select the field, and click on the highlighted button to remove from selection.

“Save” and come back to see the below screen.

Now, come back and select the Recording Field, and click F4 to fetch the Recording which you just recorded.

STEP : 2 Define Source Structures.

Now, the system should automatically take you to the next step.

Now, create a Structure, and mention a decription for it.

STEP : 3 Define Source Field

Before entering to this step, click on “Object Overview”.

Click on “Table” button.

Now, copy the below content to an excel sheet. Why? You are going to know that in the coming steps.

Now, go back and double click on your 3rd step and below is the screen that you should be able to see. Select the Structure and click on the highlighted button.

Now, copy the field names, length and other details from your excel sheet into this structure. Click on Save and come back to the enter into the next step.

STEP : 4 Define Structure Relations.

In this step, you just need to assign your Recording from Step 1, to the Structure you created in Step 2.

STEP : 5 Define Field Mapping and Conversion Rules.

This is a very crucial step, where you are supposed to assign source. This is the stage where you can assign Constants, add Prefix/ Suffix, and even ABAP Code for Custom Validations.

Select the field and then click on “Source Field” as highlighted to assign the Source Field.

Select the relevant Source Field

To write ABAP Code, select the field and click on Rule.

Select ABAP Code.

Write your custom validations and click on Save.

The next step is not required. I have never used it below. If you have, then please mention in the comments below.

Thus this completes your LSMW creation, the remaining steps are just where you make a data format in .txt file, and upload it to your system, Read, Convert and start the activity running the session of uploading the data.

Read More: What is SAP Certification?

Leave a Reply

Your email address will not be published. Required fields are marked *