Professional Documents
Culture Documents
docGuide
Page 1 of 41
SAP 264992601.docGuide
Contents
Debugger 04
Debugging Techniques.. 04
Starting the debugger.... 04
Debuggers Views... 05
Debugger Screen.... 06
Breakpoint..... .07
Static Breakpoint... 07
Dynamic Breakpoint.. 07
When a static breakpoint is used?.... 07
When a dynamic breakpoint is used? ..07
Watchpoint..... 07
When a watchpoint is used?.. 07
When to use watch points......... 07
Key word (statement) or event breakpoints........... 08
When to use breakpoints at Keywords (statements) or Events............ 08
Setting Static Breakpoints.......... .08
Setting Dynamic Breakpoints......... 08
Setting Watchpoints............ 10
Setting Breakpoints at (statements) keywords or subroutines................ 12
Deleting Static Breakpoints............ 13
Deleting Dynamic Breakpoints........... 13
Deleting Watchpoints.......... 14
Ways of viewing the code............ 15
Displaying the field contents...........17
Displaying the Internal table.......... 18
A View of internal table display..... 19
Changing contents of fields and internal tables........ 19
Changing Internal Tables at Runtime....... 20
Deleting a row........... 20
Editing a row............. 20
Adding a row..........21
Debugging a BSP application using SICF tcode............21
Debugging Tips and Tricks..................... 31
Page 2 of 41
SAP 264992601.docGuide
Skip breakpoints.............. 31
Check sorting before READ BINARY SEARCH..... 32
System Debugging. 34
Update debugging..36
Debugging a Popup Window........................................36
External breakpoints.................................................... 38
Saving breakpoints........................................................ 40
Page 3 of 41
SAP 264992601.docGuide
Debugger
The Debugger is a programming tool that you can use to execute ABAP programs, by line or
by section. With this tool, you can display data objects and check the flow logic of programs.
The ABAP/4 Debugger lets you stop a program during runtime and examine the flow and
results of each statement during execution. Stepping through a program with the debugger
helps you to detect and correct errors in your code.
Debugging Techniques
Starting the Debugger
On running a program in the debugging mode the following steps can be followed.
Page 4 of 41
SAP 264992601.docGuide
Debuggers views
We can have different views in the debugger by selecting appropriate view name by PushButtons, in debugger.
These Push buttons have following specific meaning.
Overview
- Displays the structure of the program to be debugged.
Call stack
- Displays an active event chain and the call sequence up to the
current breakpoint.
Fields
- Displays the field content and technical characteristics.
Table
- Displays the content of an internal table.
Break-Points - Displays the Break-Points set in the program.
Watchpoints
- Displays the Watch-Points set in the program.
Page 5 of 41
SAP 264992601.docGuide
DEBUGGER SCREEN
We can set breakpoints in a program and then start the program within the debugger.
Alternatively, we can run the program in the debugger without any breakpoints.
Page 6 of 41
SAP 264992601.docGuide
Breakpoint
A breakpoint is a signal that tells the debugger to temporarily suspend execution of your
program at a certain point. When execution is suspended at a breakpoint, your program is
said to be in break mode. Entering break mode does not terminate or end the execution of
your program. Execution can be resumed at any time.
Following are the types of breakpoints.
Static
These are user specific, set directly into a programs code with the editor. These breakpoints
are user-independent.
Dynamic
Set within the ABAP/4 debugger or editor. This type is visible when the program is displayed
in the editor. We can set up to 30 dynamic breakpoints.
When a static breakpoint is used?
Static break points are generally user-independent. On setting this breakpoint, every use who
executes the program encounters the breakpoint. This is used when several developers are
working in the same program, and all wants to the program to interrupt at the same place
during execution. These breakpoints are visible in the programs code.
When a dynamic breakpoint is used?
Dynamic break point is user-specific. If we want to interrupt a program when we execute and
while others are running, we use dynamic break-point. Dynamic breakpoints are more
flexible than static breakpoint , they can be removed or deactivated during runtime.
Watch points
Set within the ABAP/4 debugger .Watch points are field-specific. This is used to observe
changes to a particular field.
When to use watch points
We can set watchpoints only from within the debugger.
The debugger interrupts the program when fields content change.
Key word (statement) or event breakpoints
Page 7 of 41
SAP 264992601.docGuide
Set within the ABAP/4 debugger. The debugger interrupts the program when the ABAP/4
processor comes in contact with a specific key word (statement) or event in programs
code.
When to use breakpoints at Keywords (statements) or Events
From within debugger, we can allocate breakpoint for specific ABAP/4 keywords or events.
Setting Static Breakpoints
To set a static break point use BREAK-POINT keyword.
Place the break point on the line where to interrupt the program:
REPORT ZDEBUG.
IF SY-SUBRC NE 0.
BREAK-POINT.
ENDIF.
We can number breakpoints like BREAK-POINT1, BREAK-POINT2,for identification.
Setting Dynamic Breakpoints
Place the cursor on the line where to position the breakpoint.
Choose Utilities Breakpoint Set OR press the stop pushbutton on the
application tool bar.
Utilities Breakpoint Set/Delete.
Page 8 of 41
SAP 264992601.docGuide
(OR)
STOP pushbutton on the Application tool bar.
Page 9 of 41
SAP 264992601.docGuide
Setting Watchpoints
Page 10 of 41
SAP 264992601.docGuide
Page 11 of 41
SAP 264992601.docGuide
The system will display a small screen prompting to enter statement keyword or
subroutine etc., as per selection in the menu.
Page 12 of 41
SAP 264992601.docGuide
The system will set a breakpoint each time the statement or subroutine appears in
the
program.
For break point in form routines, it is possible to access the current program, not
external subroutine calls.
Page 13 of 41
SAP 264992601.docGuide
Temporary deleting of Dynamic breakpoint is possible by selecting the appropriate line and
select Breakpoint Deactivate/Activate in the ABAP Debuggers menu bar.
Deleting Watchpoints
From the debuggers menu bar ,
Page 14 of 41
SAP 264992601.docGuide
A display of the watch points occurs, and can be deleted by pressing delete checkbox at the
end (last column) of each Watchpoint display.
Page 15 of 41
SAP 264992601.docGuide
click carries to the called routine. After stepping the way through the subroutine,
returns to the line of code directly following the subroutine call.
F8 Continue: Processes the program up to the next active dynamic or static break
point. If no further breakpoints exist, the system executes the report in its entirety
without stopping.
Page 16 of 41
SAP 264992601.docGuide
Page 17 of 41
SAP 264992601.docGuide
Page 18 of 41
SAP 264992601.docGuide
Specify a table name in the internal table field or double click on the table. If the internal
table contains a header line, this line appears before the actual table contents.
A View of internal table contents display
Page 19 of 41
SAP 264992601.docGuide
New Debugger:
SAP 264992601.docGuide
2. Choose Change.
3. Enter a new value for the field.
4. Choose Enter.
The system updates the line and displays the new contents in the table.
Adding a Row
We can add a new row to an internal table by using either Append or the Insert function.
Append places the new line at the end of the table.
Insert lets us to position the line anywhere.
To add a new row to the end of the table, the following steps will do.
1. Choose append.
2. Enter a value for the first field in the line.
3. Choose Enter.
The system adds a line to the table and fills in the first field.
To insert a new line anywhere in the internal table, position the cursor on the line directly
following the line where we want the new row to appear.
Then, Choose Insert button and proceed as we want to append the line.
Debugging BSP using SICF transaction code:
Step1:
Go to Se80 ABAP Workbench.
Choose BSP Application in the drop down and enter the name of the BSP application.
Page 21 of 41
SAP 264992601.docGuide
Double click on .htm page which is under Pages with flow logic.
At the bottom of the properties tab there is a field named URL. This is the link of the portal
page.
For this BSP application the link is:
http://blade23.wipro.com:8000/sap/bc/bsp/sap/zbsp_download/first.htm
Page 22 of 41
SAP 264992601.docGuide
Step2:
Go to SICF tcode and execute.
Page 23 of 41
SAP 264992601.docGuide
Page 24 of 41
SAP 264992601.docGuide
Now select bsp. Go to menu item Edit -> debugging -> activate debugging.
Page 25 of 41
SAP 264992601.docGuide
Now we get a pop up. In this pop up screen check the field System debugging.
Click on Activate.
Page 26 of 41
SAP 264992601.docGuide
Step3:
Place an external breakpoint in the BSP application where ever necessary according to
functionality.
Step4:
Now execute the URL. This can be done either by directly using internet explorer by entering
the URL or by right clicking on .htm page and clicking on Test.
Page 27 of 41
SAP 264992601.docGuide
Now the control goes to debugger. Now we can step into the code and check how the code is
working. Accordingly changes can be made.
Page 28 of 41
SAP 264992601.docGuide
On executing,
Page 29 of 41
SAP 264992601.docGuide
Page 30 of 41
SAP 264992601.docGuide
Page 31 of 41
SAP 264992601.docGuide
Page 32 of 41
SAP 264992601.docGuide
Page 33 of 41
SAP 264992601.docGuide
System Debugging
The System Debugging function enables the user to analyze system programs, in addition to
application programs, using the Debugger. This function is called or terminated through the
menu path Settings System Debugging On /Off. By selecting the menu Settings Save,
this predefined setting is stored to the database and thus activated again each time the new
Debugger is activated.
Page 34 of 41
SAP 264992601.docGuide
In the program attributes we can designate a program as a System program. The debugger
skips the program if the system debugging is turned off.
Page 35 of 41
SAP 264992601.docGuide
We can also turn on system debugging by entering /hs in the command field in the debugger.
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 update functions are not called directly. They are part
of an LUW that is executed after the next COMMIT WORK statement. 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.
Page 36 of 41
SAP 264992601.docGuide
Page 37 of 41
SAP 264992601.docGuide
Page 38 of 41
SAP 264992601.docGuide
We can use debugging in order to carry out detailed troubleshooting. With the debugger, we
check a given section of code in the Request Handler or an ABAP function module for errors.
Basically, there are two different types of debugging:
With conventional debugging, we can analyze programs that we call up within our
own user session on the server, with breakpoints being set at corresponding points
in the coding.
With external debugging, we can analyze programs that are called up by an
external user with HTTP. For the purpose of external debugging, special
breakpoints (external breakpoints) are set on the target server.
Page 39 of 41
SAP 264992601.docGuide
Two variants are available for conventional debugging: the classical variant and the new (2processor) variant, which creates a separate session for the debugger. At present, external
debugging can only be performed with the classical variant.
Saving breakpoints
If you need to debug the same code again and have a set of breakpoints in place, you can
create a Session to save the breakpoints and settings. Later this session can be loaded by any
user, and the same set of breakpoints is restored.
Path: New Debugger: Debugger -> Debugger Session -> Save
Classic Debugger: Debugging -> Sessions
Page 40 of 41
SAP 264992601.docGuide
Thank You
Page 41 of 41