Why do we need to DEBUG : BREAK POINT : WATCH POINT

DEBUG
We write programs to achieve certain functionality and like other actions, we make mistakes while writing the code. If they are not trapped at the right time, problem becomes bigger, and bigger and bigger.
Read more in ... DEBUG
 

BREAK POINT


The BREAK POINT is a debugging aid. When we run a program normally, it is interrupted at the statement, and the system automatically starts the debugger, allowing you to display the contents of any fields in the program and check how the program continues. If the program is running in the background or in an update task, the system generates a system log message. 
Read more in ... BREAK POINT
WATCH POINT
Indicator in a program that tells the ABAP runtime processor to interrupt the program at a particular point.
Read more in ...WATCH POINT

Why do we need to debug?

We write programs to achieve certain functionality and like other actions, we make mistakes while writing the code. If they are not trapped at the right time, problem becomes bigger, and bigger and bigger.

Mistakes can be syntactical or logical.

Syntactical errors are trapped during syntax check in code editor. Program does not get compiled and activated till they are removed. Existences of logical errors are not understood till we get a difference in outputs. It can reside anywhere in flow logic and can get activated when the proper condition is fired.

ABAP Debugger


ABAP Debugger helps to get rid of logical mistakes by trapping the field values at different stages in program flow. ABAP Debugger is the efficient means of identifying errors in ABAP programs. Programs can be stopped at a particular statement, event, subroutine, and function module or system exceptions. Field contents can be displayed or changed at runtime.
 
Overview of the ABAP Debugger Screen:

Fields: It will show the value of single Fields value of the object
Tables: It will show the value of the internal table
Break points: It will show all the break points in the program
Watch Points: It will display all the watch points in the program.
Calls: It will show name of the program their respective events and the processing block.
Overview: It will give the overview of the program. i.e. Name of the Program their processing block and what type of is the block.
Settings: From Settings one can trace whether the program is running on the Update task Memory Monitoring update debugging and other features.

Other features of Debugger screen:

1)      It will increase the visible area of the program in the debugger mode. The program will show in the whole screen instead of the half screen.

2)      It will display the current line where the program is executing.

3)      All the four buttons are respectively executing the program in each different steps i.e. F5, F6, F7, F8 etc.

4)      SY-SUBRC/SY-TABIX/SY-DBCNT: These fields will show the different value of sy-subrc,

5)      sy-tabix and sy-dbcnt at the different stage of the program.

6)      Delete Icon: This icon will delete all the items in the field names

7)      Line Number: It will show the different Line Number of the Program

8)      Main program: One can find the name of program, which is currently executing.

9)   Watch-point: From that Icon itself it will create the watch-point in the screen.

Why do we need to debug: BREAK POINT

Definition:


The BREAK POINT is a debugging aid. When we run a program normally, it is interrupted at the statement, and the system automatically starts the debugger, allowing you to display the contents of any fields in the program and check how the program continues. If the program is running in the background or in an update task, the system generates a system log message. 

Break point types:

  1. Static
  2. Dynamic
    1. Directly set
    2. Specially set
                                                              i.      At statement
                                                            ii.      At event
                                                          iii.      At function module
                                                          iv.      At system exceptions


Static Breakpoint


Written in ABAP program.
Should be used in development environment only.

            If sy-subrc eq 0.
            break-point.
            endif .

Dynamic Breakpoint


  • User specific.
  • Can be set/deactivated/deleted at runtime.
  • Deleted automatically when the user logs off from R/3 system.
  • Can be set even when a program is locked by other programmer.
  • Logics can be built while defining it.

Different ways of putting the Break-point in the Program


1)      Writing the Break point in the program.
2)      Writing the Break statement along with the user name in the program Break sy-uname.
3)      By Clicking the Red Button on a line, one can create the Break point at that line.

How to Create/Delete Break Point



  • You can set the break point by duble clicking on the statement during the debugging in
  • You can set the break point through menu option: place the cursor on the statement where you want to put the break point.
    • Goto the menu bar > Break point > select the Create/delete.
  • After creating the break point select Ctrl+S / Select Save in the menu bar - to save all the break points for that session.
  • Viewing all the break points in a ABAP Program.
    • For viewing all the break point in the ABAP Program: Goto – Utilities - Break points - Display
  • If we want to delete the selected break point then click on the display selected Object.
  • After deleting all the break points, the table will be empty and no break point is left in the table.

How to Activate/Deactivate Break point

1. Activate/deactivate all: It will activate the single deactivated break point and vice-versa.
2. Delete All: It will delete all the break points, which is in the programs
3. Deactivate All: It will deactivate all the break points in the program.
4. Activate All: It will activate all the deactivated break points.
5. Save: After setting the break point, by clicking the save button it will save the break point in the program.
  
One can put a break-point at a Statement, Subroutine, Function Module and exception always at runtime.
If in a specific program there is one function module and two subroutines, in that case
The Program will stop at the statement select.
The Program will stop at subroutine.
            The Program will stop at Function Module