Create an LSMW Program for SAP Material Master
By Imran, Mohammad February 14, 2023 under LSMW
LSMW plays very crucial role when you have a field to update or no other loading method is working. It is least advisable as it cannot load hirerarichal data and very slow in terms of performance.
Step 1 - Create LSMW Project
Run the T-code LSMW and create LSMW Project. Once Project, Subproject and Object is created click on Execute.
Step 2 - Define Object Attributes
2.1 - Choose Recording Option
It records your activity so you should already know the process involves in the t-code you are going to run. In this example, we are going to see how we change some of the fields in MRP1 using MM02 T-code.- Bring it to Change Mode.
- Choose Batch Inpout Recording and click on Recording button.
2.2 - Create Recording File
- Click on Create button to create new Recording file.
2.3 - Material Change Step 1
We will change some of the fields from MRP1 table using t-code MM02 to demonstrate you.
- Enter the T-code as MM02 and hit enter. MM02 is used to change material data.
2.3 - Material Change Step 2
- Select the tab called MRP1 from the list.
2.4 - Material Change Step 3
- Enter plant and storage location
2.5 - Material Change Step 4
- Changed the required fields. In this example, we will change MRP Group, MRP Type and MRP Controller. Now click on Save.
2.6 - Fields Adjustment
You will have to adjust the fields as some additional would also come up here so you will need to delete them else they will ask for the input during execution.- Click on Default All to bring the fields and description on the fields.
- Delete all additional fields but ensure you are not deleting control fields or cursor fields.
2.7 - Choose Recording
2.8 - Prepare field list
You can prepare an excel sheet to list the fields in the order you see in the LSMW screen so that you do not have field mapping issue. Later on in the mapping step you can copy-pase the list.Step 3 - Define Source Structure
3.1 - Create a source structure
Step 4 - Define Source Fields
4.1 - Add Source Fields
Copy list of the fields you prepared in an excel and paste here.4.2 - Source Fields List
List of the fields are shown. Click on Save and come back.Step 5 - Define Structure Relation
5.1 - Create Structure Relation
Step 6 - Define Field Mapping and Conversion Rules
6.1 - Field Mapping
- Choose Auto Field-Mapping from the Menu bar Extra and Keep default setting as-is.
- Keep Accepting the proposal until the last field.
Step 7 - Specify Filess
7.1 - Prepare Source File
Prepare source file in order to prepare the data.7.2 - Choose File
7.3 - File Setting
Step 8 - Assign Files
Step 9 - Read Data
Step 10 - Display Read Data
Step 11 - Convert Data
Step 12 - Display Converted Data
Step 13 - Create Batch Input Session
Step 14 - Run Batch Input Session
There are three types of Processing Mode- Process/Foreground - It runs on the foreground when hit enter control moves to the next screen. It is recommended to test the first record before you run for all the records.
- Display Error Only - It runs in the background but screen pops-up when it encountered an error. It gives you an option skip the error or stop the execution.
- Backgroun - It runs in the background. You will be able to see the statistics once execution is completed.
Conclusion
You have successfully create an LSMW Program and loaded a record using a text file. LSMW is very use full when you have certain fields on to update on a single screen. You should be aware of the steps to enter on the SAP screen to change the field data like what is the t-code, how to navigate through the t-code and what data needs to be changed. Once all these steps are confirmed, run the same activity in the LSWM so that recording option can record your activity and give you source fields.