ABAP Debugging Techniques
ABAP Debugging Techniques
Author
: Lalit Kabra
Employee ID: 239602
_______________________________________________________________________________________
SAP ABAP Debugging Techniques
Page 1 of 12
Created by: Lalit Kabra
TCS Confidential
ABAP Debugger
The ABAP Debugger is an integrated test tool within the ABAP Workbench. We use it to check the program logic and to
find errors in the source code of an ABAP program. In the Debugger, you can step through the source code of a program.
The running program is interrupted after each step, allowing you to check its processing logic and the results of individual
statements.
Features
The Debugger provides an efficient means of identifying errors in ABAP programs. It contains the following functions:
In SE80: Select a program or transaction and from the top menu choose Program Test Debugging.
From any other screen: From the top menu choose System Utilities Debug ABAP
Or Enter /h in the command field and press enter
_______________________________________________________________________________________
SAP ABAP Debugging Techniques
Page 2 of 12
Created by: Lalit Kabra
TCS Confidential
Static breakpoints are not normally user-specific. Once a user has inserted the statement BREAK-POINT or
BREAK name in an ABAP program, the system always interrupts the program at that point for that user or only for
the user name. This procedure is only useful in the development phase of an application, when the program
execution is always to be interrupted at the same place.
Remove all hard coded breakpoints from your program before you transport it.
Dynamic breakpoints are more flexible than static breakpoints, because you can deactivate or delete them at
runtime. They have the following advantages:
You can set them even when the program is locked by another programmer
You can define a counter that only activates the breakpoint after it has been reached
_______________________________________________________________________________________
SAP ABAP Debugging Techniques
Page 3 of 12
Created by: Lalit Kabra
TCS Confidential
The statement BREAK-POINT without the addition ID causes an error in the extended program check.
A breakpoint in SELECT - ENDSELECT loops can cause an exception through loss of the database cursor. The
reason for this is that - during debugging - a database Commit is triggered.
During background processing and during the database update, program execution is not interrupted. If you have
a breakpoint that is always active, the system writes a "Breakpoint reached" entry into the system log during
background processing and during updating. After this entry, the program name and the position of the breakpoint
in the program are listed.
Watchpoints
Like a breakpoint, a watchpoint is an indicator in a program that tells the ABAP runtime processor to interrupt the program
at a particular point. Unlike breakpoints, however, watchpoints are not activated until the contents of a specified field
change. Watchpoints, like dynamic breakpoints, are user-specific, and so do not affect other users running the same
program. You can only define watchpoints in the Debugger.
_______________________________________________________________________________________
SAP ABAP Debugging Techniques
Page 4 of 12
Created by: Lalit Kabra
TCS Confidential
You set watchpoints in the Debugger to monitor the contents of specific fields. They inform you when the value of a field
changes. When the value changes; the Debugger interrupts the program.
You can use watchpoints to display changes to the references of strings, data and object references, and
internal tables.
Setting Watchpoints
7. Checking all the breakpoints/watch points in the program. From here any watch point or break point can be
activated/deactivated.
_______________________________________________________________________________________
SAP ABAP Debugging Techniques
Page 5 of 12
Created by: Lalit Kabra
TCS Confidential
F5 (Single Step): Use this option to step through the program statement by statement.
F6 (Execute): Use this option to process a program line by line. All of the statements on the current line are
processed in a single step. This allows you to process the whole program. This is mainly used to execute a
Function Module or a Subroutine in a single step; without entering into the Function Module / Subroutine.
F7 (Return): The Debugger returns to the point at which control returns to the main program. We use this option
to return from other programs or to return from a module or subroutine or a function module.
F8 (Run / continue): Use this option to process the program up to the next breakpoint. If there are no more
breakpoints in the program, the system exits debugging mode and executes the rest of the program normally.
Processing Fields
You can display / change the contents of various fields like variables, structures, internal tables etc at runtime in
debugging mode
_______________________________________________________________________________________
SAP ABAP Debugging Techniques
Page 6 of 12
Created by: Lalit Kabra
TCS Confidential
_______________________________________________________________________________________
SAP ABAP Debugging Techniques
Page 7 of 12
Created by: Lalit Kabra
TCS Confidential
Update Debugging
Update function modules do not run in the same user session as the program that is currently running in the ABAP
Debugger. These function modules are therefore not included in debugging. Only if you select the Update debugging
option can you display and debug them after the COMMIT WORK.
You are in debug mode now. Step through SAP program (press F7 couple of times) until you get to code you need.
_______________________________________________________________________________________
SAP ABAP Debugging Techniques
Page 8 of 12
Created by: Lalit Kabra
TCS Confidential
Debugging SAPScripts
Activate the ABAP debugger from in the form layout of SAP Script
From the top Menu in SE71 go to System -- > Utilities --> Debug ABAP
Then execute the print program and the script opens in the debug mode.
_______________________________________________________________________________________
SAP ABAP Debugging Techniques
Page 9 of 12
Created by: Lalit Kabra
TCS Confidential
Debugging SMARTFORMS
To debug a smart-form, one should place a hard-coded breakpoint (BREAK-<userid>) at the place where you want to
debug. This will take you directly to the smartform.
Please make sure to delete this hard coded break point before transporting to the next system.
_______________________________________________________________________________________
SAP ABAP Debugging Techniques
Page 10 of 12
Created by: Lalit Kabra
TCS Confidential
There are some features which are better in Classical Debugger. So one can switch to classical debugger:
To switch to classical Debugger from the debugger screen follow the path:
Debugger >> Switch to Classical Debugger
_______________________________________________________________________________________
SAP ABAP Debugging Techniques
Page 11 of 12
Created by: Lalit Kabra
TCS Confidential
References
http://help.sap.com/
https://www.sdn.sap.com/
_______________________________________________________________________________________
SAP ABAP Debugging Techniques
Page 12 of 12
Created by: Lalit Kabra
TCS Confidential