bodsexpert
bodsexpert

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.

LSMW

Step 2 - Define Object Attributes

LSMW

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.
LSMW

2.2 - Create Recording File

  • Click on Create button to create new Recording file.
LSMW

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.
LSMW
  • Choose the Basic data only as it is always the first tab. Note that position of the tabs are dynamic it gets changed according to the material type. So recommended way to choose the required tab is to choose from the list of tab.
  • LSMW
    

    2.3 - Material Change Step 2

    • Select the tab called MRP1 from the list.
    LSMW
    

    2.4 - Material Change Step 3

    • Enter plant and storage location
    LSMW
    

    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.
    LSMW
    

    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.
    LSMW
    
    LSMW
    

    2.7 - Choose Recording

    LSMW
    

    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.

    LSMW
    

    Step 3 - Define Source Structure

    LSMW
    

    3.1 - Create a source structure

    LSMW
    

    Step 4 - Define Source Fields

    LSMW
    

    4.1 - Add Source Fields

    Copy list of the fields you prepared in an excel and paste here.

    LSMW
    
    LSMW
    

    4.2 - Source Fields List

    List of the fields are shown. Click on Save and come back.

    LSMW
    

    Step 5 - Define Structure Relation

    LSMW
    

    5.1 - Create Structure Relation

    LSMW
    

    Step 6 - Define Field Mapping and Conversion Rules

    LSMW
    

    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.
    LSMW
    
    LSMW
    
    LSMW
    
    LSMW
    

    Step 7 - Specify Filess

    LSMW
    

    7.1 - Prepare Source File

    Prepare source file in order to prepare the data.
    LSMW
    

    7.2 - Choose File

    LSMW
    

    7.3 - File Setting

    LSMW
    

    Step 8 - Assign Files

    LSMW
    LSMW
    

    Step 9 - Read Data

    LSMW
    LSMW
    

    Step 10 - Display Read Data

    LSMW
    LSMW
    

    Step 11 - Convert Data

    LSMW
    LSMW
    

    Step 12 - Display Converted Data

    LSMW
    LSMW
    

    Step 13 - Create Batch Input Session

    LSMW
    LSMW
    LSMW
    

    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.
    LSMW
    LSMW
    LSMW
    
    

    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.