Google Search - Blog...........

All About Debugger & Debugging In SAP ABAP.

Many times an error free program doesn’t give desired output. Behavior of program is different in different situations, with different values of variable. Such program needs additional testing, by which you can test the program by stopping at each point where you feel program is behaving abnormally.

The ABAP/4 debugger is the development workbench tool, which allows you to stop a program during its execution when a particular condition is met. When the program is stopped, you can use the debugger to display the contents of the table and variable being used by the program. It allows you to execute the program step by step, reviewing exactly the real flow of the program execution.

There are many occasions during normal system operation during which the ABAP/4 debugger can be started. When executing program, the ABAP/4 debugger is automatically started when the system encounters a breakpoint.

Starting the ABAP/4 debugger

There are many ways to start debugger

• By clicking the Execute button and selecting the debugging mode.
• From the ABAP/4 editor, by executing a program choosing Program  Execute  Debugging from the menu.
• Setting breakpoint in the program

Components of ABAP/4 debugger

The debugger shows the program information using six different views.

• Fields: Displays the field contents.
• Table: Allows modifying the contents of internal table.
• Breakpoints: Displays list of Breakpoint in the Program.
• Watchpoints: Allows dealing with Watchpoints.
• Calls: System call status like Event, Form etc.,
• Overview: Presents the program structure, events, subroutines, and modules.
• Settings: Displays the calling sequence within a particular event, up to the current breakpoint.
All these options are shown in the following screen.

Arrow indicates the breakpoint of the program i.e., where user has stopped the program.
Breakpoints

A breakpoint is the signal, which is specified in the program, tells the system to stop the program execution and to start the debugger. Following types of breakpoint are available with ABAP/4:

• Static are set up with the BREAKPOINT keyword inside the program, which you can directly display with the ABAP/4 source code editor. To set the breakpoint in the program enters the keyboard BREAKPOINT.

• Dynamic this breakpoint is not visible in the code. Position the cursor over the source code line to have the breakpoint and then select utilities -  breakpoint -  set. You can delete them or display them from breakpoint list. Or you can execute the program in the ABAP/4 debugger i.e., in debugging mode.

• Watchpoints are field specific. The program is stopped when the field reaches the value specified in the watchpoint. Execute the program in debugging mode. Position the cursor over the needed field. Press the F button to get the view of field. Select the checkbox for the needed watchpoint. Click on the continue button.

• Keywords/events The program stops just before executing a specific event or keyword. To set breakpoint at particular event, from initial screen of debugger, select Breakpoint  Breakpoint at  at event/at keyword. Enter the name of the keyword or event. Click on OK.


Navigating through the breakpoint

Following buttons are used to navigate through the program and debugger.

• Single step: Executes a single program command.

• Execute: Similar to the single step, but when a program calls a subroutine, it executes the whole subroutine unlike single step.

• Continue: Executes the program until it is finished or until it finds next breakpoint.

• Return: Allows for executing the program instruction up to the end of a routine and stops in the line of code where the subroutine gives back control to the main program.

• Tables: Switches the debugger to the table view.


Displaying and modifying values

Every time the program is stopped within a debugger, you can display and modify the contents of table field and fields.

To display the fields, click on V and you can view the contents of system field, program field, ABAP/4 dictionary fields, and external program fields.

Displaying and modifying internal tables

When you click on the Table button from the initial ABAP/4 debugger screen, the system will display the table debugger view. Here you need to enter the name of the internal table to be displayed. You can modify or delete or add i.e., insert the internal table Contents. These changes are applicable only for the debugging and do not affect the structure of internal table in the program.

Setting WATCHPOINTS

• Execute a program in debugging mode.
• Position the cursor over the needed field.
• Press the F button to get a view of the fields.
• Select the checkbox for the needed watchpoint.
• Click on the CONTINUE button.
• To display the active watchpoint select Goto -  Breakpoint

No comments:

Post a Comment