Debugger allows two ways of performing debugging activity on the scripts. They are:
- Sequential debug
- Stop on breakpoint marked
Sequential debug will be set in action by clicking step over (F8) button. This will move the current line marker to the next line.
Continue to click “step over (F8)” to move position of the current line marker to next line until the script reaches the last line.
In the above figure, the current line marker is pointing on line 19 as a result of sequential debug process. Initially the marker was at line 3 and by pressing step over (F8) button in a continuous stream, it moved to 19 and thereby reaches till end of the script after clicking multiple times.
If you want to stop sequential debugging on a particular line, insert a breakpoint on the line you intended to stop.
To know more about how to insert a break point click here.
Note: The current line marker will not point to the lines of script, which is been placed in comments (//…//). It skips the commented lines and places the marker on an executing statement.
Stop on Breakpoint marked
Go (F9) button will insert the breakpoint in Debugger. To stop executing debugging on a specified line, insert a breakpoint on the line where you need to stop.
Once breakpoint is applied on a specified line by pressing F9, continue to click step over (F8).
Then the current line marker will now jump to the breakpoint and then to the next breakpoint if any.
If the script doesn’t have any more breakpoints, the current line marker will complete executing the debugging activity.
In the Figure below, the debugging of the script got stopped at line number 95. The debugger will now release the script.
User can apply breakpoint and sequential debug as per their requirement to understand the behavior of the script.
As soon as the debugger releases the script, the SAP GUI would start to be in a responsive state as following figure.
Inserting and Removing Breakpoint
- Place the marker on the line where you want to insert the breakpoint and click, Insert/Remove Breakpoint (F9). This will enable the breakpoint by marking the line in to red color.
- Once a break point is applied, the line number along with the file name gets updated into the Breakpoints window.
- User can insert multiple breakpoints as per their requirement.
- Place the marker on the line where you want to remove the breakpoint and click, Insert/Remove Breakpoint (F9). This will remove the breakpoint from that line and updates the Breakpoints window.
- To remove all breakpoints at a single instance click, Remove all Breakpoints button on the build tool bar.
User can also insert and remove the breakpoints by simply right clicking on the specified line.
Debugger enables to watch variable values throughout the script execution. The value of the variable varies depending up on the script. The variable values can be inspected by adding them to watch window.
To add a variable to watch window perform following steps:
1. Select the text on the script editor and apply right click.
2. Select "Add to Watch" option. This will add variable to watch window.
Debugger will parse the script in background and retrieve current value of the variable in execution script and displays on the Watch window.
The other way of adding variable to watch window is:
1. Right click on the watch window
2. Select Add Row. This will add new row in to the window.
3. Double click on the row, you will get an option to edit the row.
4. Add any variable manually into that row.
Debugger will parse script in background and get latest value of the variable in execution script, displays on the Watch window.
To remove watched variable from watch window:
- Select Row / Variable to be removed and apply right click.
- Select “Delete Watch”. It will remove the variable from watch window.
- To remove all watched variables, right click on watch window and select “Clear All”. It will remove all the watched variables from the list.
Note: Make sure to close all the instances from your target system to run the debugger more efficiently.