You are on page 1of 24

LSMW-Legacy System Migration Workbench

By - Sneha Sawardekar, Techvantage IT Solutions Pvt Ltd.


LSMW is a tool provided by SAP which is used to transfer legacy data i.e.
NON SAP data to SAP R/3 system.
This process can be done once or periodically.
LSMW offers four methods to import data in a convenient manner
1.
2.

Standard/ Batch Input : Standard upload Programs


Batch Input Recording : Here you can create a recording of your own
and use it to upload / change data
3.
BAPIs : Standard BAPIs are used to upload Data
4.
IDOCs : Any Inbound IDOC function modules can be used to process
the data
Based on the requirement we try to find a suitable method to be processed.
If it is a standard Master we can find it in the first method, Otherwise we try
to use BAPIs or Idocs. If the requirement is a very custom one we use a
recording to process the data.
Significance of LSMW

Data Migration comes at the end of SAP implementation. At this stage


SAP installation is finished.
Before staring data migration, configurations must be fully completed.
Data Migration involves 20 to 40% of total implementation expenses.

LSMWs can be copied from one client to another client by using the
Export and Import option. The steps are detailed below.

Export Project - In the initial screen of the LSMW, select Extras


Export project. This first displays the structure tree of the selected
project. Via Select / Deselect you can select whether the entire project
or parts of the project are exported. Then select Export. The program
then creates an ASCII file.

Import Project - The exported mapping and rules can be imported


into another SAP system by using Import Project option. On the
selection screen, select Extras -> Import. The program then prompts

you to enter the name of the PC file. The file is imported and the
contents are analyzed. After the analysis, a list of the subprojects and
objects found is displayed.

During LSMW 3 main steps are involved.


1.Import data Legacy data into spreadsheets.
2.Convert data from source format to target format.
3.Import data into db of R/3 application

LSMW can be performed in foreground and background


If executed in foreground, user gets to check error and can be
corrected then and there.
If executed in background All errors are stored and continue till the
last record. Once transfer is complete we can check errors using
Analysis Tab.

Tcode for LSMW process is LSMW.


Here we are following the process for Material creation tcode MM01. Material
will be uploaded and can be viewed at the end in table MARA.

LSMW workbench shows the following information

Project : An ID with a maximum of 10 characters to name your data


transfer project. If you want to transfer data from several legacy systems,
you may create a project e.g. for every legacy system.
Subproject: An ID with a maximum of 10 characters that is used as a
further structuring attribute.

Object : An ID with a maximum of 10 characters to name the business


object.

Enter Project ID , Subproject ID , Object ID. Click Execute The next screen
gives the STEPS in your LSMW data Migration.
There is one project for every legacy system.

Execute

Step 1 : Maintain Object Attributes

Here we can specify type of transfer which can be once or can be done
periodically.
Object type and Import methods gives us four choices.
1.
2.
3.
4.

Standard Batch/Direct Input


Batch Input Recording
BAPI
IDoc

In our example we will be using option 2. Batch Input recording.Mention


name of the recording and press
This will let us create new recording if the given recording name doesnt
exist.

Mention for which Tcode we will be recording

After this the recording will begin. Enter all desired fields which will also be
present in the source data(legacy data).

Once the recording is complete, the following screen is displayed.

Here, you can edit the default values and enter your default values.
For eg : for RMMG1-MATNR, default value is FG123. But this can be edited
and made as MATNR.As shown in fig below.
Similarly all other fields can also be edited and default values can be set.

Save and press Back to go to main menu.


This will take us to Step 2 : Maintain Source attributes

Execute.

We can create a source structure here.This will be the structure containing all
desired fields which are required in uploading the legacy data.
We will be creating structure MM01STR in our example.

Save and press Back to go to main menu


Step 3: Maintain source fields

Execute
Create source fields one by one as shown below.

Or use the Table maintenance icon to create all fields together.

Save and following screen is displayed showing all the created fields.

Step 4: Maintain Structure Relations

Execute.
This step comes by default. Because we have only structure defined here.

Save and Go Back to main screen.


Step 5: Maintain Field Mapping and Conversion Rules.

Execute.

By selecting each field in the list, Assign Source Field.


After all fields are assigned, following screen is displayed.

Also, Validations can be performed in this step.


Using
, go to change layout mode and select all check boxes. Double click
on Global data, ABAP editor is opened.
Here we can declare various fields and internal tables.
Double click on BEGIN_OF_TRANSACTION block (this block will trigger for
every new transaction), and write the validation code.
In this example we can validate the material number and other details. If the
material number is invalid then this material record is stored in an internal
table.

Skip further execution of the record using the Global function


skip_transaction (Insert->Global Function-> skip_transaction). This
statement will skip the current record and goes to the next record.
Double click on the END_OF_PROCESSING block (this block will trigger after
conversion of all the transactions), and write the code to download and
display the error records as shown below. Function GUI_DOWNLOAD is used
to transfer internal table values into word file.
The error records will download to the specified file path when we execute
the convert data step and same will be displayed.
Save and Back to main screen.

Step 6: Maintain Fixed Values, Translations, User-defines Routines.

We can maintain re-usable translations and user defined routines which can
be used across various conversion tasks. This is not always required

Step 7: Specify Files

Here, we specify layout of the input file.


The delimiter can be specified here. For Eg : if source data is separated by
comma, tab, semi-colon, blank, no separator or if any separator. Also if first
row of the input file is field names or not. An input file can be excel sheet,
word file or notepad file. Such technicalities needs to be specified in this step
very carefully. Or else data upload will be incorrect.

Save. The following screen is displayed which shows our selections and
values. If any changes are required can be done here.

Save and go Back to main menu.


Step 8: Assign Files

Execute.

This will show the default file name to source structure.


Save and go Back to main screen.
Step 9: Read Data

Here, LSMW will read actual data from source file on your local drive. We can
also specify row number which need to be uploaded.

Execute.
Once executed, next screen displays number of records read.

Step 10: Display Read Data

This is an optional step provided to review contents of the source data.

Step 11:Convert Data

This step is used to perform actual conversion of source(legacy) data to


target format.
As per our conversion rules mentioned in previous steps, source data to
mapped to the target fields.
After conversion, go Back to main screen.

Step 12: Display Converted Data


This step allows us to view converted data with an option of records selection

Step 13:Create Batch Input Session

Execute.

Step 14: Run Batch Input Session

Execute

Here, using Tcode SM35 we can execute BDC session. Select the object name
and select Process to run the batch input session.

The following screen is displayed which asks if Foreground or Background


processing is required.

Once finished, following screen is displayed.

Finally at the end, in case of successful conversions actual data can be


viewed in DB tables

To assign Tcode to LSMW

Go to transaction SHD0. Enter Transaction code as LSMW. Go to Screen Variants tab


and enter a name.
Click Create
PFB the next screen. Enter the Project, Subproject and Object for which the TCODE
has to be created and press ENTER.
PFB the next screen. Provide the name of the screen variant and the text. Fill the
check boxes in W.content, Output only and Required columns. Then click on Exit
and Save button.
The screen variant in now created
Go to Transaction Variants tab and click on Insert Row.
Then add the screen variant created.
Click Change button in the menu.
PFB the next screen. Click on Menu Functions button. A pop-up appears on the
screen. Provide the program name(/SAPDMC/SAPMLSMW) and status (0100). Then
click on Deactivate functions button. (This step is used to deactivate the menu
items.)
Select the following items from the menu items and click Continue.
Click on Save and Back.
Process of creating a TCODE:
Go to transaction SE93 and provide a name and then press Create. A pop-up
appears as below. Select the radio button Transaction with Variant and click Enter.
Provide the transaction variant created in SHD0 and check Cross Client and save.

You might also like