Professional Documents
Culture Documents
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 youre going to be able to run any SAP
transaction in mass, since you have the right to use that transaction.
Transaction LSMW:
Options:
LSMW allows you to do the creations/modifications using four different Methods. This tutorial
will use Batch Input Recording, because its the easiest to understand, and allows you to
simulate any standard or Z transaction.
Its 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 Objects 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, Ive chosen the transaction MM02, where we are going to change the
MATERIAL DESCRIPTION in mass.
(Its 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
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 = its the field name. I always use the technical name, but
you can choose any unique name no spaces).
Delete the following fields. Otherwise the system will replace ALL other Material with these
default values!
Select the field then press Delete Screen Field:
This is the final result, in the given example. Press Save (Ctrl-S) and Back (F3).
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 Structures header. Fill in with Name and Description.
Save it
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, were 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). Dont 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
Field Name = the same name youve put in the TXT file
Press F1
This is a little bit technical, but the all the path is described. Its pretty easy to arrive to this
information.
>> Repeat it to obtain Material Description lenght
MATNR field is created. Now repeat the same steps to create MAKTX (Material Description).
Also, now you know this fields length is 40.
Step is ready,
In the example, theres only one SOURCE Structure, and only one TARGET structure.
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). Thats
why I decided to use the same field names for the corresponding fields.
Material Number is done.
File = locate the file you created on Excel and saved it as Tab Delimited Text File
File Structure = Field Names at Start of File (Its possible to do only following the order,
but I prefer to put the names)
Theres 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
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).
Overview
In this step, system will convert the data in something that SAP can understand. In general,
theres 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
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.
Dont change the default information
You can only check the Keep batch input folder, if you dont want this session be deleted after
running it.
This is the result message
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: its 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, its much faster).
After running
to be sure, enter the Material Master, or run some report (Ive ran the MM60). You can see the
change in the material description:
Advertisements
Share this:
Facebook6
This entry was posted in LSMW, SAP - General use and tagged CO, FI, LSMW, MM, PP, QM,
SAP, SD. Bookmark the permalink.
Mass change Conversion Factor
How to migrate Queries problem solved!