Thanks to visit codestin.com
Credit goes to www.scribd.com

0% found this document useful (0 votes)
24 views12 pages

Deep Dive Into ABAP Debugging

The document provides a comprehensive overview of the ABAP Debugger, a tool essential for analyzing ABAP programs during development and troubleshooting. It details how to start and end debugging sessions, types of breakpoints, and watchpoints, along with their specific functionalities and usage. Additionally, it covers the various tools available within the debugger and how to manage debugging sessions effectively.

Uploaded by

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

Deep Dive Into ABAP Debugging

The document provides a comprehensive overview of the ABAP Debugger, a tool essential for analyzing ABAP programs during development and troubleshooting. It details how to start and end debugging sessions, types of breakpoints, and watchpoints, along with their specific functionalities and usage. Additionally, it covers the various tools available within the debugger and how to manage debugging sessions effectively.

Uploaded by

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

Deep Dive into 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

1. In Object Navigator-SE80, Right click on the Program, Choose to Execute &


click Debugging.

2. In ABAP Editor-SE38, under option Program, Choose to Execute & click Debugging.

3. In ABAP Editor-SE38, Click Debugging in application toolbar.

2. For Background Jobs

1. 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

1. 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

1. To debug screen i.e., ABAP statements & Screen logic, enter /h in command field.

2. To debug system i.e., Screen, custom programs & System programs, enter /hs in
command field.

3. 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.

1. Option Restart – Debugger is closed & Application is restarted.

2. Option Exit (close application), both Debugger & Application is closed.

3. 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 available in Debugging session: -

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

Debugger options explained with the purpose: -

 Options available other than the above 4, 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 sub conditions in the ABAP code. This can help in the
following places,
 When we have multiple sub conditions 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 (call stack) 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 username 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