Beruflich Dokumente
Kultur Dokumente
Debugging An overview
Stepwise method of finding out errors or bugs. The basic steps involve
Recognize that the bug exists Isolate source of bug Identify cause of bug Determine the fix for the bug Apply the fix and test it.
ABAP Debugging
ABAP Debugger allows you to interrupt the running program after each step, allowing you to check intermediate results and processing logic logic. . Debugger can be called in two ways ways. .
By setting break points points. .
Write BREAK BREAK-POINT or BREAK statement in program(static) Click STOP button in the toolbar of program (dynamic)
1.
2.
3.
4.
5.
Single step: Used to step through the program statement by statement.For subroutines, this will go inside the subroutine. .(F5 key can be used). Execute: Similar to single step , but for subroutines, this completely executes the subroutine,without going inside the routine.(F6 key can be used). Return: Used to return from a subroutine, or a called program to a calling program. Run: Used to process the program until the next static or dynamic break point.If no more breakpoints are there, this will exit the debugging mode and executes the rest of the program normally(F8 key). Watchpoints: Used to interrupt the execution of program when variable reaches a particular value.Will be discussed in detail later.
Break points
Causes program execution to stop at that location and start the debugger. Static BreakBreak-point.
User independent breakpoint:
Using statement BREAKBREAK-POINT. Interrupted when execution reaches the line of code. Useful in development phase and removed before transported. Can number the break points to identify them easier.
SAMPLE PROGRAM
User specific break point. No need to change the code. Can be set even when prog. is locked by any user. Deleted when logged off the SAP system.
30 dynamic break points can be set without changing the program code. Can be set directly in ABAP editor or while debugging. While debugging, break points can be set or deleted by double clicking the line of code.
OR
Similarly, break points can be set for Function Modules, Methods, Exceptions etc.
Break points will remain active until you delete it or you logoff the system. Break points can be deleted either by double clicking on the break point or selecting the menu option
Watch points
Used to interrupt program, when contents of field or structure change. Can save up to 5 watch points including watch points for strings. Can be local or global
Local watch points valid only in a specified program Global watch points valid only in a specified program and all the programs it calls.
Procedure to set Watch points Choose menu option Breakpoint -> Create watchpoint or the corresponding Pushbutton
OR
Provide the program name, variable name , relational operator(=,<,<=,>= etc) and the value.
Debugging Tools
Use the following buttons during debugging. Contents can be displayed by double clicking on the field name while debugging.
The internal table data , during debugging, can be downloaded to excelsheet, by clicking on Save as excel worksheet button and giving the number of rows to be downloaded.
Watch points and Break points: can be used to display them in the main program.
Debugging in Background
Debugging can be done for programs scheduled to run in background. Job should be either in Scheduled or Released status. After scheduling the program to run in background, select the job in SM37 and type jdbg in the command area.
Running programs (ie jobs with status Active) can also be debugged. Goto SM50 to get the list of processes. Identify the process related to the program. Goto menu option Program/ModeProgram/Mode ->Program >Program->Debugging SM50 Authorization for monitoring processes are needed for this method of debugging.
Reference documents
SAP Help documents http://www.sappro.com/ Experience
QUESTIONS ??