How To Use LSMW
How To Use LSMW
How To Use LSMW
What is LSMW?
LSMW is one of SAPs best data conversion and master data creation tools. It is available for most R/3 master and transactional data. LSMW can be used for most conversion and migration tasks and can be accomplished with standard functionality. With a little ABAP coding, you can use LSMW for more complex data conversion activities. The information below will walk you through the process of creating a simple LSMW. Once youve done this youll be able to see how useful the tool can be and how LSMW is the right choice for most conversion and migration!
STEPS FOR CREATING AN LSMW. 1) Log on to SAP 2) Enter transaction code LSMW
3) If you receive the following screen either check the white box display the message then click the green check check to continue.
to no longer
4) Once the screen below appears, you are now ready to begin your LSMW script creation.
6) If you receive the screen below, click the green check and continue.
11) Next you get this screen. This allows you to set up the LSMW. Since we dont use IDOCs you can remove all the checks at the bottom of the screen.
13) You will be returned to the main screen shown below. Click
14) Now you will begin the creation of the LSMW. STEP 1. MAINTAIN OBJECT ATTRIBUTES 15) Next click on then select Batch Input Recording.
16) Next Input the Name of the recording. In this case its KS01. Then click
18) Input recording fields as below then click the green check.
20) Next youre ready to being creation of the master data for your LSMW. In our example using KS01 you see the following screen.
22) Next fill in all information needed for your script. In this case for cost center creation.
23) Save the Recording . On the following screen you see the field names and the default values for the field names that were created from the recording.
24) Next we need to remove the default values. The purpose is to create parameter import names. To do this you must double-click into each default value name.
25) After double clicking into a field you will see a screen similar to the one below.
26) Remove the default value then input the field name and the description of the field name. Click
29) Click
30) Next
31) From this screen you will now move on to Step 2 of this process. Click 32) Then click change
34) You will receive the screen below. Input your data then click
36) You will return to the Main Screen as below. Please note youre now ready for Step 3. Click Maintain Source Fields.
38) You will receive the screen below since we have not completed step 3. This is a warning. Click .
39) Click Change and you will receive the warning again. Click the green check and continue.
40) Click , then . 41) Youre now on the initial screen. Automatically step 5 is selected or you may manually make the selection. Click Execute.
42) On the screen below all fields that you created will be listed. In our example we only selected one field (KOSTL) as a parameter in the first step and all other fields were kept as defaults.
43) Make a list of all the fields or copy to an Excel file. You will use later in the exercise. The format of your Excel file should appear as below.
The Character and Length fields will be obtained from Technical help. To do this:
44) Open a new SAP Session, enter transaction code KS01. Click in the Cost Center field then click F1 help. The screen below appears. Click on Technical Information.
46) Locate each of your field names and get the Data Type and Length. In our example Data Type = Char however in LSMW selection could be different. For instance CHAR = C, etc.
47) Input your data to your Excel file as below. Save the file as a .txt format. This is always required when importing data to LSMW.
48) After the excel sheet is complete we can now go to the third step. Click step 3 then execute.
50) Select Source Structure click for Table Maintenance. 51) You will see the screen below. You will need to input the field name, type, length. The field label will default. This information is taken from the Excel Sheet that you created earlier.
, then
57) Click Change, then click once on the Structure Name, then Click Extras>Auto-Field Mapping>
58) You will see the screen below. Click No Confirmation, then return.
62) The screen below appears. It offers several options of importing data. In our example we want to import data saved on our PC. Therefore we need to select the first option Legacy Data On the PC (Frontend) then click <change>
64) On the screen below you will select the file to import from you Desktop (Please remember the location of the file). Next put in the file name (in the Name field) Select Tabulator. Under File Structure ensure that both items are checked. Click <enter>.
67) On the screen below click <change>, Select the source structure, then <save>, then <return>.
68) You can now test to see if LSMW will read your data on the text file. Execute Step 8.
69) From the screen below, click <execute>. LSMW will read the data from your text file.
70) The screen below shows that we have one record being read from our .txt file. Click <return> twice to return to the Main Screen.
71) You are now ready to execute Step 9. This step displays the data.
(Please Note: If you wish to just use particular lines in your LSMW can use the From Line and To Line to tell LSMW which lines from your file that you wish to process. LSMW will only select those lines.)
73) The screen below shows that we will load one cost center. In this example the cost center is DCLLSMW01. The purpose here is to verify that all the data that you wish to load is being captured. Click <return>.
74) Next youre ready to convert the data. That is the data is being converted from your .txt file to the LSMW language. Execute Step 10.
75) From the screen below. Click <execute>. NOTE TO FILE EXPLAIN THE NUMBER OF RECORDS CONVERTED.
76) The screen below shows that in our example one record is being converted. Click <return> twice to return to the main screen.
77) Now youre ready to display the data that you have converted. Click <execute>.
79) You will now see the data converted. In this example cost center DCLLSMW01 is being displayed. Click <return> to the main screen.
80) Next you want to Create Batch Input Session. Execute Step 12.
81) The screen below appears. Click <execute>. This will create an SAP BDC session (SM35).
82) The message below appears that you have created a Batch Input session. Click <enter>.
83) You are now ready to process the BDC session. You do this by executing step 13 Run Batch Input Session.
84) You are automatically taken to transaction SM35. You now need to process the BDC session by clicking on <Process>.
85) Select the session, Click Process, and a dialog box appears. You need to choose your preferred processing mode. In our example were choosing to process the session in Background. Click <Process>.
The LSMW can be exported and imported to other SAP Clients for execution. No transports are necessary as in the case of CATT/eCATT. Follow the instruction on the following pages to do this.
6) Select a location on your local drive to store the file and save it there.
8) Click
IMPORTING LSMW 9) To Import LSMW log on to the client in which you wish to import to. 10) Go to Transaction code LSMW. 11) Click >Extras>Import Projects
12) Choose the file from the location you exported it to.
13) You will receive the screen below. Click the green check and continue.
15) You will see the screen below. Click the green check.
16) You are now ready to execute the LSMW in the client.