I have had a chance to work on multiple projects where we have uploaded assets using LSMW. Even in cases where Z programs exist for asset upload, many times the documentation does not exist and much effort is lost in trying to understand and modify how the program works. So, LSMW seems an easier solution as it does not take much effort to build one even from scratch. This document shows steps to build a simple LSMW to upload assets where the fields to be uploaded are standard.
Step 1: Create Project, Subproject and Object for the asset transfer. A project or subproject already exisiting in the system could also be used to create the object. For a scenario where we are migrating a company code from Legacy to SAP, we could use the same project and subproject and create different objects for uploading vendors, assets, customers etc.
Use the create button on the top of the screen to start.
Step 2: Enter the project, subproject and object name and click on execute.
On the overview screen, select the “create recording” button to start the recording by giving a name and description.
On the next screen that appears, enter transaction code AS91. We will not use transaction AS01 to create asset because we are creating a legacy asset. Using AS91 will allow us to enter carry over values for asset from the legacy system.
After entering the transaction code, transaction AS91 initial screen is displayed. Enter data for a sample asset and carefully fill only the fields required. The fields filled/changed for the sample asset would be captured in the target structure for the LSMW as shown below. Once ascertained that all the fields are captured, use the Default All button to default the fields to the target structure. The target structure is nothing but the list of fields which SAP is expecting will be provided values with for creating assets through LSMW. In case it is felt that the recording was not done correctly or fields were missed, use the repeat recording button to repeat the recording and capture the correct fields. It is always recommended to create the LSMW in Test system, so that repeat recording can be done as many times as possible and the sample assets thereby created do not effect as much as if it were done in the Production system. Once it is ascertained that the LSMW is working fine in the test system, it can be exported and imported to the Production system.
Step 5: Execute “Maintain Source Fields”
Create Source fields for the source structure. Source structure is the structure of the file used to load data into SAP through LSMW
Step 7: Execute “Maintain field mapping and conversion rules”
This step is used to map the source structure field from which the value is input to every target structure field. All the target structure fields must be mapped in this step. Click on the target structure field and use the Create Source field button to assign
Step 8: Execute “Maintain fixed values, translations, user defined routines”
Step 9: Execute “Specify Files”
The input file is on the computer. Click on the “Legacy Data : On the PC” and use the Add entry button to specify files.
Enter parameters as needed and save. Special attention needs to be paid to the check box “Field Names at start of File” to see if the input file has the first row as field names or not.
The below screenshot shows the sample file used. As can be seen, the fields in the excel match the fields in the source structure. Since, we specified a text file as the input file in Step 9, the below excel needs to be converted to a .txt file before data can be uploaded.
Step 11: Execute “Read Data”
This step reads the input file from the location specified. Generally, we read all the rows from our input file. So, no transaction numbers are specified.
The whole file is read and as seen in the status below, 9 transactions have been read.
Step 12: Execute “Display Read Data”
In this step, all the records read from the input file are displayed.
Double click on a row to see the field values read against each of the fields in the source structure.
Step 13: Execute “Convert Data”
Since we need all the records read from the input file to be converted to the target structure, no transaction numbers are specified.
All the 9 records are converted as shown in the screenshot below.
Step 14: Execute “Display converted data”
All the records converted to the target structure are displayed.
Step 15: Execute “Create Batch Input Session”
Specify the Name of the Batch session. Do not forget to select checkbox “Keep batch input folder” so that logs for the batch input session can be analyzed once the session processing is complete.
A message with number of records read for asset upload is displayed as shown below.
Step 16: Execute “Run Batch Input Session”
Click on the batch input session and choose to execute in foreground or background. Once the session is executed successfully, the assets are created in SAP and the asset numbers can be seen in the log for the batch input session.
I have published another document with important SPRO setting to be done before asset upload –> SPRO Settings for Legacy System Asset Data Transfer