Friday, 28 June 2013

LSMW Events and Debugging


As we all know, LSMW (Legacy System Migration Workbench) is just like a tool provided by SAP to upload the data from non-SAP system to SAP system. i.e., if we are having the data in the form of text/excel file in our local system then we can easily upload this data  into SAP system using LSMW.

LSMW Events:

As in the case of reports where in we have events like INITIALIZATION, AT SELECTION-SCREEN, START-OF_SELECTION, END-OF-SELECTION, TOP-OF-PAGE, END-OF-PAGE, GET, GET LATE, PUT, AT USER-COMMAND, AT LINE-SELECTION and so on… 

Similarly even in LSMW we have the following events.

1. GLOBAL_DATA
2. BEGIN_OF_PROCESSING
3. BEGIN_OF_TRANSACTION
    -BEGIN_OF_RECORD
    -END_OF_RECORD
4. END_OF_TRANSACTION
5. END_OF_PROCESSING
6. FORM_ROUTINES


We can see all the above events in ‘Field Mapping and Rule Step’. If you are not able to see the above LSMW events then you have to click on the Layout button and check mark the Processing Times option.



LSMW Debugging:

As far as I know LSMW can be debugged in two ways.
  1.       By hard coding ‘BREAK-POINT’ in the Code section of ‘Change Field Mapping and Conversion Rules’.
  2.       By setting breakpoints in the Display Read Program/ Display Conversion Program which are automatically generated by SAP.


By hard coding ‘BREAK-POINT’ in the Code section of ‘Change Field Mapping and Conversion Rules’. 

1. Execute the ‘Change Field Mapping and Conversion Rules’ Step.
2. Open the Fields Folder.
3. Double Click on Code option.



4.  Add a new line of code ‘BREAK-POINT'.



By setting breakpoints in the Display Read Program/ Display Conversion Program which are automatically generated by SAP.

1. In order to set the breakpoints, first we have to enable the check boxes of Display Read Program/ Display Conversion Program in the ‘User Menu’ of LSMW Screen where we execute the steps (Initial Screen).


2. Now execute the Display Read Program Steps.


3. A Report will be displayed, set the break points at the required places.


4. Execute Read Data Step.


5. As soon as you execute the Read Data Step you will enter the debugging mode.



If you are facing the problem in Converted Data then you can set the Breakpoints in ‘Display Conversion Program’ after that execute the ‘Convert Data’ Step, you will enter the debugger.