You are on page 1of 9

Processing IDOC through LSMW

Applies to:
For more information, visit the ABAP homepage.

Summary
LSMW stands for Legacy System Migration Workbench. This tool is used to transfer data from either legacy or application to SAP. In below scenario, the data is transferred to SAP via IDOC using LSMW. Author: Bathula Banu H

Company: Wipro Technologies Limited Created on: 9 September 2010

Author Bio
I have 3+ years of experience in ABAP. Worked in modules like HR, FI and PS.

SAP COMMUNITY NETWORK 2010 SAP AG

SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com 1

Processing IDOC through LSMW

Table of Content
Processing IDOC through LSMW ....................................................................................................................... 3 Step 1: Tcode: LSMW. .................................................................................................................................... 3 Step 2: Maintain Object Attributes .................................................................................................................. 3 Step 3: Maintain Source Structures ................................................................................................................ 4 Step 4: Maintain Source Fields ...................................................................................................................... 4 Step 5: Maintain Structure Relations .............................................................................................................. 5 Step 6: Maintain Field Mapping and Conversion Rules .................................................................................. 5 Step 7: Specify Files ....................................................................................................................................... 5 Step 8: Assign Files ........................................................................................................................................ 6 Step 9: Read and convert the data ................................................................................................................. 6 Step 10: Start IDoc Generation ....................................................................................................................... 7 Step 11: Start IDoc Processing ....................................................................................................................... 7 Step 12: Create IDoc Overview ...................................................................................................................... 8 Step 13: Start IDoc Follow-Up ........................................................................................................................ 8 Disclaimer and Liability Notice ............................................................................................................................ 9

SAP COMMUNITY NETWORK 2010 SAP AG

SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com 2

Processing IDOC through LSMW

Processing IDOC through LSMW


The below steps explains on how to transfer data from legacy system to SAP via IDOC using LSMW tool. Step 1: Tcode: LSMW. Click on settings IDoc Inbound Processing.

In the below screen maintain the File port (WE21), Partner Type (LS) and Partner Number (WE20).

Design the Partner: a. Create custom basic type, message type using tcode WE30 and WE81 respectively. b. Link message type and basic type using tcode WE82. c. Create logical system using tcode BD54. d. Create an inbound function Module to link it to process code via We42. e. Maintain the function Module through BD51. f. Link the Basic Type, Message Type and function module using tcode WE57. g. Maintain partner profile in WE20 for partner RECEIVED. Create a project, sub project and object as shown tcode LSMW. Multiple process steps will now be available. Click on the first step and execute again. The first process step is Maintain Object Attributes. Step 2: Maintain Object Attributes Select the radio button IDoc and give the corresponding Message type and Basic Type. In this scenario, Basic Type: Y10_EMP_TABLE and Message Type: Y10_EMP_TABLE are created for this purpose. Save and go back.

SAP COMMUNITY NETWORK 2010 SAP AG

SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com 3

Processing IDOC through LSMW

Step 3: Maintain Source Structures Create a source structure with any name as shown below by clicking on the Create button in application toolbar. Save and Go back.

Step 4: Maintain Source Fields Create an input structure. This structure should be same as the input file which has to be uploaded from either legacy or application. There are multiple ways to create a structure. Fields can be created one by one or all at a stretch by using the buttons Create Field or Table Maintenance respectively. Save and Go back.

SAP COMMUNITY NETWORK 2010 SAP AG

SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com 4

Processing IDOC through LSMW

Step 5: Maintain Structure Relations Maintain the structure relation by using the button Relationship in application toolbar. By default the structure relation exist between the IDoc segment and the source structure.

Step 6: Maintain Field Mapping and Conversion Rules Link the source fields to IDoc segment fields by clicking on the button Source field in application toolbar. Save and go back.

Step 7: Specify Files Specify the location of the input file. In this scenario, the input file is placed in the presentation server.

SAP COMMUNITY NETWORK 2010 SAP AG

SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com 5

Processing IDOC through LSMW

While specifying the file, specify the separator and other relevant parameters as required by clicking on Create button in application toolbar. Step 8: Assign Files Assign the input file to the source structure created by using the button Assignment . Save and go back.

Step 9: Read and convert the data The below screen shot displays the number of records read from the input file.

SAP COMMUNITY NETWORK 2010 SAP AG

SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com 6

Processing IDOC through LSMW

The below screen shot shows the number of records converted to source structure format from the input file.

Step 10: Start IDoc Generation The IDoc gets generated with the data available in the converted structure from the above step. Once the IDoc is generated, the below message is obtained.

Step 11: Start IDoc Processing IDoc gets Processed in this step. The IDoc is processed based on the code written in the inbound function module. The first screen is displayed in the screen would be almost same as WE02/WE05. The Logical system (Partner) and partner type specified in step1 appears here. Execute it.

SAP COMMUNITY NETWORK 2010 SAP AG

SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com 7

Processing IDOC through LSMW

The Message above shows that the document is posted. Kindly check the relevant table for data update Step 12: Create IDoc Overview To have a look at the Control record, Data Record and Status Record execute this step. The screen obtained in this step is same as WE02/WE05.

Step 13: Start IDoc Follow-Up In case of any error/Warning use this step to reprocess or follow up.

The above are the steps best describing to post IDoc using LSMW tool. Using this method, large volume of data can be posted to SAP.

SAP COMMUNITY NETWORK 2010 SAP AG

SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com 8

Processing IDOC through LSMW

Disclaimer and Liability Notice


This document may discuss sample coding or other information that does not include SAP official interfaces and therefore is not supported by SAP. Changes made based on this information are not supported and can be overwritten during an upgrade. SAP will not be held liable for any damages caused by using or misusing the information, code or methods suggested in this document, and anyone using these methods does so at his/her own risk. SAP offers no guarantees and assumes no responsibility or liability of any type with respect to the content of this technical article or code sample, including any liability resulting from incompatibility between the content within this document and the materials and services offered by SAP. You agree that you will not hold, or seek to hold, SAP responsible or liable with respect to the content of this document.

SAP COMMUNITY NETWORK 2010 SAP AG

SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com 9