LSMW Step by Step Guide using Batch Data Input Method - SAP ABAP - Sap 4 All

Latest

Please enter your email and get the updates in your inbox.

Wednesday 22 June 2016

LSMW Step by Step Guide using Batch Data Input Method - SAP ABAP

Hi Guys,

LSMW which stands for Legacy System Migration Workbench supports conversion of legacy system data in a orderly and convenient way. Tool also allow you to import converted legacy data to SAP. There are several ways you can import legacy data to SAP using LSMW. 

  • Direct input
  • Batch input
  • IDocs
  • BAPI are some commonly used way to import theses legacy data.
In cut-over phase of the project cycle LSMW conversions are mainly used to import legacy system data to R3. But conversions/migrations can be reused according to requirement. 

Transaction to access this migration tool is LSMW. It is a tool that facilitates legacy data migration through a "Data Migration Object".

Data migration objects are logically segregated under Project and Sub Project hierarchy. For example you can have a Project named "R3 Implementation" with sub objects for each legacy system or Project name for each legacy system and sub project name for each type of data which are migrated. The naming and hierarchical representation depend on the complexity and scope of the requirement. 

Example shows how to create a LSMW which creates materials using batch input method. Check my blog on BDC to understand more on batch input method. We would be uploading tab delimited text file with material information which represent legacy data. Batch data recording to material creation transaction (MM01) would be called to upload this data. 

Upload file format







Go to transaction LSMW and set project name, Sub project name and object name.











LSMW provide a tool set to create the source data format, convert data, upload data, map source (text file) and target (MM01) and finally create BDC session.

To create a complete conversion/upload all these steps should be completed. Select the step and click "execute" to complete the step. You can move to the next step when you complete all previous steps before it.




How to complete each step shown below.

Maintain Object Attributes












Set import method as "Batch Input Method" and record the batch input for MM01. Click on "Recording Overview" button to start recording. 



Set recording name and transaction code.













Created recording. We will set material description, unit of measure, material group, material style and product hierarchy from text file input data. Industry sector and material type are set with default value.


You can maintain field names and default values of each field by double clicking on the field. Names will help you identify fields easily.












Maintain Source Structures

Set source structure name. This represent the row type of text file.


Maintain Source Fields

Complete the source structure by defining source structure (row type) fields. Easiest way is to select your source structure and click on "Table Maintenance". Now you can set field names, data type, length and description of each field.

























Save fields.

Maintain Structure Relations

Since this project has only one source and one target, system will automatically assign them together. In a more complex projects you may have to manually assign them depending on number of source/target structures.







Maintain Field Mapping and Conversion Rules

Here we map source fields with target fields. That is input file structure with MM01 target.

Select a field and click on "source field" then select the source field.


Map all fields similarly.


Maintain Fixed Values, Translations, User-Defined Routines

We can skip these as we do not have any conversions for legacy data.

Specify Files

This step set how the legacy data is extracted. You can extract from front end PC or from application server location. 

In this example we will upload from frond end PC.

Specify the file location, name and format. Set options depending on the field separator of import file and if field header exists or not.





Save go to next step.

Assign Files

Assign the source structure with the file specified in the above step. Since project only has one file and one source structure, system will automatically assign them. 











Save and move to next step.

Read Data

Read data from file.




Display Read Data

Display data read from the file.














Save.

Convert data

Convert data on conversion rules defined. This step will map the source data to target fields.

Display Converted Data

Display converted data.

Create Batch Input Session

Set the BDC session name and create batch session.

You can view the created session in batch input overview transaction SM35.


Run Batch Input Session

Execute the created session. You can execute in background or foreground. I am executing the BDC session in background mode and logging only the errors which occur.




Go to MM03 or table MARA to view the materials created by the session. You also view material numbers created from BDC session log in Sm35 transaction.

























There are several ways you can transport LSMW objects. Check my guide on transporting LSMW objects for more information.

2 comments:

  1. Hi,

    I was practising LSMW from this tutorial but stuck with an error in the final stage.

    "LEAVE TO TRANSACTION" is not allowed in batch input"

    Can you please suggest why I am getting this error?

    ReplyDelete
  2. Thanks for sharing this Information,

    Got to learn new things from your Blog on Sap abap.

    http://thecreatingexperts.com/sap-abap-training-in-chennai/

    Both online and classroom training is provided.

    Contact 8122241286

    ReplyDelete