Step-by-Step Guide for using BAPI in LSMW Note! The screen prints in this article are from ECC 5.0. They may differ slightly in other versions. Introduction: This document details the usage of BAPI in LSMW. We have used the example of migration of the purchase order data into SAP. Pre-requisites: It is assumed that the reader of this article has the minimum knowledge required on the Business Object, BAPI, Message Types and IDoc Types. Step-by-Step Procedure: Details of the BAPI used in this scenario: Business Object: BUS2012 Method: CreateFromData Details of Message Type and Basic IDoc Type: Message Type: PORDCR

Basic IDoc Type: PORDCR02 Let’s have a look at the BAPI first, before proceeding to the LSMW: 1.Go to Transaction BAPI 2.Click on Search Button 3.Enter the value “BUS2012” and select “Obj.type(Technical Object Name”

Following screen appears: .Press ENTER 5.4.

On the left side of the screen.6. . 7. Expand the “PurchaseOrder”.Select “PurchaseOrder” and double-click on the same for details.

Go to Transaction LSMW. 2. . Subproject and Object information and click on CREATE.Building LSMW using BAPI: 1. Enter the Project.

4. Subproject and Object as prompted. Enter the descriptions for Project. Now select Settings  IDoc Inbound Processing .3.

Click on “Activate IDoc Inbound Processing”. Click on “Yes” when prompted for “Activate IDoc Inbound?” . “IDoc Inbound Processing” screen appears. Enter the required details as shown below 6. 7.5.

Hit on “Back” to return to the main screen. 9. Following Screen appears: 10. Click on Continue (F8). .8. Select the Step 1 “Maintain Object Attributes” and select “Execute”.

11. Select the radio button “Business Object Method” and enter the following details: Business Object: BUS2012 Method: CreateFromData Hit ENTER .

Follow popup appears: . we need to maintain the source structure. 14. Now sel HEADERDATA and click on “Create” again to create the child structure.12. lets consider example of a file with 2 structures Head and Item data as shown below: Click on Create and name the source structure as HEADERDATA. Now select step 2 “Maintain Source Structures” and click “Execute”. 13. In this step. Following information message is displayed. In our example. Save and click on BACK button.

Enter the Item data structure name. 16. Click Save and hit BACK button to go to the main screen. Enter the fields as shown below: 17. 15. .Select “Lower Level” and click on Continue. Click SAVE and return to main screen. Select step 3 “Maintain Source Fields” and hit execute.

E1BPEKPOC and E1BPPEKE . Select E1PORDCR and click on CREATE RelationShip. Select step 4 “Maintain Structure Relations” and click Execute. Following screen appears: Select HEADERDATA and hit ENTER Similarly do the same for the structure E1BPEKKOA.18.

Click Save and return to main screen. Select the step “Maintain Field Mapping and Conversion Rules” and click on execute Field Mapping as seen below: . 19.


Select step 7 “Maintain Source Files” and provide the link for the test file created. 21. Select the step “Assign Files” and click on Execute. Assign the file provided to the source structure. file with the same structure as defined earlier). .20. Here the same file is provided for both the structures. Save and return to main screen.

Save and return to the main screen. . 22. Select the step “Read Data” and click on Execute. Click on Execute.

24. Return to main screen and now select “Convert Data”. 23. Select the step “Display read data” and click on execute. Click on the structure name to get the field level values. .Return to the main screen.

25. 27. . 26. Return to the main screen and select “Display Converted data”. Now select the step “Start IDoc Processing” on the main screen. Return to main screen and select “Start IDoc generation”.

Here the data record and status records of the IDoc could be viewed: .28. Return to main screen and click on “Create IDoc overview”.

Sign up to vote on this title
UsefulNot useful