Debugging
Introduction:
- Debugging is the tool to trace the program execution line by line.
- Debugging is used to change the input values as run time.
- Debugging is used to stop the program execution as any execution statement by using break-point.
Break-point:
- Break point is the signal which interrupts the program execution.
- There are 2 types of break point
- Static Break Point
- Dynamic Break point
Difference btw static and dynamic break point:
- Static break point are achieved using break-point keyword.
- Static break point are not user specific. ie... program execution stops at static break point irrespective of who set the break point. but based on some condition we can set static break point as user specific.
- We can set static break point at any version of the program. ie.. active or inactive.
- SAMRTFORMS can be debugged using static break point.
------------------
- Dynamic break point are achieved using stop button in the application tool bar.
- Dynamic break point are user specific.ie... program execution stops only for the user who set that break point.
- We can set dynamic break point only at the active version of the program.
- We cannot debug the smartforms using dynamic break point.
Note:
There are two ways to debug the program.
- Place the break point and execute the program.
- Execute the program and set in debugging mode.
Note:
SY-UNAME is the system variable which contains the current user name.
To achieve user specific static break point we have to use SY-UNAME in IF condition.
- If SY-UNAME = 'sapuser'.
- break-point.
- Endif.
How to add/remove dynamic break point:
- Place the cursor on the program line where we want to add break point and click STOP button from application tool bar
- To remove the break point, place the cursor on the break point and press the STOP button from application tool bar.
Note:
We can add upto 30 break point in a program.
Function keys:
- F5 - Line by line execution.
- F6 - To execute one block of code(complete subroutine or function module) at a time.
- F7 - To exit from a block of code. ie.. if we are inside the block of code, F7 is used to come out of it.
- F8 - If there is any break point in upcoming line, It will jump to next break point or else comes out from program.
Watch Point:
Watch point are used to stop the execution program based on particular condition.
Hot to add watch point in program:
- Click watch point from the application tool bar and provide name[Workarea-Fieldname]. ie.. wa-bukrs.
- Select rational operator(=, <, >). ie.. wa-bukrs =
- Provide comparison value [pune]. ie.. wa-bukrs = pune.
- Press F8.
- program will execute, if wa-bukrs got the value pune then the execution will be stoped for examination.
Note:
We can place upto 10 watch point in the program.
Debugger screen:
- Field: This is used to identify the field value and also change the values.
- Table: This is used to display the internal table data and also we can perform the operational operator.
- Break point: This is used to find all the break points which are available in the program and line number.
- Watch point: This is used to identify all the watch points which are available in the program and also we can change the condition.
- Call stack: This is used to find the cursor position of the program.
- Overview: This is used to find all the blocks and events which are available in the program.
- Old Debugger: Debugger menu bar -> Click debugger -> Click switch to classic debugger.
Note:
- /H Tcode for run time debugger.
- Execute the program -> provide the input -> provide /H in command prompt -> press enter -> runtime debugger will be executed
No comments:
Post a Comment