How to Debug a Sample Program in ABAP

SAP ABAP Debugger

[Step By Step with Screenshots]

Debugger is a wonderful tool used by ABAP programmers to track down an issue in a given piece of code and also to understand the logic used by other programmer in writing that program. 

With this tool you can display data objects and check the flow logic by executing a Program by line or by section. 

We will take you through the step by step process of how to debug a sample program in ABAP. 

To start, open debugger by setting break points in the ABAP editor. There are two types of break points: Session Break Point and External Break Point

 

Line by Line Debug

Step 1

Step 2

Step 3

Step 4

Step 5

Step 6

 

 

Step 1: Below I have created a sample program in the name of Zdebug. 

 

 

 

 

 

 

 

Step 2: Place the cursor on the line and Set Session Breakpoints. 

 

 

 

 

 

 

Step 3: Now execute the program.

 

 

 

 

 

 

 

Step 4: Execute Again.

 

 

 

 

 

 

Step 5: Check the values in output table T_KNA1.

 

 

 

 

 

 

 

Step 6: There are 4 different options in the debugger to execute the program. They are: 

F5: By using this button F5 , executes our program step by step. 

F6: By using this button F6, executes a subroutine or function module without entering into it. 

F7: By using this button F7, comes out of a subroutine or function module. 

F8: By using this button F8, directly executes the program, if there is more than one breakpoint then it can move one breakpoint to another. 

 

Debugging By Session

Creating Watchpoints

If you want to debug a particular row in an internal table instead of going line by line you can go to that particular row by creating a watch point. 

 

Step 1

Step 2

Step 3

Step 4

Step 5

 

 

Step 1: In this table T_KNA1 we want to reach 10th row i.e. kunnr = 1030.

 

 

 

 

 

 

 

Step 2: Place the cursor on the variable and click on create watch point button.

 

 

 

 

 

Step 3: Set the condition as below in Free Condition Entry.

 

 

 

 

 

Step 4: Watch point created. 

 

 

 

 

 

 

Step 5: Here we can see the value of variable w_kna1-kunnr as 1030. 

Now you know how to debug a program By Line and By Sessions Method.