Friday, 26 December 2014

Easy Steps for LSMW Creation


This document will be discussing only the Batch Input recording way of data migration. Batch input recording is the most flexible of all the different methods of data input. It gives the option of recording a particular Tcode or Tcodes while system registers the various fields navigated during recording. After the record is complete, the same Tcode or Tcodes can be run as a batch session with the source of data as an excel sheet.

NB: The document is made to demonstrate the recording and subsequent upload of asset master (Tcode AS01). The document can be used for any kind of program creation; material master, Vendor master, posting transactions etc

Step
Action
1.
Execute the Tcode LSMW

1.gif
Step
Action
2.
Provide a name of the project and click create
3.
Provide a description for the project. Then enter the subproject and finally the object
2.gif
Step
Action
4.
Click the execute button
5.
From the list of operations, select the first, “Maintain Object Attributes” and click execute (or just double click on the line)

3.gif

Step
Action
6.
Select the radio button for ‘Batch Input Recording’ and click on ‘Recordings Overview’

4.gif
Step
Action
7.
Click the create button, and provide the name of the recording and click ‘continue’

5.gif
Step
Action
8.
In the ‘Transaction code’ window, provide the Tcode. In this case it is ‘AS01’ and click continue

6.gif
Step
Action
Note
The system has started recording and any field input in the next steps will be recorded as an input field. Also try to complete recording without encountering an error.
Step
Action
Note
The next few steps will be exactly the creation of an Asset master record. To keep the document small, only the last screen is captured that ends the recording.
Step
Action
9.
Click on the save button after all the required entries are given for asset master record creation. This ends the recording and system takes back to LSMW

7.gif

Step
Action
10.
From the recording system created, edit the necessary field by double clicking on each.

8.gif
Step
Action
Note
Provide a name and description for the field and note carefully that the ‘Default Value’ field should be left blank if the entry varies in each record from the upload file. Ie, in the case of Asset master creation, the asset class varies so should be left blank. However, if you are creating a upload for only ABCD co.code assets, the default value should be filled in as ABCD since it is constant across the upload.
Also note that unnecessary fields can be deleted.

Step
Action
Note
Similarly, edit every field that the system recorded and click Save. Then click back thrice.

9.gif
Step
Action
Note
It is important to make sure that the recording we made in the previous step is populated in the ‘Recording’ field. If you don’t find there, press F4 and system will populate it. If you move to the next step without making this point sure, there will be error later.

Step
Action
11.
Click save and press back once. Now select the second step from the list and click execute (or double click)
12.
Provide a Source structure name and description.

10.gif
Step
Action
13.

Click save and click back. From the list of operations, select the third ‘Maintain Source Fields’ and click execute.
14.
Place the cursor on the source structure ‘MAS_ASSET’ and from the ‘Source Fields’ drop down at the top left corner, select ‘Table Maintenance’
11.gif
Step
Action
15.
Provide the list of fields that was created as part of recording. The ‘Field Name’ is the name of the field, Type is the type of input; Character, numeric, alphanumeric etc, Length is the length of the input field and finally field description.
Click save, press back. Again click save and then click back

12.gif

13.gif
Step
Action
16.
From the list of operations, select the 4th ‘Maintain Structure relations’ and click execute

14.gif.
Step
Action
Note
Since a mapping is already made between the target structure and source structure, there is no action in this step. You could press save and press back.

Step
Action
17.
From the list of operations, select the line 5 ‘Maintain Field Mapping and conversion Rules’ and click execute

15.gif
Step
Action
Note
This structure is the target structure. The step is very important because a mapping is established between target strcutre field and source strcutre fields. Also, this is the step at which the upload excel file should be created.
Just create an excel file with the columns as the above target structure fields.
Step
Action
18.
Place the cursor on the first field and click on ‘Source Field’. From the list of source fields, select correctly (double click) that field which would be mapped to the target field. For eg: the first target field in the structure is ASSET_CLASS. Since ASSET_CLASS should be mapped to the source field ASSET_CLASS, map each other.

16.gif
Step
Action
Note
Similarly assign every field in the target structure to the source structure fields. Note that if there are constant fields, usethe ‘Constat’ button to assign a constant value.
Step
Action
Note
After the mapping is complete, click on save and click back
Step
Action
19.
Operation 6 ‘Maintain Fixed Values, Translations, User Defined Routines’ can be ignored
20.
Select operation 7 ‘Specify Files’ and click execute

17.gif

Step
Action
21.
Place the cursor on ‘Legacy Data’ and click on ‘create’
18.gif
Step
Action
Note
The excel upload file created should be saved as a ‘Tab delimited’ file. This file location should be given in the previous step.
Step
Action
22.
Place the cursor on ‘Legacy Data’ and click on ‘create’
23.
Make sure the ‘Tabulator’ radio button is selected in the ‘Delimiter’ section. This is because the file is ‘Tab delimited’
24.
Make sure the ‘Field Names at start of File’ should be selected in the ‘File structure’ section. This is because the first row in the upload file is column name and the actual data starts only from the second line in the file
19.gif
20.gif
Step
Action
25.
Click on save and click back
Note
Many times you might error about the length of ‘Converted Data and/or ‘Imported Data’. It just means that the length of file name of Imported data and/or converted data is longer than 45 characters. All you have to do is to double click on the line and reduce the file name.

Step
Action
26.
Select the operation 8 ‘Assign Files’ and just click save and click back
27.
Select the operation 9 ‘Read Data’ and click execute. Click execute in the next screen.
21.gif
22.gif
Step
Action
28.
Click back twice
29.
Select the operation 10 ‘Display Read Data’ and click execute.
30.
Click continue in the ‘Display Read Data’ pop – up box

23.gif
Step
Action
31.
Randomly select some records and click on it. Make sure that the target strcture data format and fields are correct. If they are not correct, you will have to re-do the target strcture part again. But if you did all the steps correctly till now, it will not give a problem.
24.gif
Step
Action
32.
Select operation 11 ‘Convert Data’ and click execute
33.
Click execute again in the next screen

25.gif
Step
Action
34.
Click back twice
35.
Select the operation ‘Display Converted Data’ and click execute
36.
Select continue in the ‘Display Converted Data’ pop-up box
Step
Action
37.
Randomly select some records and click on it. Make sure that the mapping is correct. Ie, character, fields etc are correctly mapped to the target structure.
38.
Press back button twice
39.
Select the operation 13 ‘Create Batch Input Session’ and click execute
26.gif

Step
Action
40.
Click on execute

27.gif
Step
Action
41.
Select the operation 14 ‘Run Batch Input Session’ and click execute
42.
Select the batch session and click the ‘Process’ button
43.
From the ‘Process Session **’ pop-up, select the processing mode. If the mode is background, system will run pulling the information from the excel sheet and run the transaction that number of times as much data in upload file, in the background.
If you run in ‘Display errors only’ system will throw any error it encountered during the task and will proceed only after you manullay correct.
And finally ‘Process/foreground’ will mandate you to press the return key for every screen action. Use this only for very few records. Using this for an upload file of 10000 records will be a very bad idea.

After selecting the mode, click on the button ‘Process’

NB: For this demonstration, I ran in Background.
28.gif

Step
Action
44.
This will schedule the batch session in background. Analyze the session to see it resulted in any error. If you notice error, correct it
Average User Rating
(2 ratings)

Comments

  • Erwin Leitner
    Hello,

    Thank you very much.

    like
    bookmark
    and stars

    all the best erwin
  • Nathan Genez
    Batch input recording is the most flexible of all the different methods of data input. It gives the option of recording a particular Tcode or Tcodes while system registers the various fields navigated during recording. After the record is complete, the same Tcode or Tcodes can be run as a batch session with the source of data as an excel sheet.
    It might be more flexible but it's not as predictable and tends to require a certain amount of admin to keep up and running.  I would never choose a BDC based solution and a custom screen recording when SAP delivers a BAPI for the same process (BAPI_FIXEDASSET_OVRTAKE_CREATE in this case).
    • Ani Varghese
      Thanks Erwin Leitner and thanks Nathan Genez for the comments.
      Nathan, I won't disagree with you on how batch input recording can be touchy at times. And I picked AS01 just to demonstrate recording and in no means thought of suggesting it as the apt way for asset creation.
      You might be totally correct that using the BAPI is the best way for AS01.

      Thanks again !

      Regards,
      -Ani

1 comment: