Quantcast
Channel: SCN : Document List - ABAP Development
Viewing all articles
Browse latest Browse all 935

Understanding Debugging Techniques in SAP ABAP

$
0
0
OBJECTIVE:
This document will give an overview about the debugging apporach in SAP ABAP.
Introduction:

ABAP Debugger:

  • An integrated test tool within the ABAP workbench
  • Used  to check program logic and find errors in the source code of an ABAP program
  • Here a running program is interrupted after every step, allowing you to check its processing logic and the results of individual statements
  • Provides an efficient means of identifying errors in ABAP programs.

Starting the Debugger:

    • Two possible ways for starting the Debugger in the ABAP Workbench

 

      • Debugging without Breakpoint
      • Debugging with Breakpoint

Debugging without Breakpoint

     You can start the Debugger as follows:
  • In SE80: Select a program or transaction and from the top menu choose Program® Test ® Debugging.
  • In SE38: From the top menu choose Program®Execute®Debugging.
  • From any other screen: From the top menu choose System®Utilities®Debug ABAP
          Or Enter/h in the command field and press enter

Debugging with Breakpoints

  • A breakpoint is a signal in a specific line of the program source code.
  • This signal indicates to the ABAP runtime processor to stop the program at the relevant line and start the ABAP Debugger.
Different ways to put break points:

 

 

1. Hard coded / Static break points

2. Dynamic break points

 

 

1. Hard coded / Static break points:

 

You can put a breakpoint in our program by writing statement “BREAK-POINT” or “BREAK <userid>”.

 

Use “BREAK <userid>” to stop the program execution when a specific user is executing the program.

 

NOTE:

 

Static breakpoints are not normally user-specific. Once a user has inserted the statement BREAK-POINT or BREAK name in an ABAP program, the system always interrupts the program at that point for that user or only for the user name. This procedure is only useful in the development phase of an application, when the program execution is always to be interrupted at the same place.

 

 

 

2. Dynamic break points:

 

 

  • We can put dynamic breakpoints from SE80 or SE38.
  • These are always user-specific.
  • Are deleted when we log off R/3 system.
  • More flexible than static breakpoints because you can delete/deactivate them at runtime.

 

 

Keys used in Debugging:

 

  • F5 (Single Step):  Use this key  to go line by line throughout the program.

 

  • F6 (Execute):  This is mainly used to execute a Function Module in a single step; without entering into the Function Module / Subroutine.

 

  • F7  (Return):  The Debugger returns to the point at which control returns to the main program. We use this option to return from other programs or to return from a module or subroutine or a function module.

 

  • F8 (Run / continue):  Use this option to process the program up to the next breakpoint. If there are no more breakpoints in the program, the system exits debugging mode and executes the rest of the program normally.

 

 

I hope above information will be helpful.Your comments and suggestions are most welcome.

 

Rgrds,

Jitendra

 

 

 

 


Viewing all articles
Browse latest Browse all 935

Trending Articles