Debugging
1
Debugging
▪ Debugging is a technique by which we can find the error, correct the error and detect
the error.
▪ SAP debugger is a part of ABAP workbench only.
2
Ways of Debugging
▪ There are 2 ways of debugging.
1. Set the breakpoint on any executable statement and program stops automatically at
that point.
2. We can debug the code with the help of transaction code /h.
3
Execution Keys
▪ There are 4 execution keys in debugging mode.
1. F5 - Step by step execution
2. F6- Line by line execution
3. F7 - Return
4. F8 - Continuous execution or exit
4
System Variables
▪ There are 2 default system variables available in the debugging mode.
1. SY-SUBRC - System variable for return code(successful = 0, not successful = other than
0).
2. SY-TABIX - It returns the current line index inside a loop.
5
Static Breakpoints
▪ Static breakpoints are also called as user independent breakpoints.
▪ The syntax to set a static breakpoint is BREAK-POINT.
6
Dynamic Breakpoints
▪ Dynamic breakpoints are also called as user dependent breakpoints.
▪ The syntax to set a dynamic breakpoint is BREAK username.
7
Operations on Internal Table
▪ The various operations on internal table in the debugging mode are as follows:
Deleting a row from an internal table.
Editing a row of an internal table.
Adding a row to an internal table.
Saving internal table to a local file.
Delete complete table.
8
Features - Goto Statement
▪ We can jump to a particular statement in debugging mode by using the path :
Debugger-Goto statement.
▪ We can also jump to a particular statement by using the shortcut ‘Shift + F12’.
9
Features - Setting Breakpoint at Keywords , FM’s and Messages
▪ We can set the breakpoints at keywords in debugging mode like - SELECT, CALL
FUNCTION, MESSAGE etc.
▪ We can also set breakpoints on specific function modules or subroutines or messages
etc.
1
0
Features - Deleting and Deactivating the Breakpoints
▪ Deleting breakpoints - Permanently deleting the breakpoints in that particular session.
▪ Deactivating breakpoints - Temporary deleting the breakpoints in that particular session.
When we run the program again, the breakpoint resumes.
1
1
Features - List Preview
▪ In the debugging mode, we can check the
preview of the list output.
▪ The path to check the list preview is as follows:
New Tool - Special Tools - Console : XML and
List Preview
1
2
Features - Find
▪ In the debugging mode, we can find the
specific records of internal table.
▪ We need to do CTRL + F for the internal table
data, one pop-up appears to pass the column
values, pass the input and it point to the
records having matching values.
1
3
Features - Source Code Display
▪ In the debugging mode, we can open the code
in a new session without closing the debugging
session.
▪ We need to click on to program/include/line
icon as per the screenshot(highlighted).
1
4
Features - Save Parameters as Test Data(SE37)
▪ We can save the function module parameter
values in the debugging mode.
▪ The path to save function module parameters
values as test data is as follows:
Services of the Tool - Save Parameters as Test Data(SE37)
1
5
Features - SAP Memory and ABAP Memory Values
▪ We can check the values of SAP memory
and ABAP memory in the debugging mode.
▪ The path to check the memory id values in the
debugging mode is as follows:
New Tool - Special Tools - System Areas
(Internal Only)
1
6
Watchpoints
▪ Watchpoints are used to monitor the values of variables, workareas and internal tables.
1
7
Breakpoints and Watchpoints Comparison
▪ Breakpoints are for executable statements whereas watchpoints are used to monitor
the values of variables, work areas and internal tables.
▪ A user can set a maximum of 30 breakpoints whereas a user can set a maximum of 10
watchpoints.
1
8
Comparison of Session Breakpoint and External Breakpoint
▪ A session breakpoint is attached to user session and exists until the user closes the last
session, whereas external breakpoint has a validity of 2 hours.
▪ The icon of session breakpoint looks like a computer monitor set in front of a stop sign
whereas the icon of external breakpoint looks like a person set in front of a stop sign.
▪ The session breakpoint is used to debug the ABAP code internally whereas the external
breakpoint is used to debug the ABAP code from an external process like Web Dynpro
applications, BSP(Business Server Pages) etc.
1
9
User Specific Desktop
▪ Desktop 1, Desktop 2 and Desktop 3 are considered as user specific desktop in the
debugging mode.
2
0
Way to Debug a Dialog Screen or Pop Up Screen
▪ Firstly, we need to create a text document using the below mentioned code.
[Function]
Command=/H
Type=SystemCommand
▪ Then drag and drop this text document on the required dialog screen or pop up screen.
2
1
Update Debugging
▪ Update debugging is used to debug the
code which is written in the update task
as we can not debug the update task code
using normal debugging.
▪ Example - Function module called in the update task.
▪ The path to on the update debugging is as follows :
Settings - Change Debugger Profile/Settings - Update Debugging
2
2
Script Tab
▪ We can use the script tab to stop
the debugger on the selection of specific
tables and update of tables.
▪ We need to go to script tab, click on to
load script and pass the name of the script
as per the requirement.
2
3
Script Tab(Contd.)
▪ The various scripts for selection and updating of tables are as follows:
Script for selection of tables - RSTPDA_SCRIPT_BP_SELECT_TAB
Script for updating of tables - RSTPDA_SCRIPT_BP_CHANGE_TAB
2
4
Thank You
2
5