0% found this document useful (0 votes)
48 views9 pages

ABAP Debugging HJK

The document provides an overview of ABAP debugging. It describes the different types of ABAP debuggers, including the classic and new debuggers. It explains how to start the debugger for various program types like executable programs, background jobs, methods, and function modules. The document also covers the basics of debugging like setting different types of breakpoints, stepping through code, and ending a debugging session. Finally, it provides details on debugging tools and techniques available in the ABAP debugger.

Uploaded by

Aleax Rao
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
48 views9 pages

ABAP Debugging HJK

The document provides an overview of ABAP debugging. It describes the different types of ABAP debuggers, including the classic and new debuggers. It explains how to start the debugger for various program types like executable programs, background jobs, methods, and function modules. The document also covers the basics of debugging like setting different types of breakpoints, stepping through code, and ending a debugging session. Finally, it provides details on debugging tools and techniques available in the ABAP debugger.

Uploaded by

Aleax Rao
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 9

ABAP Debugging - Basic

What is ABAP Debugger?


The ABAP Debugger is the important tool used to analyse ABAP programs. In the development phase
of any program, the Debugger can be used to analyse error situations like runtime errors and
unexpected program behaviours. Also, it can also be used to analyse existing programs to understand
their logic flow.

Versions of ABAP Debugger


1. Classic Debugger.
2. New Debugger.

How to start ABAP Debugger?


1. For Executable Programs & Transactions
a. In Object Navigator-SE80, Right click on the Program, Choose Execute & click
Debugging.
b. In ABAP Editor-SE38, under option Program, Choose Execute & click Debugging.
c. In ABAP Editor-SE38, Click Debugging in application toolbar.
2. For Background Jobs
a. In Job Overview-SM37, Select a finished Background job & in the command field
enter JDBG. This will trigger the Debugger & simulate the exact scenario with the
variant of the Background job.
3. For Methods in Class & Function modules
a. Both Function module Builder-SE37 & Class Builder-SE24 have Test Environment( in
Execution mode), using this we can start Debugging all the methods or Function
modules.

How to start/switch on Debugging when running applications/transactions?

1. For Executable Programs & Transactions


a. To debug screen i.e., ABAP statements & Screen logic, enter /h in command field
b. To debug system i.e., Screen, custom programs & System programs, enter /hs in
command field
c. To debug ABAP only, enter /ha in command field. This includes PAI & PBO modules
debugging also.

Just like activating debugger with /h in command field, to activate classic debugger enter /hset
debugger=classic and use /hset debugger=standard to activate standard debugger. However, this
will have effect only on the current logon session. Standard debugger will be the default for any new
SAP logon session.

Note: Post SAP release 7.4, Standard debugging has been the only way for Debugging external
requests irrespective of the OK Codes used.

Now, how to end Debugging session?


1. Under Debugging in the toolbar, when the debugger is active
a. Option Restart – Debugger is closed & Application is restarted
b. Option Exit (close application), both Debugger & Application is closed.
c. Option Exit (Application continues running), Debugger is closed while Application
continues running.
2. Enter /hx in command field, to switch off debugging that was switched on by /h.
Types of ABAP Debugger
1. External Breakpoint

2. Session Breakpoint

3. Persistent Breakpoint

Default tools

Close Tool – Remove the tool from the debugger desktop

New Tool – Add a new tool to the debugger desktop

Replace Tool – Replace tool with another tool

Fullscreen – Expand screen & removes all tools but retain the ones in toolbar

Maximize the screen horizontally, vertical

Swap/Reposition the tools

To Display Services of tools

Other tools available that can be added in the debugger screen

We will see about the tools in detail as we go on.


Debugging in ABAP code
• Options available to step through the code

Continue - F8 – Execute the code till


stopped by next breakpoint or watchpoint

Return – F7 – Return to previous program


in the call stack

Execute – F6 – Process the ABAP statement


without leaving the current program

Single step – F5 – Process ABAP statement


one by one.

Debugger icons explained with the purpose & its keyboard button

• Options available other than the above 4 ways to step through the code
o Continue to cursor – Execute the ABAP code till the cursor position – Press SHIFT + F8
o Goto Statement – Helps in skipping/reprocessing section of source code, without having
to go in a new debugger session. Right click on the ABAP statement from which we want
to execute, choose Goto statement in the dialog menu that pops up.
• Step Size

o If we want to debug the subconditions in the ABAP code. This can help in the following
places,
▪ When we have multiple subconditions in the conditional statements.
▪ When we want to debug every step in VALUE, REDUCE, FOR iterations & similar
ABAP 7.4 & above statements.

Call stack Debugger tool


This tool helps to see the programs that are called before reaching the debugger stop.

Breakpoints & Watchpoints


All types of breakpoints do the job of the allowing the developers to mark places/statements in the
ABAP code where the debugger should start/stop.

Every type of breakpoints has different scopes & lifetimes.


Session Breakpoint
If the breakpoint should be active only in the current user session, then Session break point would be
right choice. This breakpoint will get deleted once the user logs off. This breakpoint can be set in the
following ways,

• Place the cursor on the statement where we want to have breakpoint, Then press CTRL +
SHIFT + F12 key
• Place the cursor on the statement where we want to have breakpoint, click on in the
toolbar.
• Left click on the status column i.e., left side of the source code line on which we want the
breakpoint in the ABAP editor.
• Session breakpoint can be created in Debugger session also, right click on the source code
line on which we want the Session breakpoint & select the Create Session breakpoint option.

External Breakpoint
External Breakpoints will be active/valid for future user sessions. These breakpoints are valid for 2
hours and whenever a new breakpoint is set, the lifetime of all breakpoints is reset. These breakpoints
are useful when we want to debug applications/ web services that are connected to SAP via RFC &
HTTP request. Also, these breakpoints can be set specific for certain User or a Terminal ID. Following
are the ways to set external breakpoint,

• Place the cursor on the statement where we want to have breakpoint, then press CTRL +
SHIFT + F9 key
• Place the cursor on the statement where we want to have breakpoint, click on in
the toolbar.
• Right click on the Status column, left side of the source code line, Select Create External
breakpoint.
• External breakpoint can be created in Debugger session also, right click on the relevant
statement and choose Create User Breakpoint.

External breakpoints can be set for another user, can be helpful when we are trying to debug RFC
call or HTTP request made by another user. To do this, follow the below steps,

• Click on Utilities in the ABAP editor top menu, then Settings -> ABAP editor tab ->
Debugging. Enter the user for whom the External breakpoint needs to be set.

In cases where the external breakpoint (for another user) needs to be only in the current
application server, Flag the checkbox Current application server only.

Debugger Breakpoint
As the name indicates, these breakpoints can be set only in Debugger session, so they are visible in
debugger session and deleted right after the debugger session ends. Both Session & External
breakpoints can be set on the ABAP statements (Known positions) that is seen on the screen while
Debugger breakpoints can be set on unknown positions as well. We will see how to do this.
Set Debugger breakpoints at a known position
• Right click on the relevant ABAP statement & Choose Create Debugger Breakpoint.
• Left click on the status column i.e., the left side of the line number in ABAP editor, to the left
of the relevant ABAP statement.
• Set the cursor the on the ABAP statement that is of interest, choose Breakpoints -> Line
Breakpoint. We get options to Set/Delete & Activate/Deactivate debugger breakpoint.

Let’s see how to set Debugger breakpoints at an unknown position.


• Simply by pressing F9 key.
• Click on the Stop in the Toolbar.
• Choose Breakpoints in the Menu, Select Breakpoint at.

This dialog box opens when we press F9 or Create breakpoint. With this, Debugger breakpoints can

be created for the following items.

• ABAP statements – Breakpoint can be set for all possible ABAP command statements
• Methods of Class (Global & Local).

We should enter the class & method to set a breakpoint for the method. Similarly, if we want
to set a breakpoint for a method of a local class within any specific program.

• Function modules – If we want to set breakpoint for any Function module.

• Forms (Both in current program and in a called program).

• Exceptions & Messages of all types – Set breakpoints at all instances of specific exception
class. Also, we set breakpoint for a specific Message of a certain Type (I, E,A,S).
• Include programs & PAI/PBO flow logic of any screen at any specific line numbers – We can
set breakpoint at a specific line in an Include of a Program. Also, Set breakpoint on a line no.
within any PAI/PBO flow logic

• Simple Transformation templates.


• Methods of Web Dynpro controller – We can set breakpoint for methods in controller of any
Web Dynpro component.

Breakpoint Overview

All the Breakpoints that are defined can be seen in within Breakpoint tab in Break/Watchpoints tab
in Debugger session. From this tab, Breakpoints can be created, activated, deactivated & deleted.
Also, we can change the type of breakpoint from here.

We can also set conditions for the breakpoints., if we want the breakpoint (that is already set) to be
triggered only on for a specific condition. Like the below example, if we want the breakpoint to be
triggered only when the user name is ‘PRABHAKARAN’
We can also see the overview of Breakpoint from ABAP Editor.

Watchpoints

Watchpoints are a way to make the debugger stop when the value of the variable/data object (for
which watchpoint is created) changes.

How to create Watchpoints – Watchpoints can be created only in debugger sessions.


• Choose Watchpoint in the application toolbar.

• Choose Breakpoint -> Create Watchpoint

• Press SHIFT + F4 key

On creating the Watchpoint, we get the below dialog box where we should enter the variable/data
object for which Watchpoint needs to be created.

Below example, Watchpoint is created for variable SY-UNAME with condition SY_UNAME =
‘PRABHAKARAN’. So whenever the value of SY_UNAME changes to PRABHAKARAN debugger will
stop. If we want the debugger to stop whenever the value of the variable changes, then leave the Free
condition blank.
Watchpoints created can be seen in Watchpoints tab under Break./Watchpoint tab in debugger
session. We can also activate, deactivate, create, change, delete any watchpoint from here also.

How to save & load Debugger session ?

Following the below steps, Debugger sessions can be saved, loaded for a later debugging session, can
also be deleted if no longer needed along with components that can be chosen.

Dialog box while Saving & loading the Debugger session

You might also like