Check this document useful for creation of Header data in specification management.
Steps to create a simple LSMW for EHS
The LSM Workbench is an R/3-based tool that supports you when transferring data from non-SAP systems (“Legacy Systems”) to R/3 once or periodically.
The tool supports conversion of data of the legacy system in a convenient way. The data can then be imported into the R/3 system via batch input, direct input, BAPIs or IDocs.
Furthermore, the LSM Workbench provides a recording function that allows to generate a “data migration object” in an entry or change transaction
To start working with the LSM Workbench, use transaction LSMW:
Click on the create button to create new project, subproject and the object. As shown below.
Project, Subproject and Object:
On the initial screen, you can create a new project, corresponding subprojects and objects via Edit -> Create new entry.
– Project: An ID with a maximum of 10 characters to name your data transfer project. If you want to transfer data from several legacy systems, you may create a project e.g. for every legacy system.
– Subproject: An ID with a maximum of 10 characters that is used as further structuring attribute.
– Object: An ID with a maximum of 10 characters to name the business object.
In the initial screen, All objects provides a list of all projects created already. My objects displays a list of all objects you created personally. All objects of the project displays all objects of the selected project as tree structure. Project documentation displays any documentation written for the individual popups and processing steps. you can print the project documentation out, send it and save it in various file formats.
Click on the execute button once the project, subproject and the object are created.
Click Back.Now record usingBatch Input RecordingData Migration – Step by Stepvia Batch Input Recording
Step 1: Maintain Object attributes
In this example, you will be updating the Specification master records with the help of recording a transaction (CG02). Choose radio buttonBatch Input Recordingand click on the recording overview icon to record the R/3 transaction. Enter theRecordingname asCG02_REC1, the description asCG02 Recording method, and the transaction code asCG02.
Note that the fields are populated with default values. The values you entered when you recorded the transaction are set by default.
Click on default all
Click on SAVE to save the recording. The click on BACK icon to the main screen. Save the while going back to the main screen.
After completing the recording the system will automatically take you to the second step as shown below:
Save the source structure and go to the main screen.
Step 3. Maintain Source Fields
In this step, you need to list what fields are present in the source structure. The easiest way is to click on ‘Table
Click on Object Overview
And Click on Table
Click CTRL + Y Copy to excel
Make Excel file ready like this
Maintenance’ icon to enter Field name, Type and Length for each field as shown:
Click on Hit list icon
Copy the Excel made items into this screen directly
Save while coming back to the main screen.
Step 4: Maintain Structure Relations
Execute a step to ‘Maintain Structure Relations’. Since, there is only one Source and Target Structure, the relationship is defaulted automatically.
For constant field like NAM LANGU click on constant give required language example EN
Once all the fields are mapped, you should have an overview screen as shown
Step 6: Maintain fixed values, translations, user-defined routines
You can also maintain re-usable translations and user-defined routines, which can be used across conversion tasks. In this case, that step is not required.
Step 7: Specify files
In this step, we define how the layout of the input file is. The input file is a [Tab] delimited with the first row as field names. It is present on my PC (local drive) as C:\TransOil.txt.
Double Click on the legacy data
****The Structure of the flat file should be proper otherwise data will not be uploaded.. All the mandatory fields should be present in the flat file for the required transaction
Step 8: Assign files
Execute step ‘Assign Files’ and the system automatically defaults the file name to the source structure.
Save while going to main screen.
Step 9: Read data
In this step, LSMW reads the data from the source file (from your PC’s local drive). You have the option to read only selected rows and convert data values to internal format.
Here 1 to 23 represents the number of rows to be read from the flat file. If you don’t specify any number the system will read all the rows from the flat file. We have 23 rows in the flat file hence from 1 to 23.
After we execute the data read from the flat file is as shown below.
Step 10: Display read data
This step is optional. If required, you can review the field contents for the rows of data read.
Click BACK to come back to main screen.
Step 12: Display Converted data
Again this is an optional step to view how the source data is converted to internal SAP format.
Step 13: Create batch input session
Once the source data is converted in an internal format, you can create a batch session to process updates.
Click EXECUTE button to execute a batch inout session.
Step 14: Run Batch Input Session
You can execute the BDC session by Run Batch input session. Executing a batch input session is a standard SM35 transaction for managing BDC sessions. Once you have successfully executed the batch input session, the Specification master records are updated in the system. You can confirm this by viewing the Specification master records
Select the session and click on the PROCESS icon.
You can Process the session in foreground or background or can only display errors.
Select the Processing Mode and then click on the PROCESS tab to executive the session.
After the session is completely processed you can confirm this by viewing the Specification master records (CG02) or in the table.