You are on page 1of 16

Contents

How to Create a LSMW ............................................................................................................................. 2


How to Execute a LSMW ......................................................................................................................... 12





















How to Create a LSMW

LSMW Legacy System Migration Workbench
Example:
Lets say I want to change the PO Number field for given set of Sales Orders.
SO number & the new PO number will feed through a Text file.
Procedure: This can be done using LSMW through a Batch Input file.
Tx: Code: LSMW
Select Create New option

Give a Project ID & Description & press Enter

Give the Sub Project ID & the Description & Press Enter


Give the Object ID & Description & Press Enter

Now we need to record all steps of making that change in the system.
Select the Menu option Go to -> Recordings

From the Recordings of Project screen, Click on Create New Option


Give a Recording ID & Description for the Recording & Press Enter

Give the Transaction Code that you want to Execute

Do the relevant Recording using the Transaction & Save the Transaction.
Click on button to get all Field Names
Save the Recording. You can see all fields that were used during the recording.

Select Back option twice & come to LSMW main Screen.
Select the Maintain Object Attributes option & Click on Execute


Click on Display <-> Change option
Since we are going to feed the SO# & PO # using a Text file, we have to select Batch Input
Recording option & Select the Recording ID from the List of values.

Save
Now select the Maintain Source Structures option & click on Execute


This is the field Structure that we are going to feed from a text file
Click on
Click on
Give a Source Structure ID & Description for Source Structure

Click on Enter option
Save it & click on Back option.
Select Maintain Source Fields option and click on Execute button.
This is to mention the fields that we are going to feed form the Text file. We have to mention all
fields that we are going to use as an Input for LSMW.

Select your Source Structure & Click on
Select the Source Structure & Click on .

Before doing this you have to go to the relevant Transaction Code (Which you used for
Recording) & get the Technical Names of the fields that you have to feed. For my example its SO
No & the PO Number of the SO Header.
o SO Number VBELN
o PO Number - BSTKD

Give the Field Name, Field Description, Field Length & the Field Type.

NOTE: You have to maintain the same order in the Text file as well. (For example in my Text file I have to
enter SO number as the first column and then the PO number column, If I change the order here, then
my Text file columns should change accordingly)

Once you add all fields in the Input file, save it.


Select Back option.
Select Maintain Structure Relations and click on Execute button
You should be able see your Source Structure & the Recording Structure has linked
automatically. If you want, you can delete & re-create relationships here as well.
Save it & select Back option
Select Maintain Field Mapping and Conversion Rules option & click on Execute button

Click on
Since Recording Structure & the Source Structure were mapped in the previous step, you
can use Auto Field Mapping option for this.
Click on Extras ->Auto-Field Mapping option.
Click OK for the Auto Field Mapping: Settings popup window.

If the Fields mapped by the system is correct, then select OK option for Auto Field Mapping:
Proposals popup.


Save it
To give any Fixed Values select Maintain Fixed Values, Translations, User-Defined Routines &
Execute.
For example if you want to pass same PO No for each SO, you can use that PO number as a fixed
value.
Now you have to prepare the Input Text file for LSMW.
Open a MS Excel file & give those Input fields. Order of Columns should be same as the Order
that you created in Maintain Source fields step. You can create you Excel file With Heading
or Without Heading. Ill create my file without any Headers. Each row will represent one Input
for LSMW. Here Im feeding 2 Sales Orders & its New PO Numbers. Save the Excel file as a Text
file.

Now go back to SAP-LSMW screen

Select Specify Files option & click on Execute button

Click on
Double Click on Legacy Data field

Browse the File from the Popup window. Give a Name for that File.


If you have Headers in the Text file, you have to select the below option. For my example I didnt
set it, as I dont have header row.

Since we save the text file on Tab spaced format, you have to select the following option.

Save it.
Select Back option
Go to Assign Files option
Click on
Check you file name & save it.

Select Back.
Now you have created a Complete LSMW. (What you did up to this step is one time entry in the system)
From this point onwards youll use that LSMW to upload data in to SAP system for any number of times.

How to Execute a LSMW

From the LSMW Main Screen,
Select Read Data option & click on Execute button
Again click on the Execute button

You can see number of Records Read in the new screen. You can validate your text file from this as well.
No of raw in the Text file should be equal to Number of Records Read.

Select Back option twice.
Then form the Main LSMW screen, select Display Read Data option & Press Execute (Optional
Step)
Press Enter


You can see those records in the screen

Press Back option
Select Convert Data option and Press Execute button
Press Execute option again

Youll see the No of records, etc in the screen


Press Back option twice & go back to the Mail LSMW screen
Select Display Convert Data option and Press Execute button (Optional Step)
Press Enter for the popup menu

Now youll see the converted data.

Press Back option & go back to main LSMW screen
Select Create Batch Input Session option and Press Execute button
Press Execute option


Itll give you a message with Number of transactions that are going to input. (Its equal to the No
of raw in your text file)

Press Enter
Select Run Batch Input Session option and Press Execute button
Now youll see the Batch input file that you created from the previous step

Select the Batch Input file & Press
Here youll get Processing Methods.
o If you want to Run it in Foreground (You can see how transaction is executing You
have to Press Enter every time to execute that) Its advisable to use foreground option
for at least 2 records initially, to make sure LSMW is passing values to correct fields.

o Background option will run the LSMW & display you the results. Once your sure of
correct values are going to correct fields, you can execute the full data set in
background mode.

For testing purposes, better to run it in Foreground option.
Click on
Now you can enjoy your LSMW.
Note:
This is just an illustration of a sample LSMW. Now think of your own scenario and try to create a LSMW
for that.

Author: Anupa Wijesinghe
E-Mail: anupaw@gmail.com / anupaw@learnsaptips.com
Website: www.learnsaptips.com
View my profile in LinkedIn
Follow me on Twitter


Disclaimer

This article is done based on my research and readings, unless otherwise stated. The views expressed
are my own and not of anyone else.
Author accepts no liability for the content of the articles in this website or for the consequences of any
actions taken on the basis of the information provided. Using this information is at the users own
discretion and responsibility.

You might also like