LSMW – tutorial (using Recording)

LSMW (Legacy System Migration Workbench) is a powerful tool to execute mass transactions, specially Data Migration.

In this tutorial, I will give you an example, the simplest I could find. This will allow you to create your first LSMW mass change, and then you’re going to be able to run any SAP transaction in mass, since you have the right to use that transaction.

So, let’s start it:

Transaction LSMW:


LSMW allows you to do the creations/modifications using four different Methods. This tutorial will use “Batch Input Recording”, because it’s the easiest to understand, and allows you to simulate any standard or Z transaction.

It’s possible to use other objects, like batch/direct input or BAPIs. I will take this subject in next posts.

Creating a Batch Input Recording

Batch Input Recording is like a Macro, a single instruction that expands automatically into a set of instructions to perform a particular task. To create a Batch Input Recording, first you need to create a Project/Subproject/Object.

You can choose by clicking “Possible Entries (F4)”, or create a new Project and Subproject, according to the classification you need.

Project and/or Subproject are just folders. To create each of one, system will ask you for the name and a small description.

Fill in the Object’s Name and Description

Go to “Recordings”

Now the Object is created, you can go “Goto > Recordings (Ctrl+F2)” to record the macro:

Click on “Create Recording (Ctrl+F1)”:

Add Name/Description:

Add transaction code

System will ask you which transaction you want to run, while it is recording. You are going to perform a real SAP transaction, so be prepared with data you really want to create or change.

For this example, I’ve chosen the transaction MM02, where we are going to change the MATERIAL DESCRIPTION in mass.

(It’s possible to do this in a Quality Assurance System and export to you Production System, but again this will be object of another post on this blog)

The system runs the Transaction MM02 (in the given example)

You start to use the transaction MM02, and the system is recording your steps at the same time.

Select View

In the given example, only “Basic Data 1” is enough

Change the Material Description

and press “Save (Ctrl-S)”

System shows you the recording

Now you need to do a little edition in the recording.

All steps are shown, to allow you to change. Please double-click in “RMMG1-MATNR” to allow edition:

(This is the material number you just entered. It will be probably different from this example)

Fill in the fields:

  • Fill in the “Name” (Name “1” = it’s the field name. I always use the technical name, but you can choose any unique name – no spaces).
  • Name “2” = It’s a description.
  • Default value: it’s filled with the value you used in example. Usually you should erase this value, because it’s going be substituted with all the values in the table you’re going to prepare.


Do the same with the field MAKTX


Delete the following fields. Otherwise the system will replace ALL other Material with these default values!

Select the field then press “Delete Screen Field”:

yes, the selection is just that rectangular cursor…

Do it for all the fields you don’t want to change in mass!

This is the final result, in the given example. Press “Save (Ctrl-S)” and “Back (F3)”.

(The field “MSICHTAUSW-KZSEL(01)” is the confirmation for “BDC_OKCODE”. It represents the “Enter” key you put after choosing the Material View. You should keep this one).

This is the all the recordings in your project.

Press “Back (F3)” to go back to the main screen.

Press “Continue (F8)” to create the Object features:

Step by step

In this screen, you see all the steps for customizing and executing the LSMW. Select “Maintain Object Attributes” and click on “Execute (Ctrl+F8)”

Click “Display <-> Change”

Every step you enter, the default is “Display”. Click on this button to allow changes.

Select “Batch Input Recording” Method

and fill in with the recording name you just created. Click “Save (Ctrl-S)”

Maintain Source Structures

Maintain Source Structures

every transaction enter in mode “Display”, so you need to click the button to change it:

Create new Source Structure

Create new Source Structure

This step is only the Structure’s header. Fill in with Name and Description.

Save it

And click “Back (F3)”.

Maintain Source Fields

The Source Structure is also composed by the Fields:

Click “Change <-> Display (Ctrl+F1)”

You can see the Source Structure already. For it, you are going to create the fields. But which fields? In our case, there should be two fields in the Source Structure: Material Number and Material description. Next step will illustrate it better.

Create a list in Excel:

In the example, we’re going to use these fields: “Material Number” and “Material Description”.

Create a file in Excel, with the following header and a list of Material Numbers already existent and the new descriptions:

Save the spreadsheet as “Tab Delimited Text File”:

(just open in Notepad to better visualization). Don’t forget to close it, or SAP will throw an error message.

Back to create Source Fields

Now you are going to create two fields, with the same name you have chosen in the .txt file.

Click on the Source Structure, then “Create New Source Field”

Then fill in:

  • Field Name = the same name you’ve put in the TXT file
  • Field Description = Some description
  • Field Lengh = this could be tricky. I stop the tutorial now to explain you how to obtain this exactly number…
  • Field Type = use always “C” (Charachter)

>> How to obtain the Field Lenght, for any field:

  • Go to the original transaction (MM02 – in the given example)
  • Click on the input box “Material”
  • Press “F1”

>> Click on “Technical Information”

Then double-click on “Data Element” name (in the example: MATNR)

>> Here you can see the lenght!

This is a little bit technical, but the all the path is described. It’s pretty easy to arrive to this information.

>> Repeat it to obtain “Material Description” lenght

technical name: MAKTX

Back to LSMW:

MATNR field is created. Now repeat the same steps to create MAKTX (Material Description). Also, now you know this field’s length is 40.

Step is ready,

Save and “Back (F3)”

Maintain Structure Relations

Structure Relations

In the example, there’s only one SOURCE Structure, and only one TARGET structure.

Just save and click “Back (F3)”.

Maintain Field Mapping and Conversion Rules

Again, click on “Display <-> Change”

Create mapping

Select MATNR, then click “Assign Source Field (Ctrl-F2)”, a pop-up window will open where you can choose the source field corresponding to the Targed Field. Select MATNR (0001). That’s why I decided to use the same field names for the corresponding fields.

Material Number is done.

Next step is to do the Material Description

Step is done

Save it and “Back (F3)”

Maintain Fixed Values, Translations, User-Defined Routines

We are not using on this example

Specify files

Again, click on “Display <-> Change”

Double-click on “Legacy Data”

Fill in this form

  • File = locate the file you created on Excel and saved it as “Tab Delimited Text File”
  • Name = just copy the file name
  • File Contents = Data for One Source Structure (Table)
  • Delimiter = Tabulator (because you’ve chosen “Tab Delimited Text File”)
  • File Structure = Field Names at Start of File (It’s possible to do only following the order, but I prefer to put the names)
  • File Type = Record End Marker (Text file)
  • Code Page = ASCII

Step is Done

Save it and “Back (F3)”

Assign Files

It’s already done

There’s only one file, so nothing to do here. Just save and “Back (F3)”

Read Data

This is an important step. If you need to repeat this data loading, you will start here.

“Read Data” will read all data from the TXT file and copy to SAP memory.

You can choose the rows to be read from your file, or read it all

To read it all, just click on “Execute (F8)”

Import Data Log

Display Read Data

Display Read Data

Again you can choose which lines will be shown.

This is a very important step. Here you can check if the data in SAP is the same as in your original TXT file. Also, if the order is correct (a common mistake).


And you can click on any line to see it on detail:

Do it 3 or 4 times

just to be sure, if your data seems correct.

Convert Data

Again, it’s possible to choose which lines will be converted.

In this step, system will convert the data in something that SAP can understand. In general, there’s no big change. But if you are dealing with currency, decimal places (point or comma), if the value needs to be filled with zeros on the left, etc… this step is necessary.

Convert Data Log

Just check the log, if the conversion was alright.

Display Converted Data

Choose which lines you want to see, or just run it.


and you can click in any line to see detailed information.

Converted Data: detailed view

Again, I strongly sugest that you do it in 3 or 4 lines, to be sure that your data is correct. This is the data that will be input in SAP transaction.

Create Batch Input Session

This step will create a file (a SAP internal file) with all the instructions to change the data, and all the data you input. This is called a “Batch input Session”.

Don’t change the default information

You can only check the “Keep batch input folder”, if you don’t want this session be deleted after running it.

This is the result message

if everything ran perfectly.

In this case, it created one transaction for each data row from your original TXT file.

Run Batch Input Session

Session Overview

As there is only one session created by you, select it and click “Process”.

Choose the Processing Mode

If you want to see how the computer works, do it on Foreground. Do it in the first time: it’s nice to see it. But only if there are few (1 or 2) rows in your original file. After that, it will be just boring.

If you are doing a big data load, do it in Background (in addition, it’s much faster).

After running…

Select the session and click “Log”

Then, “Analyze session”:

Also, click on “Log created on DD.MM.YYYY” to see a detailed log


Run a report:

to be sure, enter the Material Master, or run some report (I’ve ran the MM60). You can see the change in the material description:

This entry was posted in LSMW, SAP - General use and tagged , , , , , , , . Bookmark the permalink.

1 Response to LSMW – tutorial (using Recording)

  1. Pingback: LSMW – tips and tricks 1 | super SAP user

Comments are closed.