You use watchpoints to monitor the content of individual variables. The Debugger stops when the value of the monitored variable changes. You also use watchpoints to specify conditions on the content of variables. The Debugger stops when the condition is fulfilled.
1. To create a watchpoint, choose Breakpoints ® Create Watchpoint.
A dialog appears.
2. In the Variable input field, enter the name of the variable that you want to monitor.
ABAP data structures are allowed, but you cannot monitor objects and anonymous
data objects (referred by data references).
You can only set watchpoints for variables of the current program.
If you have positioned the cursor on a variable prior to choosing Create Watchpoint, the variable is taken as the default value in the Variable input field.
3. To get the type of the variable in the Ty. input field, choose with the quick info text Check.
4. For local variables, specify whether the watchpoint should apply to the current procedure instance or to all instances that you may reach for this procedure.
5. To impose additional monitoring condition, choose with the quick info text Display Condition.
6. In the Free Condition Entry input field, enter an arbitrary condition.
The syntax of the condition must be <Function( Variable ) or Variable> <operator> <Function( Variable ) or Variable>.
The following functions are available:.
○ LINES( ITAB )
Number of table rows of ITAB, where ITAB is an internal table.
○ STRLEN( S )
Current length of S, where Sis a string.
sy-index > 5
sy-index = sy-tabix
lines( itab ) > 0
lines( itab ) <> sy-tabix
lines( itab1 ) < lines( itab2 )
strlen( s ) >= sy-index
7. To create more than one watchpoint at once, choose with the quick info text Copy.
The system creates the watchpoint that you have specified and clears all fields of the dialog box to allow you to create another watchpoint.
8. Choose Continue.
When you set a watchpoint, the system creates a clone to the original data object. Setting a watchpoint on a large internal table has a negative effect on memory consumption during program runtime and causes an increase in memory consumption. With very large internal tables, this can lead to memory bottlenecks.
If you have successfully created a watchpoint, the value of the variable is monitored.
As soon as a change is found in the content of the variable after a debug step and any conditions that were set have been met, the Debugger stops and you see the message Watchpoint is reached (<variable>).
Watchpoints are only valid locally in the internal session. If the internal session changes, all watchpoints are not visible. If you reenter the internal session, all stored watchpoints for that internal session will be visible again. Watchpoints that were created in the New Debugger cannot be used in the Classic Debugger and vice versa.