Vous êtes sur la page 1sur 22

http://scn.sap.com/people/stephen.

pfeiffer/blog/2010/12/14/abap-debugger-scripti
ng-advanced
http://www.slideshare.net/ravitejacs627/abap-debugging-from-basic-to-advance#
http://scn.sap.com/community/abap/blog/2013/11/15/six-kinds-of-debugging-tips-to
-find-the-source-code-where-the-message-is-raised
http://www.saptechies.org/working-debugging-techniques/
http://scn.sap.com/community/abap/testing-and-troubleshooting/blog/2010/11/10/ne
w-abap-debugger-tips-and-tricks
http://www.saptechnical.com/Tips/ABAP/Debug/RFC.htm
http://sapignite.com/archives/1275 (debug RFC,backgrd job,update FM)
http://troublefreeabap.blogspot.in/2013/06/abap-debugger-tips.html
http://www.saptraininghq.com/use-sap-abap-debugger-efficiently/
========================================================================
1. Starting abap debugging 1. Putting /H in command box and hitting execute
button 2. Setting breakpoint in program. Difference among F5 , F6 ,F7 and F8 F5:
debug in single step (line by line) F6: Skips Subroutines/FM Whenever a control
encounters a subroutine or FM debug them unlike F5 F7: controls return to main
program from Subroutines & FM F8: executes program until next break point. Break
point Types 1. Debugger breakpoint: When you set a breakpoint in the Debugger, i
t is created as a debugger breakpoint by default. A debugger breakpoint is only
valid while the Debugger instance, in which it was set, is active. When the Debu
gger is closed, all debugger breakpoints set in it are deleted. 2. Session break
point: If you set a breakpoint in the ABAP Editor, for example, this breakpoint
is a session breakpoint. Session breakpoints remain active independently of the
existence of a Debugger and are valid for all external sessions of a logon. With
in the Debugger, you can convert a debugger breakpoint into a session breakpoint
and vice versa. If the setting Session Breakpoints Active Immediately is checke
d (via Utilities ? Settings ? ABAP Editor ? Debugging in the ABAP Editor or Obje
ct Navigator), you can set a session breakpoint in an external session of a logo
n to force a running program into the Debugger that runs in the same logon (for
example, in an external session) and will process the point at which the session
breakpoint was set. 3. User breakpoints: User breakpoints (previously known as
external breakpoints) are valid for all user logons on the current server of the
current system. User breakpoints are specifically required when debugging BSP o
r Web Dynpro applications. In these cases, you do not log on using the SAP GUI b
ut via a browser, for example. Therefore, any breakpoints must be set before log
ging on. User breakpoints are only valid for a period of 2 hours. As of Release
7.00, user breakpoints set for BSP or Web Dynpro applications are also valid for
SAP GUI logons.
2. Within the Debugger, you can convert debugger or session breakpoints into
user breakpoints and vice versa. We can create maximum 30 breakpoints only. Sys
tem Debugging If you set this option, the Debugger is also activated for system
programs (programs with status S in their program attributes). When you save bre
akpoints, the System Debugging setting is also saved. Update Debugging Update fu
nction modules do not run in the same user session as the program that is curren
tly running in the ABAP Debugger. These function modules are therefore not inclu
ded in debugging. Only if you select the Update Debugging option you can display
and debug them after the COMMIT WORK.
3. Remote abap debugging 1. Open the Function module/ Proxy class and set an
external break-point. Execute the transaction code SRDEBUG (Note: this tcode is a
vailable only in ECC 6.0 system onwards) Click on the button Activate Debugging.
A pop-up screen will be opened. Fill the User-ID with which break-point has bee
n set. (The same user-id should be used as authentication data in the XI while c
reating RFC communication channel). Select the radio buttons all Appl. Servers and
External breakpoints already set. Click on OK.
4. Another pop-up will be opened with a message End debugging? Leave the pop-u
p as it is. (Dont close the transaction). When you run transaction in source syst
em debugger will start in target system where SRDEBUG transaction is set
5. 2. For example we are calling an RFC enabled FM in ECC system from CRM sy
stem. Scenario 1: Calling a custom RFC FM 1: Add an infinite loop in the remote
custom Function Module (adding a DO. ENDDO. statement at the start of the FM would
be enough). 2: Execute your program in the CRM system. The execution stops at t
he RFC call, because of the infinite loop. 3: login to the ECC system and go to
transaction SM50. Select the process which is executing the RFC and navigate to
the menu: Program/Session->Program->Debugging this triggers the debugger Session i
n a separate window. Scenario 2: Calling a Standard RFC FM When we are debugging
a standard program we cannot add the infinite loop, hence we cannot go to SM50
and debug the work process. The RFC destination for the ECC system has a User sp
ecified, the RFC function module gets executed using this users credentials. Usu
ally the basis team set up the RFC user as non Dialog user, this does not allow
debugging. Contact your Basis team and get this changed to a dialog user enablin
g you to debug RFC function calls via the normal debugger. Debugging a Popup Win
dow Sometimes we might want to start debugging from a popup window / information
message, in this case we cannot type "/h" as the OK Code box is not available. Me
thod 1: From any SAP windows press the Customize Local Layout button (Alt + F12) a
nd select Create Shortcut Select system command in Type and and put /h in Command P
rovide desktop in location and click on finish. A file is generated on your desk
top. Now drag the file onto the popup window / information message or click on f
ile and debugging is enabled!
6. Method 2: For this create a text file with .SAP extension on your desktop
, and type the below lines into the file:
7. [System] Name= ECD Description= ECD [host.com] Client=100 [User] Name= Us
ername Language=EN [Function] Title= Command=/H Type=SystemCommand [Configuratio
n] WorkDir=C:Documents and SettingsJohnSapWorkDir [Options] Reuse=1 Debugging ba
ckground job 1. To debug active background process Go to the transaction SM37 an
d select the background job (with job status Active) that you want to debug. Now s
elect Capture: active job from menu Job, 2. Also you can do the same from transactio
n SM50. Select the work process where this job is running and then choose the me
nu path Program/Mode?Program?Debugging. 3. To debug completed background process
select job in SM37 and write 'JDBG' in command prompt and press enter. You will
be in debug mode. Press F7 couple of time until you get into the code.
8. Watchpoints Watchpoints allow you the option of monitoring the content of
individual variables. The Debugger stops as soon as the value of the monitored
variable changes. In addition, conditions can be specified. The Debugger also ch
ecks whether such a condition is fulfilled. Like a breakpoint, a watchpoint is a
n 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 dyna
mic breakpoints, are user-specific, and so do not affect other users running the
same program. You can only define watchpoints in the Debugger. Use You set watc
hpoints 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 inte
rrupts the program. We can create maximum 24 watchpoints in a session Creating a
Watchpoint In the toolbar of the New Debugger, you will find the pushbutton Cre
ate Watchpoint you to the dialog box Create Watchpoint. Using this function, you
can enter the variable to be monitored. All possible ABAP data structures are a
llowed here. . It brings
9. Watchpoint is reached After you have created the watchpoint, the value of
the variable will be monitored. As soon as a change is found in the content of
the variable after a Debug step and any conditions set have been met, the Debugg
er will stop and you see the message "Watchpoint is reached (<Watchpointvariable
>). In the Breakpoints tool (desktop Breakpoints/Watchpoints / Tab Watchpoints),
you can view this reached watchpoint in detail. The reached watchpoint is marked
with a yellow arrow. The old and the new values of the watchpoint variable are
at your disposal. In addition, you can use the pushbutton Compare Variables ( )
to determine the differences between the old and the new variable. In addition,
you can maintain the watchpoint in this view that is change, activate, deactivat
e, or delete it. Validity Area for Watchpoints In contrast to breakpoints, watch
points are only valid locally in the roll area. If a roll area changes, none of
the watchpoints defined in the underlying roll area are visible. Also, watchpoin
ts that were created in the New ABAP Debugger cannot be used further in the Clas
sic Debugger (for example, after changing the Debugger) and vice versa.
10. To debug script: Execute the report RSTXDBUG to activate the script debu
gger. OR Goto SE71 and give your form name and go to Utilities-->Active De-bugge
r. To debug Smart form: 1. One way to debug smart form is to debug the Function
Module of that smart form. Within PERFORM %GLOBAL_INIT node level coding can be
found. 2. If you want to debug particular smart form node that the solution woul
d be, insert a "Program Line" just above the node you want to debug and this pro
gram line write a normal abap breakpoint. 3. SFTRACE can be used for debugging S
MARTFORMS. Go to tcode SFTRACE / SMARTFORM_TRACE --> click "trace on" and click
checkboxes Warning/Error under abap breakpoints tab. So whenever you call the sm
art forms, it will stop at this breakpoint and you can debug onwards
======================================================================
Ways of starting the Debugger
Choosing different views
Choosing different execution options in the Debugger
Displaying source code in the Debugger
Setting and deleting breakpoints

Setting and deleting watchpoints

Stopping a program at a particular statement or event

Displaying and changing field contents at runtime
Displaying ABAP Objects and references
Displaying and positioning strings
Setting and deleting database locks
Opening the ABAP Editor, or Object Navigator
System settings and runtime warnings

Starting the Debugger

There are two possible strategies for starting the Debugger in the ABAP Workbenc
h:

By setting breakpoints then running the program
By running the program in debugging mode.
Setting Breakpoints

A breakpoint is a signal in a specific line of the program source code. This sig
nal indicates to the ABAP runtime processor to stop the program at the relevant
line and start the ABAP Debugger. A distinction is made between static and dynam
ic breakpoints. For further information about the different types of breakpoints
and how to use them, refer to Breakpoints.

Direct Processing

You can start the Debugger without previously having set breakpoints. This is th
e best procedure to use when you want to test a program right from the beginning
. It is also a useful procedure if you are not overly familiar with the program
and therefore are not sure where best to set breakpoints. You can start the Debu
gger as follows:


From the Object Navigator
Select a report or transaction and choose Program Test Debugging.

From the ABAP Editor
Choose Program Execute Debugging (or the Debugging pushbutton).

From any screen
Choose System Utilities Debug ABAP.

From any screen
Enter /h in the command field.

Display Modes in the Debugger

When you are debugging a program, there are various display modes that you can u
se. All of the display modes have the same structure. The top part of the screen
displays an extract of the program source code. The bottom part displays the in
formation specifically available in that display mode. There are also pushbutton
s on the screen allowing you to switch to the most frequently-used display modes
.

Display Modes Available Using Pushbuttons
Fields
The scrollable field display contains the contents of up to eight fields. The co
ntents of the three most important system fields are always displayed. This is t
he default display mode in the Debugger. See also Processing Fields

Table
Displays the contents of an internal table. This mode allows you to display and
edit the entries in an internal table. See also Processing Internal Tables

Breakpoints
A scrollable display containing up to 30 breakpoints. Next to each breakpoint is
a counter. You can also delete breakpoints in this display. See also Managing D
ynamic Breakpoints

Watchpoints
You can set a watchpoint for a field so that the program is interrupted whenever
the value of that field changes. This display mode contains a list of watchpoin
ts, the fields and programs to which they are assigned, the current values of th
e fields, and the conditions upon which the watchpoint is activated. See also Se
tting Watchpoints

Calls
This mode displays the current sequence of events, and the sequence of calls up
to the current breakpoint. The last active call is displayed at the top of the l
ist; previous calls are listed in reverse chronological order. When an event (fo
r example, START-OF-SELECTION) concludes, it is deleted from the display.

Overview
This mode displays the structure of the program. It lists its events, subroutine
s, and modules, and shows which sections belong to which events. It also display
s the section currently being processed.

Settings
This mode displays the current Debugger settings. You can change the settings by
selecting or deselecting various options. For further information, refer to Set
tings and Warnings

Other Display Modes

You can access other display modes by choosing Goto Display data object.

Single field
Displays the contents and technical attributes of a field.

Structured

field
Displays the components of a structure, along with their contents and attributes
. If you double-click a component, the system displays detailed information for
it.

Strings
Display the content and current length of the string. You can also display part
of the content by means of offset and length.

Internal table
Displays the type, line numbers and contents of an internal table.

Object
Displays the structure of an ABAP Object.

For further information on these displays, refer to Displaying Attributes and Di
splaying ABAP Objects

Checking System Programs for Errors
To check a program or program component that is part of the ABAP Workbench (for
example, the Screen Painter), you must use the system Debugger. To start the sys
tem Debugger, choose System Utilities Debug System from any screen. To stop the
system Debugger, choose Debugger Debugging off.

Displaying Program Attributes

You can display the attributes Fixed Point Arithmetic, System Program, and Unico
de Checks of the program that has just been executed by choosing Goto Further In
formation Program Attributes.

Restarting the Debugger

If you choose Debugging Restart, debugging mode is stopped and the system takes
you to the initial screen of the last transaction you called. If, for example, y
ou started an ABAP program in debugging mode from transaction SE38 (ABAP Editor)
, choosing Debugging Restart will take you back to the screen titled ABAP Editor
: Initial Screen. If you want to restart the program in debugging mode, choose D
ebugging.

Breakpoints

Apart from direct execution of an ABAP program in the Debugger, it is also possi
ble to start the Debugger call by the exact setting of a breakpoint. This is ach
ieved by setting one or more of these breakpoints in the program. A breakpoint i
s a signal at a particular point in the program that tells the ABAP runtime proc
essor to interrupt processing and start the Debugger. The program runs normally
until the breakpoint is reached.

There is also a special kind of breakpoint called a watchpoint. When you use wat
chpoints, the Debugger is not activated until the contents of a particular field
change. For further information, refer to Watchpoints.

Breakpoint Variants

The Debugger contains different breakpoint variants:

Static
The BREAK-POINT statement in an ABAP program. Static breakpoints are not normall
y user-specific. However, you can make them user-specific.

Directly-set

dynamic breakpoints
Can be set in the ABAP Editor or the Debugger. Dynamic breakpoints are always us
er-specific, and are deleted when you log off from the R/3 System.

Breakpoints

at statement
The Debugger stops the program directly before the specified statement is execut
ed.

Breakpoints

at subroutine
The Debugger stops the program directly before the specified subroutine is calle
d.

Breakpoint at function module
The Debugger stops the program directly before the specified function module is
called.

Breakpoint at method
The Debugger stops the program directly before the specified method is called.

Breakpoints at system exceptions
The Debugger stops the program directly after a system exception, that is, after
a runtime error has been intercepted.

Static Breakpoints

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 interr
upts the program at that point for that user or only for the user name. This pro
cedure is only useful in the development phase of an application, when the progr
am execution is always to be interrupted at the same place. For further informat
ion, refer to Static Breakpoints.

In HTTP sessions, a static breakpoint is skipped if you did not set additional d
ynamic HTTP breakpoints in the editor of a BSP page. Instead, a corresponding sy
stem log entry is written, which can be checked using transaction SM21.

Dynamic Breakpoints

Dynamic breakpoints are user-specific. Therefore, you should use them if you onl
y want the program to be interrupted when you run it yourself, not when it is be
ing executed by other users. All dynamic breakpoints are deleted when you log of
f from the R/3 System.

Dynamic breakpoints are more flexible than static breakpoints, because you can d
eactivate or delete them at runtime. They have the following advantages:

You do not have to change the program code
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 re
ached
Special dynamic breakpoints are useful when you want to interrupt a program dire
ctly before a particular ABAP statement, a subroutine, or an event, but do not k
now exactly where to find it in the source code. Event here is used to refer to
the occurrence of a particular statement, for example, or calling up a method. S
pecial dynamic breakpoints are user-specific. You can only set them in the Debug
ger. For further information, refer to Dynamic Breakpoints.

In HTTP sessions, the system stops both at static and dynamic breakpoints if a d
ynamic breakpoint was set in the editor of a BSP page before program execution.

Lifetime and Transfer of Breakpoints

A static breakpoint remains intact as long as the BREAK-POINT or BREAK-POINT nam
e statement is not removed from the source code. Without saving, dynamic breakpo
ints only remain intact in the relevant internal session. However, they are effe
ctive during the entire user session, if they are saved by choosing Breakpoints
Save in the ABAP Debugger. For more details on the subject of sessions and user
sessions, refer to Modularization Techniques in the ABAP keyword documentation.

If you call an HTTP session during a user session, only the HTTP breakpoints are
loaded when the HTTP session is started. You activate HTTP debugging in the ABA
P Editor by choosing Utilities Settings HTTP Debugging. Depending on the setting
, the system then displays either the HTTP or standard breakpoints in the Editor
.

If you call an update session during a user session, breakpoints that were defin
ed beforehand in the calling processing unit are copied to the new update sessio
n, where they can be displayed under Breakpoints. If, in the ABAP Debugger, you
check Update Debugging under Settings and then, for example, call the update mod
ule func using CALL FUNCTION func IN UPDATE TASK, a new window is opened in whic
h you can debug this function module in the update session. All the breakpoints
that were set in the calling processing unit can also be processed here.

Breakpoints at Statements
You can use this special kind of dynamic breakpoint to interrupt a program direc
tly before an ABAP statement is processed.

Prerequisites
You must already be running the program in the Debugger.

Procedure
To set a breakpoint at an ABAP statement:

1.Choose Breakpoint Breakpoint at Statement...
The following dialog box appears:

2.Enter the ABAP statement.
The system sets a breakpoint at all points in the program at which the ABAP stat
ement occurs.

3.Choose ENTER.
The breakpoint applies to all lines containing the specified statement.

Result
The system confirms the breakpoint and adds it to the list in the display. When
you finish your debugging session, the breakpoint is automatically deleted unles
s you have explicitly saved it.

Breakpoints at Subroutines

You can use this special kind of dynamic breakpoint to interrupt a program direc
tly before a subroutine is called.

Prerequisites

You must already be running the program in the Debugger.

Procedure

To set a breakpoint for a subroutine:

Choose Breakpoint Breakpoint at Event/Subroutine.
The following dialog box then appears:
Enter the name of the subroutine before which you want to interrupt the program.
By default, the Program field contains the name of the program that is currentl
y active. The system sets a breakpoint wherever the specified subroutine occurs
in the program code.
Choose ENTER.
Result

The system confirms the breakpoint. The breakpoint is added to the breakpoints d
isplayed.

Breakpoints at Function Module

You can use this kind of dynamic breakpoint to interrupt a program directly befo
re a function module is called.

Prerequisites

You must already be running the program in the Debugger.

Procedure

To set a breakpoint for a function module:

Choose Breakpoint Breakpoint at Function module...
The following dialog box appears:
Enter the name of the function module before which you want to interrupt the pro
gram. The system sets a breakpoint wherever the specified event, module pool, or
subroutine occurs in the program code.
Choose ENTER.

Result

If you entered a valid function module name, the system confirms that the breakp
oint has been set. If the function module exists in the system, the new breakpoi
nt is added to the display list.

Breakpoints at Methods
You can use this special kind of dynamic breakpoint to interrupt a program direc
tly before a method is called.

Prerequisites
You must be already running the program in the debugger.

Procedure
To set a breakpoint for methods:

...

1. Choose Breakpoint Breakpoint at Method...
The following dialog box then appears:

2. Enter the name of the method and class before which you want to interrupt the
program. A breakpoint is then set each time the specified processing block appe
ars in the source code.

3. Choose ENTER.

Result
The system confirms the breakpoint. The breakpoint is added to the list in the d
isplay.

Breakpoints at System Exceptions

You can use this special form of dynamic breakpoint to interrupt a program immed
iately after a runtime error has occurred.

Prerequisites

You must already be running the program in the Debugger.

Procedure

To set a breakpoint at a system exception:

Choose Breakpoint Breakpoint at System exception.

Result

The system confirms the breakpoint. The breakpoint is added to the breakpoints d
isplayed.

When a system exception is triggered, a warning triangle appears in the line con
taining the statement that caused it. If you double-click the warning triangle,
the internal name of the runtime error appears.

Static Breakpoints

You should only use static breakpoints during the development phase of an applic
ation. You must remove them from your program before you transport it.

Setting Breakpoints

To set a static breakpoint, use the ABAP statement BREAK-POINT . Place the break
point in the line at which you want to interrupt the program.

program RSDEBUG_01.

....

if SY-SUBRC 0.

break-point.

endif.

....

When you run the program, the runtime processor interrupts it when the breakpoin
ts occur. You can number your breakpoints to make them easier to identify ( BREA
K-POINT 1, BREAK-POINT 2 ).

Static breakpoints are not normally user-specific. The program is, therefore, al
ways interrupted as soon as the runtime processor reaches the line containing th
e breakpoint. The program is interrupted regardless of the user who executes it.

However, you can set user-specific static breakpoints using the BREAK statement
followed by your user name. For example, if you use the statement BREAK SMITH ,
the program is only interrupted when user Smith runs it. Although user-specific
breakpoints appear in the program code, they are not active when other users run
the program. You should, however, be careful if an application is being used by
several users with the same name.

Deleting Breakpoints

Since static breakpoints apply to all users, you must remove them from the progr
am once you have finished testing it. In the ABAP Editor, you can find breakpoin
ts quickly by choosing Utilities Global search. You can also use the Extended Pr
ogram Check to find them.

If you do not remove static breakpoints from your program, they will be transpor
ted to your production system. This could cause serious problems in the producti
on system.

Dynamic Breakpoints

You can set up to 30 dynamic breakpoints without changing the program code. Dyna
mic breakpoints can be set either in the ABAP Editor or directly in the Debugger
.

Setting Dynamic Breakpoints in the ABAP Editor

You can set dynamic breakpoints in the ABAP Editor regardless of whether you are
in display or change mode. You can also set breakpoints directly from within th
e Debugger at runtime. To set a dynamic breakpoint in the ABAP Editor:

Position the cursor on the line of the source code at which you want to set the
breakpoint.
Choose Utilities Breakpoints Set or the Stop icon. The system confirms that the
breakpoint has been set.
To display a list of all dynamic breakpoints in a program, choose Utilities Brea
kpoints Display. You can use this list to navigate to a particular breakpoint or
to delete one or more breakpoints from the program.

Setting Dynamic Breakpoints in Debugging Mode

To set a dynamic breakpoint in the Debugger:

Position the cursor on the line in which you want to set the breakpoint.
Select the line by double-clicking it or choosing Breakpoint Set/delete.
The system sets the breakpoint, and displays a small stop sign to the left of th
e relevant line. If the line already contained a breakpoint, it is deleted.

When you finish your debugging session, the breakpoint is automatically deleted
unless you have explicitly saved it.

Saving Breakpoints

If you want to leave the Debugger temporarily, you can save your dynamic breakpo
ints so that they are still active when you return to the Debugger within the sa
me terminal session.
To save the breakpoints that you have set in the Debugger:

Choose Breakpoint Save.
The system saves all of the breakpoints that you have set in the current program
. These breakpoints will remain active until you either explicitly delete them o
r log off from the system.

You can also delete breakpoints that you have saved:
By deleting individual breakpoints from the display and then saving again. In th
is case, only your selected breakpoints will be deleted.
By choosing Breakpoint Delete all. In this case, the system deletes all dynamic
breakpoints.

Managing Dynamic Breakpoints

The ABAP Debugger provides a convenient user interface for managing breakpoints.
To open the breakpoint display, choose Breakpoints, or, from the menu, Goto Con
trol debugging Breakpoints.

Example
Functions
This display mode contains the following functions for breakpoints:

Breakpoint Display

The scrollable breakpoint display contains up to 30 dynamic breakpoints. For bre
akpoints that you set directly, the program name and line number at which the br
eakpoint occurs are displayed. For special breakpoint forms, the list displays t
he statements, events, subroutines, and module calls at which the relevant break
points are set.

Counter

In the breakpoint display, you can specify a counter. When you use a counter, th
e breakpoint is not activated until it has been reached a specified number of ti
mes. For example, if you enter 5 for the counter, the breakpoint is not activate
d until it is reached for the fifth time. After the breakpoint has been activate
d, it remains so, and the counter no longer appears in the breakpoint display.

Deleting Breakpoints

Position the cursor on the breakpoint that you want to delete, and either double
-click the line or choose Breakpoint Set/delete. To delete all breakpoints, choo
se Breakpoint Delete all.

Activating and Deactivating Breakpoints

Position the cursor on the breakpoint that you want to activate or deactivate an
d choose Breakpoint Activate/deactivate.

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 breakp
oints, however, watchpoints are not activated until the contents of a specified
field change. Watchpoints, like dynamic breakpoints, are user-specific, and so d
o not affect other users running the same program. You can only define watchpoin
ts in the Debugger.

Use

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 D
ebugger interrupts the program.

Features

You can set up to five watchpoints in a program.
See also Setting Watchpoints.
You can also specify the conditions on which a watchpoint is to become active.
You can specify logical conditions between up to five conditional watchpoints.
See Specifying a Logical Expression.
You can define watchpoints as either local or global. If you define a global wat
chpoint, it is active in all called programs. Local watchpoints are only active
in the specified program.
You can change and delete watchpoints.
See Changing Watchpoints.
You can use watchpoints to display changes to the references of strings, data an
d object references, and internal tables.
See Memory Monitoring with Watchpoints

Setting Watchpoints

If you want to interrupt a program when the contents of a field or structure cha
nge, use a watchpoint. You can set up to five watchpoints, including watchpoints
for strings.

A watchpoint can be either local or global. Local watchpoints are only valid in
the specified program. Global watchpoints are valid in the specified program, an
d also in all the other programs it calls.

Procedure

To set a watchpoint, start the Debugger and proceed as follows:

Choose Breakpoint Create watchpoint or the corresponding pushbutton. The Create
Watchpoint dialog box appears:

Decide whether you want to set a local or global watchpoint.
Enter the program and the name of the field for which you want to set the watchp
oint. In the Program field, the name of the program currently running is always
defaulted.
If you want your watchpoint to be activated each time the contents of the field
change, the definition is now complete, and you can return to the Debugger by pr
essing ENTER .
To create a conditional watchpoint, that is only activated when a particular sit
uation arises, choose one of the following relational operators.
Operator
Meaning

<
Less than

<=
Less than or equal

=
Equal

<>
Not equal
=
Greater than or equal
Greater than

You can use the Comparison field option to specify whether the comparison is to
be carried out with a value that you specify or with the contents of another fie
ld. Depending on your choice from step 6, enter a value or a field for the compa
rison.

Result
The system confirms the watchpoint and adds it to the list in the display. When
you finish your debugging session, the watchpoint is automatically deleted unles
s you have explicitly saved it.

Specifying Logical Links

If you have more than one conditional watchpoint, you can specify a logical link
between them:
OR
Only one of the specified conditions must be met
AND
All of the conditions must be met.

Changing Watchpoints

Choose Goto Control debugging Watchpoints or the Watchpoints pushbutton to displ
ay the watchpoint list. The following dialog box appears:
Choose the pencil icon in the line containing the watchpoint you want to change.
Change the watchpoint attributes in the Create/Change Watchpoint.
Choose ENTER .
Deleting Watchpoints

You cannot delete watchpoints by choosing Breakpoint Delete or Breakpoint Deacti
vate/activate. Instead, proceed as follows:

Choose Goto Control debugging Watchpoints or the Watchpoints pushbutton to displ
ay the watchpoint list.
Choose the trashcan icon in the line containing the watchpoint you want to delet
e.

Memory Monitoring with Watchpoints

You can use watchpoints to display changes to the references of strings, data an
d object references, and internal tables. By placing an ampersand (&) in front o
f the object name, you can display the reference in question in hexadecimal form
at. With internal tables, you can also display the table header by placing an as
terisk (*) at the beginning of the name.

&objectname
Displays the references of strings, internal tables as well as data and object r
eferences

*itab
Displays the table header of the internal table itab

Example
If a watchpoint is set for the object in question at runtime, the program is sto
pped as soon as the reference is changed. A short dump can be intercepted in thi
s way to stop the program being terminated when the memory is overwritten.

Analyzing Source Code

The Debugger contains an extensive range of functions that help you to analyze t
he source code of a program. You can step through the source code of a program i
n four different ways. For further information, refer to Stepping Through the So
urce Code

For information about functions within the source code display, see Displaying t
he Source Code

There are also different display modes that provide various information and disp
lay the contents of individual fields, tables, and so on:

Vous aimerez peut-être aussi