Thursday, March 21, 2013

Search Help in Select Options of WebDynpro Application

If you are facing difficulty in viewing the document ,please view it from the following link :


Introduction :

In an SAP implementation the data from Legacy system needs to be transferred to SAP System. Also a lot many times there is a need of periodic data transfer between different systems. These can be achieved through LSMW /BDC. LSMW is a Non SAP to SAP communication tool whereas BDC is a SAP to SAP communication tool.

For BDC there is a explicit need of data mapping which is implicit for LSMW. For BDC in one go at max 999 records can be uploaded, there is no such limitation for LSMW. But we can schedule periodic job for BDC whereas LSMW has to be executed for once. Therefore for upload/upgrade of records below 5000 we use LSMW and above that we prefer BDC.

Also for BDC we can customize the code where as LSMW follow specific steps. So for functional consultants who do not perform coding LSMW is proffered.


To perform data migration from legacy database to SAP database, we use batch data communications (BDC).To perform data migration; following methods are available in BDC:

The above three methods require source code to perform data migration. There are predefined tools available to perform data migration with only
Minimal source code. They are:


 Using this method, we can perform bulk data transfer.
 No manual intervention is required for direct input method.
 Data migration time is very less.
 Since no manual intervention is required, we cannot correct the error
record during run time.
 This method can be used only during SAP implementation, not for
support projects.

Steps to be followed in Direct Input Method:
1. Collect data into an internal table from file.
2. En queue the table into which data is intended to be sent.
3. Loop the data table &. Insert the record into the table.
4. Dequeue the table.

Example on Direct Input Method

Extra care needs to be taken as there is no predefined method to handle the error out records.
In the above example enqueue and dequeue is not done. The same can be achieved using lock objects or predefined function modules like 'ENQUEUE_E_TABLE' and 'DEQUEUE_E_TABLE'.


Since we cannot modify the error record using direct input method, we go for call transaction method. Here, we create a table to populate error records  from the screen, we can modify the error records and then insert into database table.

Steps to be followed in Call Transaction Method:
1. Analyze the flat file which has the data to be uploaded to SAP. Fetch the data into an internal table.
2. Record the screen transaction sequence using transaction  SHDB.
    When we execute any transaction some screen appears and the screen usually have some input fields.   Now when we give proper values in the input fields and press execute some other screen/output  gets displayed. For certain transactions like SU01, PA30 when we provide the values in the screen fields and execute, the  values get updated in certain tables in backend. But at a time we can create only one record.SAP provides a screen recorder transaction  (SHDB) through which the screen sequence can be recorded and later the same can be used in a program to make the data entry automatic.
3. Loop the screen transaction sequence with the internal table having data from flat file.
4. Call the transaction.
5. Handle the error records.

In the above code,
BDCDATA is a structure used to populate the internal table records into the screen fields. The BDCDATA structure has following components:
PROGRAM - Holds the name of  program where the screen is created.
DYNPRO - Holds the screen number where the internal fields to be populated.
DYNBEGIN - Used to initiate the screen when the program is executed.
The default value to be specified is 'X'.
FNAM - Specifies input field name in the screen where the data is to be populated.
FVAL - Specifies from which internal table field, the data should be passed to the screen field.



MODE: This is used to specify which mode to be followed when calling
transaction. The types of mode are:
A - Display the screen.
E - Display only error records from the flat file.
N - Background processing.
When 'N' is used, a predefined structure called BDCMSGCOLL should be used to collect the messages triggered during background processing.
UPDATE: This is used to specify the update task of records in the database table. The types of update tasks are:
A - Asynchronous update
S - Synchronous update
L - Local update


Since Direct Input and Call Transaction methods cannot be used for support projects due to the database availability and networking constraints, SAP suggests to use Session Method for data migration in support projects.
In this method, a session is created in the Application Server. A session has a session memory used to hold the internal table records. We can process the session later whenever database is available with free network traffic.

Function modules used in session method.

1. BDC_OPEN_GROUP - This FM is used to create a session in Application. Server.
2. BDC_INSERT - This FM is used to insert the internal table records into session memory.

3. BDC_CLOSE_GROUP - This FM is used to save the records in session memory and close it to process later.

Steps to be followed in Session Method:
1. Get the data from file into an internal table.
2. Record the transaction.
3. create a session.
4. Loop the data table and call the recorded screen sequence and hold the data into bdc data.
5. After end loop pass the BDC data into BDC INSERT.
6. Close the session.
7. Process the session from SM35.

Example on Session Method.

To process the session, goto SM35 transaction.  Select the session , click on PROCESS push button from application toolbar   .Choose a mode. Click on Session Overview
push button to see the over view.  Comes back to SM35 screen  , select the session   click on
Log Push button from application to see the log.    Unlike call transaction there is no need to write any extra logic to handle the errors as the log is auto generated.

LSMW ( Legacy System Migration Workbench)

LSMW is a collection of Projects.Project is a collection of Sub Projects. Sub project is a collection of Objects, here Object represents transactions. 

Run Transaction LSMW,   Name the Project  ,Name the Sub Project  Name the Object, Click on Create. It opens an interface . Enter the Description for project , sub project and Object Click on Execute. .It opens an interface with list of LSMW navigations.

Step #1. Maintain Object Attributes
In this step we need to specify a recording object to be assigned for LSMW to process the BDC data. Select the radio button   Click on Execute from Application toolbar. It  opens Another Interface .  Click on Push button Recording Overviews , to create a new recording Object  .  Select the data from screen   Click on Create Recording from application toolbar   Name the recording Object.   Enter description ( any )   Click on continue   Specify Tcode .  Accept the SAMPLE data   Save the Record   by default sap displays list of fields information .
Internal table data   Move this fields into Recording Object fields by clicking on "Default all" push button from application toolbar   save the Entries Come back   come back   Change mode of the screen into Change mode Select the radio button called as Batch Input Recording   Name the recording Object .  Save the Entries   Come back .

Step #2 Maintain Source Structures
In this step we have to define Name of the Internal table where data to be populated from Flat files. Select   Execute from Application   Opens an interface   Change the into Change mode   Click on Create Structure From Application toolbar   Name the Internal table.   Enter Description( Database format internal table )   Click on Continue   save the Entries Come back.

Step #3. Maintain Source Fields
In this step we are adding fields to the Internal table created in Second step. Select the radio button   Click on Execute   Opens an interface   Change Mode of the screen   select the Internal table from the List   Click on Create field from application toolbar   Name the Field,  Enter Description (any)   Set the Size ,   Specify Data type ( C )   Click on Continue. Using the same step add Other Fields.
save the Entries   Come back.

Step #4. Maintain Structure Relations
In this step we need to Generate Relation between internal table and Recording Object. select   Execute   Opens an interface   Relation ship , by default generated by SAP   Change mode of the screen   save the Entries .Come back.

step #5. Maintain Field Mapping and Conversion Rules
Mapping the Fields of Itab with Recording Object is the step to be processed. select   Execute   Change Mode of Screen   Select the Field From List of recording object   Click on Source Field From Application toolbar Displays the List of Internal table fields   Double click on Proper Field. In the same way map all Fields of Recording Object with All Fields of Internal table   Save the Entries   Come back.

Step #6. Maintain Fixed Values, Translations, User-Defined Routines
This is optional Step In BDC of LSMW Execute   Come back.

Step #7. Specify Files
Select   Execute   Opens an interface   Change Mode of Screen select legacy data on PC   Click on Create From Application toolbar Name the File .   Enter Description ( any ) Sepecify Separator as comma or space etc.   Click on Continue   Save the Entries Come back.

Step #8. Assign Files
In this step we need to assign the Flat file Into Internal table created in Second step.
select   Execute   Change Mode of the screen   Save the Entries Come back.

Step #9. Import Data
In this step SAP Reads the Flat File data and stores in the form of "" file. Select   Execute   Opens an interface   Click on Execute   Sap Generates a report as Flat file is converted into ".read" file with Number of transactions   Come back   Come back.

Step #10. Display Imported Data
Select  Execute   Open an Interface   Click on Continue   displays the data in Internal table .  Come back.

Step #11. Convert Data
In this step Data will be converted into ".lsmw.conv" file to make data is ready for populating into Session object. select   execute   Execute   Sap Generates a report as file is converted into Conv   Come back   come back.

Setp #12. Display Converted Data
select   Execute  Opens an interface   Click on continue  Generates a report with Green Color   Come back.

Setp #13. Create Batch Input Session
Select  Execute   Opens an interface   Select the checkbox   Click on Execute   Prompts a message.

Step #14. Run Batch Input Session
Opens SM35 tcode to process BDC data. select   Execute   Select session object name   Click on Process   Click on continue   SAP trasnfers all file data into R/3 applications.

Screen Shot Sequence:

I found this PPT very useful for LSMW learners :