Learn how to create, run, and apply SAP Legacy System Migration Workbench to your basic day-to-day HR activities with these 15 steps.
Key Concept
Companies frequently use SAP Legacy System Migration Workbench (LSMW) exclusively for major initial data conversions or in preparation for go-live. Often, users are unaware of the LSMW functionality available to enhance common SAP activities. The batch input functionality in LSMW is a handy, practical way to update or convert data in your system on a daily basis or when the demand arises.
Did you know that you can use the SAP Legacy System Migration Workbench (LSMW) tool for day-to-day activities? Based on my experience, I’ve compiled step-by-step instructions to successfully create and run an LSMW for your HR processes. LSMW enables you to create and update custom infotypes and support mass changes of employee data when standard programs are insufficient or your system does not support the functionality, such as mass pay increases for employees.
Say your company recently decided to change its email addresses for better branding purposes. You are tasked with updating all employee records within the next week. Instead of recruiting your local SAP HR ABAP support team to execute this, you can handle this requirement on your own, reducing the need for additional resources. You can do this by following the steps for writing an LSMW using the batch input functionality listed in Table 1.
Step 1. Define the project, subproject, and object |
Set up project groupings for LSMW |
Step 2. Maintain object attributes |
Determine the type of LSMW you will be writing, such as batch input session. Record your transaction to determine the essential field structure. |
Step 3. Maintain source structures |
Determine your source information |
Step 4. Maintain source fields |
Determine the fields to use for the key fields for conversion/upload |
Step 5. Maintain structure relations |
Link batch input recording structure to the source structure |
Step 6. Maintain field mapping and conversion rules |
Link batch input session requirements with key fields used in data conversion |
Step 7. Maintain fixed values, translations, and user definitions |
Determine details of fixed values and translations |
Step 8. Specify files |
Link SAP system with the file used to upload conversion information |
Step 9. Assign files |
Link source structure with source file |
Step 10. Read data |
Read the file indicated in step 8 |
Step 11. Display read data |
Review the uploaded raw data |
Step 12. Convert data |
Apply all conversion rules and mapping as defined in step 6 |
Step 13. Display converted data |
Review the converted data |
Step 14. Create batch input session |
Create the batch input session from the converted data |
Step 15. Run batch input session |
Run the batch input session via transaction SM35 |
|
Table 1 |
The steps required for writing an LSMW using the batch input functionality |
Steps to Write an LSMW
To begin the process, execute transaction LSMW from the SAP Easy Access menu. On the welcome screen that appears, select the green check mark icon to continue.
Initial Planning Phase
Step 1. Define the project, subproject, and object. The Legacy System Migration Workbench main screen appears. If other users previously created LSMWs you may find a defined project and subproject. For any new LSMW you must create a new object; this process is described later in this step.
The functionality for creating projects and subprojects enables you to segment the upload of data (for example, Benefits, Time, and Personnel Administration). You can use the functionality as an authorization control for uploading data based on the project name. A user who does not have the authorization to enter a particular project cannot use LSMW for this task.
In my example, I created a new project and subproject. Enter the Project name (ZHREXPERT) and the Subproject name (MASTERDATA) into the appropriate fields. Select the create icon
. Enter the Description (Master Data Edits) of the project and subproject. Select the continue/enter icon to continue through the creation process, as shown in Figure 1.

Figure 1
Create a subproject title and description
I suggest naming the objects after the infotype or action that you are maintaining and further specifying the object description with Change, Create, or Copy. This is an important consideration because the name of your object is now the name of your newly created LSMW. In the example shown in Figure 2, I plan to create the infotype 0105 subtype MAIL. Therefore, the naming convention for the Object is PA0105_EM and the Description is Create – Infotype 0105 Subtype Email. Using a similar naming convention assists your LSMW team by clarifying the object and eliminating potential confusion later on.

Figure 2
Example of creating a naming convention for object PA0105_EM
After you enter the object name and description of the object, select the continue/enter icon and click on the execute icon
in the screen that appears. Your SAP system then displays a list of tasks for the creation and processing of an LSMW. Figure 3 shows all the possible steps to complete an LSMW; however, the tasks vary based on the items maintained in step 2. Maintain object attributes is defaulted.

Figure 3
Various tasks available in LSMW
Recording Phase
Step 2. Maintain object attributes. You should already have your recording data defined and ready to go. Determine this data based on the transaction you intend to record. In my example, I want to create a new communications infotype for email, which requires a sample personnel number (124798), infotype start date (01/01/2007), infotype number (communication - 0105), and subtype information (email - MAIL). During the batch input session, the system records each key stroke. You should be prepared to process your transaction in the most efficient way possible.
For example, instead of selecting the infotype on the Maintain Master Data screen (PA30) you may choose to enter the infotype number in the infotype field at the bottom of the screen. Or, instead of using search help to look up personnel numbers, I recommend having it on hand so you can manually enter it into the personnel number field. If you do make a mistake during the recording, back out of the recording and start over so that you don’t trigger more setup than is necessary. Select the execute icon to determine the type of LSMW to record. Complete the following procedures, as shown in Figure 4:
- First, you need to click on the Display <-> Change button
- Then select Batch Input Recording
- Lastly, click on the overview icon

Figure 4
Three steps to create object attributes via batch input selectio
The recording screen appears, allowing you to record your batch input. You must now have your recording test data on hand to support the recording process. You need:
- The best transaction to record for this update (for my example, PA30)
- The sample employee you plan to use (for my example, 124798)
- The dates you plan to use (for my example, 01/01/2007)
If you have not recorded any batch inputs under this project, you see the standard maintenance icons (such as create, copy, and rename) and a blank page with the word Recordings. Select the create icon and the SAP system prompts you to create a short text and long text name for the batch input recording.
Remember, use clear and consistent naming conventions. I suggest naming the recording with the affected infotype or action and specifying how you are maintaining the infotype. For my example, I plan to create new infotype 0105 subtype MAIL, so I used CR0105 MAIL (Create PA0105 Subtype MAIL), as shown in Figure 5.

Figure 5
Example of naming convention for batch input recording
Click on the continue/enter icon. The transaction code dialog box appears. Enter the transaction you need to record the batch input. In my example, the transaction is PA30 (maintain master data). Select the continue/enter icon and run the transaction the same way you run it manually.
Once the transaction is completed, the system returns you to the Create recording screen. Now, define the fields for Maintain field mapping and conversion rules. Blank fields next to entry fields are indicated in different colors, depending on your SAPGUI screen setup.
As you review the Create recording screen you need to determine how to handle each of the fields presented. You either define the field in later steps or remove it from the screen. You define the field later if the information is provided in an upload file, such as the personnel number, or if the field is a constant, such as the infotype number. In my example, the field RP50G-PERNR is obtained from the upload file and the field RP50G-CHOIC is a constant because all employees have infotype communication 0105 updated on their personnel record. To define the values (such as personnel number, infotype, subtype, beginning date, and email address) double-click on the blank fields in Figure 6 and enter a short and a long text name.

Figure 6
Illustration of field definitions before definition and deletion
If the fields can be accepted based on the SAP standard, as in my example, the field P0105- ENDDA system default of 12/31/9999 is the same for every employee. Therefore, you can delete it. To delete this field from the screen select the line (P0105-ENDDA) and then select the Screen field button that contains a minus sign. The line item shown in Figure 6 is then removed in Figure 7. I recommend that new users do not use this functionality until they have built a few LSMWs and fully understand all involved steps.

Figure 7
Illustration of field definitions after definition and deletion
Once you have named or deleted all the fields, click on the save icon. You should receive the message Data were successfully saved in the status bar. Click on the back icon to proceed to the recordings overview screen. In the Recordings of project screen, you should now see your recording listed under the Recordings text (Figure 8).

Figure 8
Recordings overview screen
Select the back icon to go to the Change Object Attributes screen and enter your recording short text (CR0105MAIL, for example) in the Recording field. Once you are finished entering the information, click on the save icon and then the back icon to return to the LSMW main screen. Notice that the system automatically removed several of the line items that were in the original view. The remaining items are the only ones you need to process to define and run the LSMW. Maintain Source Structures is defaulted.
Tip!
If you are running Organizational Management (OM) transactions, use transaction PSO4 (individual maintenance) because the standard selection for an infotype (such as Object 1000 or Relationship 1001) on the standard transactions does not work correctly when you are running batch inputs.
Mapping Phase
Step 3. Maintain source structures. The source structure is the foundation of the attached field definitions. You could have multiple source structures if needed. In my experience, one has always been sufficient. Click on the execute icon and proceed to the LSM Workbench: Display Source Structure screen. Click on the display/maintain icon
to go to the LSM Workbench: Change Source Structure screen. Click on the create icon and enter the source structure name and description, such as Master (master list). Click on the continue/enter icon, click on the save icon, and then click on the back icon to return to the main screen; Maintain Source Fields is defaulted.
Step 4. Maintain source fields. This is where the fields are defined based on your input file. In this example, the input file contains the personnel number and email address to use in creating the final batch input for the LSMW. Click on the execute icon to proceed to the LSM Workbench: Display Source Fields screen. Switch to the LSM Workbench: Maintain Source Fields screen by clicking on the display/maintain icon. Place your cursor on the Source Structure name (Master) created in step 3, and click on the create icon. When the Create source field dialog box appears, enter the field name, field description, field length, and field type as needed. The source fields are defined in Table 2.
PERNR |
Personnel number |
10 (defaulted) |
C (defaulted) |
EMAIL |
Email |
40 |
C (defaulted) |
|
Table 2 |
Example of a source field setup |
Tip!
Create your source fields in the same order as they are in the batch input session. To do this, place your cursor on the field directly above the location of your new field and select the create icon. Placing the fields in the correct order speeds up the next few steps and helps ensure that you are mapping the correct source fields to the correct batch input fields.
You should be cautious of the field length and field type because the system anticipates these values from the upload file. If the field length contains too many characters and your allotted field length is short, you may find that your upload information is truncated. Click on the continue/ enter icon to return to the LSM Workbench: Maintain Source Fields screen. Complete this process for every field you are uploading from the input file. When you are finished, click on the save icon and then click on the back icon to return to the LSMW main screen. Maintain structure relations is defaulted.
Tip!
If you are unsure of the file length or type, review this information from your original transaction by finding the field and pressing
F1 on your keyboard. Then select the technical information icon

. Once you view the field description, double- click on the field name to view the
Dictionary: Display Structure screen. The column
DTyp is the field type and column
length is the field length.
Step 5. Maintain structure relations. Click on the execute icon to review the maintain structure relations. This is required even if you are not changing the information. This step links the source structure to the batch input recording. If you have one source structure and one recording, as in this example, no maintenance is needed in this step. You are only required to review it the first time you create your LSMW. Once you finish reviewing this screen, click on the back icon and return to the LSMW main screen. You must manually select Maintain field mapping and conversion rules.
Step 6. Maintain field mapping and conversion rules. Select the Maintain field mapping and conversion rules button to map your source fields to the required fields for the batch input. Next, determine which fields are considered constants. Only fields that you defined in the batch input recording (step 2) are reflected in this step. Click on the execute icon, then click on the display/maintain icon to continue designating the appropriate mappings and conversions.
To map the fields to the source fields, select the Batch Input field to map and click on the Source field button. You should see a listing of all the fields you created in step 4. Double-click on the appropriate source field to save the relationship to the Batch Input field. In my example, I linked the source field PERNR (personnel number) to the batch input field PERNR (personnel number). By linking the source and recorded fields, the system understands what fields need to be updated and stored for the final creation of the batch input session to update the employee records when you perform steps 10 and 12.
You may get the message * Attention: Source field is longer than target field. If you do, adjust the definition of the source field length you created in step 4. For example, during the creation of the Personnel Number field in step 4, the default length is 10 characters; however, the Personnel Number field in SAP HR is only eight characters. Continue through the message by clicking on the continue/enter icon to determine if you need to adjust your source field setup.
A constant (such as infotypes, subtypes, and dates) allows you to designate a required field without including it in the input file. To map and create a constant, select the Batch Input field and click on the Constant button. In the dialog box that appears, enter the constant value, (0105 in this example, because it is the same for each employee), and click on the continue/enter icon. Click on the save icon and then the back icon to return to the LSMW main screen. Make sure you repeat this process for each field you want to map before continuing to the next step. When you finish, return to the main screen; Maintain fixed values, translations, and user definitions is defaulted. Figure 9 exemplifies mapping fields using source fields and constants.

Figure 9
Completed field mapping with source fields and constants
Step 7. Maintain fixed values, translations, and user definitions. Maintain fixed values, translations, and user definitions is already selected. To continue to the next step, you must manually select Specify files. You do not need to do anything further in this step unless you are creating a more complex LSMW.
Step 8. Specify files. Select the next option in the column to specify files. Performing this step links the input file with the batch input. This way, in step 10 the system knows where to retrieve the file, what type of file it is, and if there is a header within the file. You should already have your input file template created based on the source field structure you created in step 4. Click on the execute icon and then click on the display/maintain icon. Place your cursor on the line item Legacy data On the PC (front end) and click on the create icon. In my example, the source file is C:HREXPERTemail.txt (Figure 10).

Figure 10
Specify the file definition
To access the correct data, you must place your cursor in the File field and map it to the appropriate directory where your source file is stored. Enter a short description that the system uses for the read and conversion programs. If your file is text tab delimited (as in this example), select Tabulator. If your input file contains a header, select the Field names at the beginning of the file check box, as shown in my example.
Click on the continue/enter icon to return to the File Specify screen. The screen should now reflect the changes below the Legacy data On the PC (front end) text. Click on the save icon and the back icon to return to the LSMW main screen. Assign Files is defaulted.
Step 9. Assign files. Click on the execute icon to review the Assign files screen. This step links the source structure defined in step 3 to the source file path defined in step 8. If you do not have multiple source files, review the defaulted setting the first time you create the LSMW. In my example, the MASTER source structure is automatically linked to file path C:HREXPERTemail.txt because I didn’t have multiple source files (Figure 11). Once you have reviewed this screen, click on the back icon to return to the LSMW main screen. You must manually select Read data.

Figure 11
Review the assign files display screen
Executing Phase
Step 10. Read data. Select Read Data and click on the execute icon to begin this step. This process reads the information in the input file and stores it on the SAP server under the input file, as designated in step 8. The file should be closed and in the specified location defined in step 8. In my example the file is stored at C:HREXPERTemail.txt. You may want to limit the number of records for testing purposes. If the to and from fields are blank, the system reads all data from the input file and large files may cause time-consuming run cycles. Click on the execute icon. Once the system reads the data, an overview of the number of records read in the SAP system appears. Use the back icon to return to the Read Data screen and back out once more to the LSMW main screen to see that Display Read Data is defaulted. In my example I am reading all lines in the file. The output count, based on the number of lines read, is four records (Figure 12).

Figure 12
Read data
Step 11. Display read data. Review how the data was imported into the system file. Examine this data and confirm that the correct fields are loaded, not truncated, and in the proper format. Click on the execute icon. A dialog box appears that allows you to determine how many lines of the read data to review. If you leave the fields blank, the system reads all data. If you have several fields to read, double-click on one of the line items to confirm that all data was accurately uploaded. In my example, I chose to read all files; Figure 13 displays the structure (MASTER), personnel number (800123), and email address (HRExpert01@anycompany.com). Click on the back icon to return to the LSMW main screen. Convert Data is defaulted.

Figure 13
Display Read Data screen
Step 12. Convert data. Click on the execute icon to proceed to the convert data process. In this step you apply all of the conversion rules, such as constants and translations, to your input file. This is the file from which the system creates the batch input. If the fields are blank, the system reads all data from the read.data file on the server. You can choose how much of the data is converted by entering a range within the Transaction number fields. To continue, click on the execute icon. The system converts the data and a screen showing the appropriate count of converted records appears. Under the General Selections parameters tab I left the Transaction number fields blank so that the system generates and reads all the records (Figure 14). Once you have reviewed the count of records, use the back icon to return to the LSMW main screen. Display Converted Data is defaulted.

Figure 14
Convert data
Step 13. Display converted data. Completely review the data and confirm that all fields were supplied by the input file and the additional converted data correctly represents the data needed to create the batch input session. Click on the execute icon. A dialog box appears that allows you to determine how many lines of the read data to review. Remember, if you leave the fields blank the system reads all data. If you have several fields to convert, double-click on a line item to confirm that the system uploaded all data correctly. I left the From line and To line fields open and reviewed the data in the overview mode by double-clicking on line 1 (Figure 15).

Figure 15
Display converted data
View the file details, such as the transaction code being processed, the personnel number (800123), the infotype (0105), and subtype (Mail) in Figure 16. Click on the back icon to return to the LSMW main screen; Create batch input session is defaulted.

Figure 16
Drill down for converted data details
Step 14. Create batch input session. To perform this step, select the execute icon to view the Create Batch Input Session screen. This screen creates the batch input session that runs via transaction SM35. There are no changes to this screen in my example so you click on the execute icon to create the batch input. A dialog box appears, showing the number of transactions created. Figure 17 shows the final result of my example with four transactions created. Click on the continue/enter icon to return to the LSMW main screen. The Run Batch Input Session button is defaulted.

Figure 17
Confirmation the batch input was created
Step 15. Run batch input session. Click on the execute icon to view the Batch Input: Session Overview screen. To run the batch input, select the area in front of the session and click on the Process button. You may choose to run the process in three modes: Process/foreground, Display errors only, or Background. My example uses Display errors only; this means only updates that contain errors are reflected (Figure 18). Click on the Process button to continue. If you need further information about running a batch input session, the SAP standard Help is available via transaction SM35. Next, follow menu path Help>Application Help to view specific documentation on managing batch input sessions. I suggest running a couple of the transactions in the foreground to confirm that LSMW is working correctly and that you are able to process them as needed. When the batch input session is completed all employee records in the upload file are updated.

Figure 18
Select your process options
Note
If you want someone else to process a batch input session for you and your current security only allows one user to run a batch input session under his or her ID, you need to change the UserID field to the desired user ID. Note that the user must have the appropriate security authorizations to support the actual data maintenance the LSMW is conducting.
Tip!
To end a batch input session while processing in the foreground, you must enter /bend in the transaction code box during the session to return to the transaction SM35 screen. Now, you are able to process your batch input session in Display errors only or Background. If you do not exit the batch input and rerun in Display errors only or Background, your batch input session will take significantly longer and also require additional manual intervention.
You have now created and run your first LSMW, successfully updating employee email addresses by running the batch input session.
Don’t Forget
Take the following reminders and cautions into account each time you create a new scenario in LSMW:
- Confirm that you do not have any internal audit rules that might affect the ability to use this in a production environment. If you do, address them early and implement the appropriate controls to support the tool.
- Create and test in a quality environment if possible, especially for any updates impacting Time or Payroll processes
- Know the transaction you intend to record inside and out
- Make sure you have the appropriate test data ready for recording and confirm that it is standard
- Create your source fields in the same order that your batch input recording requires them
- Try to use the constant field as much as possible
- Review your read data file and converted file to confirm that the data is not truncated, is in the correct fields, and is converted properl
- Run a small test population before running the full population
- Run the first few batch input transactions in the foreground and verify all data is being entered correctly before proceeding
Caprice Ware
Caprice Ware has been an SAP HR consultant since 1995. She has a breadth of knowledge in many areas of HR but focuses mainly on PA, BN, OM, PD, and self-service modules. Her experience as a project manager, configuration expert, and trainer has allowed her to support projects on a global basis. She currently is an independent consultant.
You may contact the author at capwarecns@msn.com.
If you have comments about this article or publication, or would like to submit an article idea, please contact the editor.