Tuesday, 7 January 2014

Watchpoints in SAP ABAP debugger screen

Watchpoints in SAP ABAP debugger screen

Click the Watchpoints button in the ABAP debugger. The program code will be visible above the Watchpoints table in the lower half of the screen. Breakpoints have previously been discussed, and can be very useful, but are not always the ideal tool to use to pause code execution, interrogate the contents of individual fields and internal tables and ana-lyse the program’s logic.
Imagine the program was processing a table containing 1000 records, and one wanted to debug the logic only when a certain condition occurs. This condition is dependent upon the data held in the records being processed. By using breakpoints, one would have to debug each individual record, obviously taking a huge amount of time. Here, Watchpoints become useful. Using these, one can tell the program to stop in the same manner that it would for a breakpoint, but instead of stopping at a specific line of code, it would stop based on the value in a field. In this example then, if this value occurred only in the 200th line of the table, a watchpoint would allow the first 199 records to be skipped over.
A watchpoint is created with the ‘Create watchpoint’ button, seen above the list of modes in the Watchpoint mode screen, or with SHIFT + F8.
Once this is done, a dialogue box will appear, with the program name filled in automati-cally. Here you need to enter the name of the field to be watched. In the Z_EMPLOYEE_LIST_01 example here, we will enter the surname field. The format is TA-BLE_NAME-FIELD_NAME. Next, the relational operator is to be set. In this example, a sur-name with the value “Mills” will be sought, so the operator here is an =. This can be se-lected from a drop-down menu, where one can also view other potential relational opera-tors. The bottom field, then, should be filled in with the value to be watched for.
Note that one does not have to use a specific value in the bottom field, but can get a watchpoint to compare a field against another field within the program. To do this the ‘Comparison field’ box should be checked, and the field name typed into the box rather than a specific value.
Click the green tick to continue and create the watchpoint, and the entry will have been added to the list at the bottom of the screen
                       
Watchpoints in SAP ABAP debugger screen

Watchpoints in SAP ABAP debugger screen

Watchpoints in SAP ABAP debugger screen

      
Observe the boxes below the Watchpoints list here. They are currently empty, but when the program is executed, it will pause once a value of ‘Mills’ is reached in the ‘surname’ field and this will be included in the box.
The output before the program is executed looks like this
Watchpoints in SAP ABAP debugger screen

Note that the surname Mills appears in the fifth row down. When the program is executed with the ‘Mills’ watchpoint set, the first four records will be written to the screen before pausing at the fifth, when Mills is displayed
You will see that the blue arrow cursor has paused at the SELECT loop in the code
Watchpoints in SAP ABAP debugger screen


Enter zemployees-surname in the Fields mode of the debugger to view the contents of the field. You will see the field contains “MILLS”. Also in the Watchpoints mode, the bottom field will now be filled
Watchpoints in SAP ABAP debugger screen

Watchpoints in SAP ABAP debugger screen

1 comment:

  1. CALFRE handles oracle fusion financials online training and its modules maintaining classroom based training with
    the self-paced videos. An expert having ten plus years of self-experience handles the training period through
    online and explains each and every point perfectly. We recently launched our institute in the USA and getting
    the best reputation over there.



    Oracle fusion Financials Training in hyderabad

    Oracle Fusion Financials online Training in hyderabad

    ReplyDelete