This action might not be possible to undo. Are you sure you want to continue?
Legacy System Migration Workbench or LSMW is SAP standard program that can be used to easily load / change master data or transactions in SAP without any programming at all. It canbe used to upload data at cutover, such as: open orders, contracts, materials, vendors, stock on hand, ....... It can also be used in a production system to make changes to existing data. Very limited authorisation checks are available on the transaction, so the use of it must be very well controlled. The functionality is very well documented in the SAP help files. Below is a simple example where vendor masters are loaded using recording in LSMW. (For an example on how to load materials using Direct Input method in LSMW, see this post) In our example, we will follow these steps. Start program and create a project Record the transaction to be used in the load Define the fields to be loaded Define conversion rules to take place Define the file name Upload the file from PC to SAP Convert to correct format Create and run batch input session
---------------- DETAIL ----------------Start it all by executing transaction LSWM (program /SAPDMC/SAPMLSMW ). Define Project / subproject / Object. It is also possible to export the project to a text file, to be imported into another system.
Various methods can be used to load the file (BAPI, ALE, recording ….). We will be using a recorded transaction. To record the transaction, we give the recording a name and type in the transaction code that will be used.
Step through the screens as you would have done it manually.
. Make sure all the fields you want to load/change are in the list. If not. To keep it simple. allocate the default SAP name to the fields.A screen will be shown with all the fields that was recorded. Every field needs a name. re-record the transaction and ensure you do a dropdown or type in values in the correct field.
4. 13.Here is a list of all the process steps that available. 9. Those to be used in example are mark with a red dot. So. 3. In our example. 12. 7. 5. 8. we will be using Process Step 1. . 11. not all will be used.
NB: Every time you select a process step. you will be in display mode -. Process Step 1 .The next screens are the process steps as in screen above. if you want to load a huge amount of materials. We will be using a BDC sesssion / recorded transaction. For example. . ather use direct input method.first thing to do for every step is to switch to change mode by clicking the "Display<->Change" button. This method is quick to do but not the fastest.Maintain Object Attributes Here the method to be used to load the information is defined.
A setting in Process Step XX will ensure that order of columns is not important. use same field names as in recording. Again to keep it simple.Process Step 3 . The text file can easily be created from Excel or other data tool.Maintain Source Fields The next step is to ensure your input file is created. The input file (to be loaded in SAP) is a text file. .
it is better to get a better text editor and not used Notepad (as shown in screen below). the fields in external file is defined. so make them the same as in txt file. Back in LSMW. It is generally better to use tab delimited format to avoid errors (example where text fields may contain commas). If you will be using LSMW quite a lot.As can be seen – in our case we used comma delimited text. .
.Maintain Structure Relationship Link between recorded fields and external fields.Process Step 4 .
Process Step 5 . .Maintain Field Mapping and Conversion Rules In this step the rule on where the value of the recorded fields will come from is spesified. Example: values can come from an external file or a constant can be defined (for fields that will not change).
Vendor account group will not be read from external file.. Lets make the field a constant value of LIEF. .
In this case comma delimited . one specifies the structure.Specify Files Before loading the file from PC.Process Step 7 .
were used (although. . Also that the first row contains the header. tab delimited are more common).
Read Data Load the file into SAP from your PC. So after this. .Process Step 9 . all the fields to be loaded must be present and all rules applied.Convert Data This applies the conversion rules that was set up in Process Step 5. Process Step 11 .
Process Step 12 .Display Converted Data It is a good idea at this stage to view a sample set of the data to ensure that everything is ok. .
Create Batch Input Session Generate a batch input session .Process Step 13 .
the data should be in SAP! To confirm that the data was loaded correctly.And process the batch input session. Thats it. . verify that vendors were loaded correctly.
2004 (Menu: Extras > Display Display version) You can discuss this article here.0 of the LSM Workbench from 31.SAP version used for this post: SAP ECC (ERP Central Component) 5.0.08.0 LSMW version used: version 4. .
see attachment at end of post. Import Project Download project as attachment from end of this post to your PC. Steps to take Create text file with data to be loaded Set up and run LSMW All steps are discussed in this post. Please take note that my project and input file will need slight modification to work fully on your SAP system. LSMW You can either create the LSMW project manually or load my project. To get going.INTRODUCTION It is a lot easier and quicker to load material masters using the Standard Direct Input object in LSMW rather than with a recording of transaction mm01 or mm02. number ranges. use my LSMW Project and data file and make changes as required to get a simple dataset loaded. I suggest you create the file from a database (SQL) or programmatically. For all the material types. field selections. see this post) One input file can be used to create all the views of the material master. A sample data file and LSMW Project can also be found in attachment (end of post). etc. Even if different views and fields are used for the different materials. (To learn more about loading data using recording. Excel does work but it sometimes convert numbers / strings (example 0100 becomes 100). Go to LSMW – transaction LSMW Menu: Extras > Import Projects select file LSMW_Z2_MM01. You will have different material types. Let’s first go through LSMW steps – then look at the input file. More notes about this at the end of this post. The most difficult bit in loading materials is getting the input file correct.txt .
Select Project / Subproject / Object and press “Execute” Step 1: Maintain Object Attributes With first option selected – press “Execute” Press “Display <> Change” to select Object .Press “Import” (or “Import Under Another Name”).
As a rule. make field size bigger than required.Step 2: Maintain Source Structures Step 3: Maintain Source Fields Define here all the fields that will be in your input file (text file with data). in this case mostly 40. keep the field names the same as in SAP. For simplicity. This way mapping can be done automatically. What fields can be included? See next step for that . The order of the fields is not important.
.Step 4: Maintain Structure Relations Here you map the one input file to structures that was selected in step one (direct input objects).
To get an idea what material master field can be loaded – click on the structure. Example for BMMH1 .
BMM00. The fields can also be viewed via ABAP Dictionary (se11 /se12) and display the database table BGR00. If your fieldnames in file is same as in SAP.You will see BMM00 is to select the Views and BMMH1 contains bulk of the material fields. BMMH2 (or other). then you can map them automatically by selecting Menu: Extras > Auto-Field Mapping . BMMH1. Step 5: Maintain Field Mapping and Conversion Rules Map field in input file to fields in SAP Material master.
User-Defined Routines Not used for this project . Step 6: Maintain Fixed Values. only those that you are loading (as defined in input file). Example material type must be 4 characters. Translations.Not all fields need to be mapped. Don’t worry to much about the warning that “Source field is longer than target file” just make sure your input data is correct.
Also indicate how your input file will look. .Step 7: Specify Files Specify source file (on your PC) and what the files will be called on the SAP server. TAB delimited and Field names in first row. Example.
You may want to . More about the input file later.Step 8: Assign Files Step 9: Read Data At this point your input file must be ready.
use sample file attached to this post as a start. This was done is step above. Step 10: Display Read Data The input file is now on the SAP server and can be displayed. For big files – many thousand of records this might take a while. . Note you don’t need to specify path / filename.
Click on line to see the details .
.Step 11: Convert Data We now need to convert the data to format so that SAP can process.
And select the structure to see details .Step 12: Display Converted Data You can display converted data to ensure that all is ok so far before creating the materials.
Step 13: Start Direct Input Program If all is OK – let’s run them in. do not update” option . First run it in test mode (not creating material) by selecting the “Check data.
You might get a view messages – just press OK. . In my case I got NO errors.
same as above but “untick” the “Check data.I now run it without the test option. do not update” option .
At this point you may still have errors. My editor is set up to show TAB characters. etc. TIP: if you will be working with LSMW files a lot.Materials were successfully created. Some suggestions are: UltraEdit or Crimson Editor (if you want a good free one). The funny “>>” fields are TAB’s. Either your input data is incorrect. etc. different material types. you may have fields as mandatory that was not in your input fields. This is how my input file looks (via Crimson Editor). . INPUT FILE In step 7 above we have indicated that we are using TAB delimited files. get a decent text editor.
Or in Excel (importing the tab delimited file) .
'X'.'/'.'MAT DESCRIP'.'/'.'F'. price. price_control. And 0 (zero) indicates that material being created will be extended.'001'. Fields to be ignored are marked with "/".'/'.'SAP123'.'/'.'A'.'X'. I used MySQL.'/'.'BIN'.'Y'. For more about format of file.100.Note that the material number field (MATNR) is blank for first line and 0 (zero) for subsequent lines.mat_type.'/'. val_class. '/'. .'02'. sloc.'/'. Below is the SQL statement (used in MySQL) that created the final data file.1.'HB'. This is the way to specify that internal numbering will be used. LAST NOTE ON PREPARING THE DATA (OPTIONAL) I find the easiest way is to prepare the material master data is using a SQL database.'500'. '/'.'/'.'X'.'B'. That way a sql script can be created that implement all the conversion rules. In my case I generated the tab delimited file directly from database program.1.1.'/'.'/'.'/'. see notes in SAP Help file.'/'.14.'/'.'/'. In my file.'/'.'/'. The header (field names) was added in another step.'/'.base_uom.'ND'. plant. This sample file used in this post was created directly from the database program. spreadsheet or other program.'0100'.'X'.'/'. '0'.'/'.1.'MM01'. The input file can be prepared using database. Code: SELECT 'MATLD'.'/'.'/'.'/'. every line is unique material / plant / sloc.'/'.1.
profit_centre INTO OUTFILE 'c:/data/sap123.0.'00010'. I hope you are in a position to load your own materials.txt' FIELDS TERMINATED BY '\t' LINES TERMINATED BY '\n' FROM main_table GROUP BY mat_number.0) With this sample and reading the SAP Help files. sloc ORDER BY mat_type.com/lsmw_direct/lsmw_directinput. goto http://help. Don't stress. For SAP Help files. sloc. Was this helpful to you? Do you require more information? . old_matnr. If above code is meaningless to you.com/ Cross Application Components > CA Data Transfer > Data Transfer Objects > LO logistics General > Material Master This post was prepared using SAP R/3 Enterprise (and LSMW version 4.'01'. plant.old_matnr. GETTING HELP FROM SAP Very detail help is available in SAP Help Files. you don't need to use any of this in LSMW.sap. (But I do suggest you buddy up with someone who knows SQL ). plant.
This action might not be possible to undo. Are you sure you want to continue?
We've moved you to where you read on your other device.
Get the full title to continue listening from where you left off, or restart the preview.