You are on page 1of 21

LSMW User Guide

This document contains step by step instructions to use LSMW to update Vendor Master
Records. This demonstration covers 2 different techniques to build LSMW program:

Batch Recording
Standar Batch / Direct Input

Demo Example 1: LSMW to Update Vendor Master Records with Batch Recording
Access to Legacy System Migration Workbench by using t-code LSMW.
LSMW helps to organize data conversion activity by grouping the activities into Project,
Subproject and Object structure. Create a Project called Z_LSMW_DEMO01 and a Subproject
as Z_MM and Object as Vendor_Master.

Execute the Object created within the Project/ Subproject and you will see the step by step
guideline provided by LSMW.

Step 1: Maintain Object attributes


In this example, you will be updating the vendor master records with the help of recording a
transaction XK02. Choose radio button Batch Input Recording and click on the recording
overview icon to record the transaction.

Click create and enter the Recording name as ZVENDOR, the description as Vendor Master
Update, and the transaction code as XK02.

Transaction code XK02 will be called. Enter the key vendor information (vendor number,
company code, and Purchasing Organization) and choose the respective area that you would
like to update.

Make changes to fields required (in this demo: Prev. acct. no, Incoterm 1, incoterm 2, minimum
order value).

Once the transaction is completed, system will records the flow of screens and fields and saves
them as target fields. Note that the fields are populated with default values. The values you
entered when you recorded the transaction are set by default.

Note that if you have more fields in the recording than needed, you can remove them by clicking
icon.

Double-click on the field RF02K-LIFNR and enter the name as LIFNR and the description as
Vendor and remove the default value. Repeat the same steps for other target fields.

Go back to the initial screen and save the object attributes after assigning the new recording
ZVENDOR created.

Step 2. Maintain Source Structures


Give a name and a description to the source structure and save the changes.

Step 3. Maintain Source Fields


In this step, you need to list what fields are present in the source structure. Click on
enter Fieldname, Type and Length for each field. Save the entries.

icon to

Tips: The source structure fields can be created with reference to Object Overview which can be
found from the LSMW initial screen.

Step 4: Maintain Structure Relations


Execute a step to Maintain Structure Relations. Since, there is only one Source and Target
Structure, the relationship is defaulted automatically. Save the entries.

Step 5: Maintain field mapping and conversion rules


If your source file already has the field value, you choose rule Source Field. Keep cursor on
field BUKRS and click on Assign Source field icon to choose source field BUKRS from
structure ZVENDOR.

Similarly, assign Source Field rules to the remaining fields and save the field mapping.
Alternatively, you can use constant rule icon to default certain target field to certain value.
Example, if you would like to default Company Code to AU01, point your cursor to BUKRS, click
on
and input company code as AU01. You may leave this column in your upload
template blank and system will upload the data with default company code value as AU01.

Step 6: Maintain fixed values, translations, user-defined routines


You can also maintain re-usable translations and user-defined routines, which can be used
across conversion tasks. In this case, that step is not required.
Step 7: Specify files
In this step, we specify the file path of the upload template. The upload template file is a Tab
delimited with the first row as header fields saved in your local PC.

Tips: Keep File Path / Filename fairly short


On PC, sometimes it doesnt error, but new filenames wont stick if its too long (>256char).
Unix has 40char limit (files on the application server: *.read and *.conv).
Try removing all path definitions and use only the filename.

1
3

Step 8: Assign files


Execute step Assign Files and the system automatically defaults the filename to the source
structure. Save the entries.

Step 9: Read data


In this step, LSMW reads the data from the source file from your local PC. You have the option
to read only selected rows and convert data values to internal format by specifying the range of
Transaction Value in selection screen.

Step 10: Display read data


This step is optional. If required, you can review the field contents for the rows of data read by
double clicking on the desired row.

Step 11: Convert data


This is the step that actually converts the source data (in source format) to a target format.
Based on the conversion rules defined, source fields are mapped to target fields.

Step 12: Display Converted data


Again this is an optional step to view how the source data is converted to internal SAP format

Step 13: Create batch input session


Once the source data is converted in an internal format, you can create a batch session to
process updates.

Step 14: Run Batch Input Session


You can execute the BDC session by Run Batch input session. Executing a batch input
session is a standard SM35 transaction for managing BDC sessions. Once you have
successfully executed the batch input session, the vendor master records are updated in the
system. You can confirm this by viewing the vendor master records (XK03).

Demo Example 2: LSMW to Update Vendor Master Records with Standard Batch / Direct
Input
As an alternative to using Transaction Recording, you could also use a standard SAP object to
update Vendor Master Records. Business Object 0040 is already pre-defined in the system
with standard Batch Input Interface Program RFBIKR00.
Create a Project called Z_LSMW_DEMO01 and a Subproject as Z_MM and Object as
Z_VENDOR2.
Step 1: Maintain Object attributes
In this example, you will be updating the vendor master records with the help of pre-defined
Batch Input Interface Program RFBIKR00. Choose radio button Standard Batch/Direct Input.
Enter Object 0040 for Vendor Master records and default method 0001 and click on Save.

Step 2. Maintain Source Structures


Give a name and a description to the source structure and save the changes.

Step 3. Maintain Source Fields


In this step, you need to list what fields are present in the source structure. Click on
icon to
enter Fieldname, Type and Length for each field. Save the entries. (Follow the steps described
in Demo1)

Step 4: Maintain Structure Relations


Company and Purchasing view of Vendor Master is stored in table LFB1 and LFM1.
Accordingly, you need to update structure BLFB1 and BLFM1. However, in addition, the
Standard Object 0040 also requires updates to BGR00, BLF00 and BLFA1 structures. Even
though you dont want to update any fields in these structures, you need to create a relationship
with source structures. If you do not maintain Structure relations for mandatory entries, you
might get a message such as Target structure BKNA1 needs a relation to a source structure.
Create relationship between source structures VENDOR_SOURCE2 with these target
structures with icon
. Keep Cursor on the target structures and click on icon
Create Relation and structure relations are maintained as shown below.

Step 5: Maintain field mapping and conversion rules


If your source file already has the field value, you choose rule Source Field. Keep cursor on
field BUKRS and click on Assign Source field icon to choose source field BUKRS from
structure ZVENDOR.

Similarly, assign Source Field rules to the remaining fields and save the field mapping.
Step 6: Maintain fixed values, translations, user-defined routines
You can also maintain re-usable translations and user-defined routines, which can be used
across conversion tasks. In this case, that step is not required.
Step 7: Specify files
In this step, we specify the file path of the upload template. The upload template file is a Tab
delimited with the first row as header fields saved in your local PC.

Tips: Keep File Path / Filename fairly short


On PC, sometimes it doesnt error, but new filenames wont stick if its too long (>256char).
Unix has 40char limit (files on the application server: *.read and *.conv).

Try removing all path definitions and use only the filename.

1
3

Step 8: Assign files


Execute step Assign Files and the system automatically defaults the filename to the source
structure. Save the entries.

Step 9: Read data


In this step, LSMW reads the data from the source file from your local PC. You have the option
to read only selected rows and convert data values to internal format by specifying the range of
Transaction Value in selection screen.

Step 10: Display read data


This step is optional. If required, you can review the field contents for the rows of data read.

Step 11: Convert data


This is the step that actually converts the source data (in source format) to a target format.
Based on the conversion rules defined, source fields are mapped to target fields.

Step 12: Display Converted data


Again this is an optional step to view how the source data is converted to internal SAP format.
When you convert data, LSMW automatically converts into the appropriate structure layouts, as
required by Standard program (RFBIKR00).
Note that if you had only one record in source file, the converted file has five records due the
there are 5 structure relationships maintained in Step 4.

Step 13: Create batch input session


Once the source data is converted in an internal format, you can create a batch session to
process updates.

Step 14: Run Batch Input Session


You can execute the BDC session by Run Batch input session. Executing a batch input
session is a standard SM35 transaction for managing BDC sessions. Once you have
successfully executed the batch input session, the vendor master records are updated in the
system. You can confirm this by viewing the vendor master records (XK03).

After executing the Batch Input Session, you can view the summary of upload activity. You will
see what the total records are read as well as total records that have been created/uploaded
successfully.

Highlight the session and click


to find out the details of the batch input session.
Click on Log created tab and you will see there are 2 transactions read, however one of the
record failed to update.

Click on Transactions tab to see the index of record which has failed to update and click on
Screen tab to see the details of screen input.

You might also like