Beruflich Dokumente
Kultur Dokumente
OVERVIEW
SAP has made available a transaction, LSMW, which drives the Legacy System Migration Workbench tool. This tool enables the user to: 1. record the execution of many different individual SAP transactions 2. map the transactions fields to columns in a spreadsheet 3. execute the recording to read the data file and repeatedly pass the data to a designated SAP transaction for processing This enables the user to use the tool to do mass processing, all without having to manually enter data one transaction at a time, while still subjecting the input data to required SAP editing before saving each record. The tool has many features and capabilities, but the purpose of this course is to provide you with a basic understanding in how to use the tool to perform mass processing for the majority of your needs. As you can envision, this process could be used for: a)mass change of production data 2)setting up training data 3)converting legacy systems data 4)..and others In order to use the tool, you must have both the LSMW transaction and a transaction that matches what you enter in the Project field. In our example, PROJ is being used, so a PROJ transaction must be in a role attached to your user ID.
COMPONENTS
The LSMW tool is made up of basically three major components: 1. A recording of the screens and fields used in a given transaction 2. A multi-step process whereby that recording is married to the process, input fields mapped to screen fields, and creation of batch/online processing jobs, and subsequent execution of those jobs 3. 3-tiered library wherein the multi-step processes are organized and stored
PROCESS OVERVIEW
If you are starting fresh in LSMW, you must first establish the hierarchy of your library. The library is made up of two upper-levels of structure, with your transaction processs name making up the third level. Below is an example:
Once the Project and Subproject structures have been established, it is no longer necessary to go through the create steps and you can simply enter the upper two levels of hierarchy followed by an Object name for your new LSMW process to create it, or an existing one to execute it.
3.
4.
Trigger the LSMW transaction to get to the above screen. IF you are building a new structure, enter the desired Project identifier, the desired Subproject identifier, and the name of your first Object process. Position the cursor on the Project field so that it turns yellow. Click on the Create icon
Enter the description you wish for the first level of your structure. Click on the Green Check icon to save it and return.
4.
Highlight the Subproject level. Click on the Create icon once again. Enter a description for the Subproject. Click on the Green Check again.
2.
3.
The system will return you to the library hierarchy screen, with your new object shown. If you are simply creating a new Object in an existing library, you would only go through the last step to enter the new Object name. At this point, you are finished with the creation of your process library setup.
3.
4.
The input file must be a .TXTformatted file. It can have a header record in it. This record can be ignored by the record reading. If there is a field that is being changed and is always the same value, you can either have it in the input file or define it as a constant when executing the process. The file can contain values that will not be used in the process execution.
3.
When the sub-cell shown here appears, enter a recording name and a description. The recording name must be contiguous alpha-numeric characters with no spaces in the name Click the Green Check.
3.
When the screen to the left appears, enter the desired SAP transaction you wish to execute and record. Note: Certain transactions in SAP (such as CJ20N) will not record successfully and as such you must use alternative transactions to achieve your objective. In this example we are changing persons responsible in project wbss so we are using transaction CJ02 instead of CJ20N. Click the Green Check.
The system returns a screen with the single wbs on it. We then click on the RESPONSIBILITIES tab to get to the Person Responsible field
In this example, we change the person responsible to 1322. In this example we want to change the costing sheet, so we click on the tab containing it and change it to the desired value. Then, having completed our work, we click the SAVE icon. If there were other fields to be changed as well, we would proceed through the screens making the changes before doing the SAVE.
The system will then return the screen shown here, reflecting all fields that it used in the process. Click on the DEFAULT ALL icon to have the system save all of the fields to the recording.
4.
The system will expand the description of all fields. Click on the SAVE icon. The system will return a message indicating that the recording has been saved. Click on the Green Arrow to go back.
The system will show the list of recordings again, with your recording temporarily showing at the top of the list. NOTE: If for any reason you wish to delete your recording, simply highlight it and click on the trash can icon at the top of the screen. You may then go through the recording process again to recreate it. Click on the Green Arrow to return.
The system will return you to the process screen. Making sure that your Object name is the one you created earlier, click on the EXECUTE icon to start the process.
The system will then display the screen to the left, showing all of the possible steps that can be executed. We are going to use a select group of them and ignore others.
NOTE: As you execute each step, the system will timestamp to the right of the step AND will increment the radio button to the next one in the list.
MAINTAIN OBJECT ATTRIBUTES Used to tie the recording to the processing session MAINTAIN SOURCE STRUCTURE Used to define a structure under which we will list all of the fields coming in in the input file MAINTAIN SOURCE FIELDS Here we enter each of the input fields from the input file. MAINTAIN STRUCTURE RELATIONSHIPS This step then ties the defined structure of input fields to the recording MAINTAIN FIELD MAPPING In this process we tie the input file fields to the SAP recording screen fields. We also specify any constant values for certain SAP recording screen fields. SPECIFY FILES Here we specify where the input .TXT file is stored on our PC so that the process can find it when the execution starts.
ASSIGN FILES Ties the input file to the process READ DATA Reads the data from the input file into a temporary storage file known to the process DISPLAY READ DATA Displays a listing of all of the records read in from the input file and displays the columns of data you identified earlier. Any columns of data in the input file but not identified earlier will not be displayed. CONVERT DATA This takes the read data and converts it into a format that can be read in by the actual SAP transaction that will be using the data. DISPLAY CONVERTED DATA As part of the conversion process, SAP brings in not only the input fields from the input file, but adds other data values it needs. All of these fields will be shown here, including any constant values that you may have specified.
CREATE BATCH INPUT SESSION This step reads in the converted data and sets up a batch input session for processing RUN BATCH INPUT SESSION This step allows you to then execute the actual mass update. This feeds the batch of data, along with the recorded transaction code, to SAP for processing. There are three options for execution which will be described further ahead.
The system will then display a CREATE icon. Click on the CREATE icon.
We are now ready to start defining the list of data columns in our input file. In this example, all we are going to need is the wbs number and person responsible, but since the project defintion is to the left of the wbs number, we must define it. Enter a Field Name for the Project Def, along with a description. Enter a length value at least as big as the number of characters for the field in the spreadsheet. Entry of a number smaller will result in dropped characters when reading the input file. Leave the Field Type set to C (Character). Click on the Green Check.
When the system increments to the above step, click the Execute icon. When the system presents the screen to the left, click on the Display/Change (pencil) icon. Simply Click on the SAVE icon. This will then tie the structure with its fields to the process. Click on the Green Arrow to return.
When the system sets the radio button to Maintain Field Mapping, execute it. The system will display the screen shown here. Click on the Display/Change icon to get to Change mode. The system will display all fields that were touched during the recording. We are now ready to tie the screen field names to the input file fields. Highlight the first field, the WBS, and click on the Source Field.
Select the WBS field by doubleclicking on it. We will not use the PROJDEF field since, even though it is in the input file, we do not need it as input. Click on the Green Check.
6. SPECIFY FILES
Click on the Specify Files radio button to skip past the Maintain Fixed Values process. We are not using it. Click on the Execute icon.
6. SPECIFY FILES
The system will take you to the screen to the left, in Display mode. Click on the Display/Change icon to move to Change mode.
6. SPECIFY FILES
We are now ready to provide the input file name to the process. Double click on the Legacy Data field name with the subtitle On the PC. The sub-cell shown to the left will appear.
6. SPECIFY FILES
Enter the input file name in the FILE field by using the pulldown function to find the file on your PC hard-drive. Enter a description of the input file. Click on the TABULATOR radio button. This is critical. If you do not, the system will string all columnar data together into one column and feed it to your process and your process will fail. Click on the Green Check to return.
7. ASSIGN FILES
When the system returns to the process screen and the radio button moves to the Assign Files line, click on the Execute icon. Click on the Display/Change icon to move to Change mode. Click on the SAVE icon. Click on the Green Arrow to return. This process will tie your input file to the process structure.
8. READ DATA
When the process screen positions itself on the Read Data line, click on the EXECUTE icon. The system will display the screen to the left. In order to keep relative record numbers constant, we want to read the entire file. We will however only convert portions of the read file. Click on the EXECUTE icon.
8. READ DATA
The system returns a report which shows the number of records read from the input file. In this case, it will include the data as well as the header record. We will bypass the header record during conversion. Click on the Green Arrow TWICE to return to the process screen.
The system then displays all of the fields from the read record selected. Notice that the system shows only the fields read in from the input file. The constants field values will be brought in later since they were not part of the input file. Click on the Green Arrow to return.
NOTE: If at a later date you re-read your input file, it is not necessary to re-display the data if you are confident it has not changed in displacement. The purpose of this screen is to simply verify that you have the fields properly aligned and defined.
Execute the Convert Data step in the process. The screen to the left will appear. If this is the first time you are running the conversion step, you should only convert one or two records as you will be monitoring their use coming up and, if you have data problems, you only want to deal with a few records. In this example we have selected record 3 since record 1 is the header, and we used record 2 during the recording. Click on the EXECUTE icon.
Execute the Display Converted Data step in the process. The first time you execute this, leave the From Line and To Line blank since we have just converted only a couple of records to test our LSMW process. Click the Green Check.
The system will display a listing of the converted records. Double-click on any one of them.
The system will present you with three options for executing your batch. The first time you execute a new recording, select either the PROCESS/FOREGROUND or the DISPLAY ERRORS ONLY option. By selecting the Foreground one, the system will take you through every field that is being updated, requiring you to click on a Green Check icon in sub-cells as it touches each field. If you choose the Display Errors Only option, the system will attempt to process all of the records you converted.
If it successfully processes the converted records, you will see the screen to the left. Click on the Exit Batch Input icon and it will complete the process and take you back to the main menu in SAP. If the conversion fails, the system will stop on each of the fields in error and allow you to manually enter a correct value. If your process fails during your test, then it is most likely that you have either not aligned your input file layout with the input file or have not tied the input file fields with the SAP field names properly.
A listing similar to what is shown here will appear. It lists each record read in and indicates whether or not it was processed successfully. Sometimes it shows the key of the record being processed.other times not.based on the particular SAP transaction you are executing in your LSMW.
1. SETTING UP A STRUCTURE
2. CREATING A RECORDING
ADDITIONAL TECHNIQUES
PROCESSING LARGE AMOUNTS OF DATA
When processing large volumes of data through LSMW, it is recommended that you use the loop steps of:
1. Convert data 2. Create batch processing session 3. Process batch processing session .to convert slices of the data read in and feed that to SAP in sections. For example, if you had 30,000 records to process, cut the data up into 5,000 increments and feed each one of them into individual batch processing sessions. This is done by specifying the range of 2-5000, then 5001-10,000, then 10,001-15,000, etc. during each conversion step, and releasing each batch session, until you have processed all 30,000 records. You can then review each of the batches to see if you had any errors and deal with them.
ADDITIONAL TECHNIQUES
POSITIONING
If, while doing the recording, you are reading certain structures such as Project wbs structures or cost center hiearchies, you must deal with the fact that the record you seek can be down in the stack, you can bring it consistently to the top line of the screen so that you can then select it for processing, by using the path: >Select Object >Position, and then entering the key of the record you wish to have LSMW work with.
ADDITIONAL TECHNIQUES
STOP SESSION
If you are in the process of testing your recording by feeding it a small stack of records and it locks up with an error, you can exit LSMW and let the session end by entering /BEND in the command line at the top of the SAP screen and hitting the Enter key.
ADDITIONAL TECHNIQUES
BATCH SESSION DELETION
If any of your batch sessions have any errors in them, they will remain in the system and must be deleted . Once you have dealt with the session and handled the errors in it, access the list of batch sessions via step 13, Execute batch sessions, and select that session. Then click on the trash can to delete the session and clean up your file of sessions. Otherwise, the list can grow and possibly cause space problems for you.