0% found this document useful (0 votes)
47 views24 pages

DEBUGGING

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
47 views24 pages

DEBUGGING

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
You are on page 1/ 24

DEBUGGING

ABAP DEBUGGER- An Over View

• ABAP Debugger is an integrated test tool within the


ABAP Workbench.
• Used to check the program logic and to find errors in
the source code of an ABAP program.
• Running program is interrupted after each step,
allowing you to check its processing logic and the
results of individual statements.
• Stepping through a program with the debuggger helps
you to detect and correct errors in your code and also
used to check the Program logic
WORKING WITH DEBUGGER

• Switch on the debugger


• Set and delete static and dynamic break points.
• Set watch points
• Stop a program at specific key words or events or when a
field contents change.
• Continue processing after an interrupt.
• Display field contents during runtime.
• Display the contents of an internal table.
• Change field contents for testing purposes.
• Change the contents of an internal table.
• Display and use debugger’s views.
DEBUGGING STRATERGIES:

There are two possible strategies for starting the Debugger in


the ABAP Workbench:
 By setting breakpoints then running the program
 By running the program in debugging mode with out break
point.
BREAK POINT :

• A breakpoint is a signal in a line of code that tells the ABAP


runtime processor to interrupt the program at that line and
start the ABAP Debugger Setting break points is a good
strategy if we want to examine a program:
 After the system has already processed certain events
 Just before a specific event is carried out
 By skipping quickly to a specific routines or calls.
Running a Program in Debugging Mode:
• Start the Debugger without previously having set breakpoints.
• Start the Debugger as follows:
From Object Navigator : Select a report or transaction and
program and choose Program Test Debugging.
From ABAP Editor : Choose Program  Execute 
Debugging.
From any screen : Choose System  Utilities  Debug
ABAP or /h in the command field.
DISPLAY MODES IN THE DEBUGGER

• Structure of the debugging view


 Each debugging view has the same structure.
 The top half of the screen displays an extraxt of the
programs source code.
 The lower half shows information specific to that particular
view .
 The line currently ready for processing is indicated by “>”.
 A small stop sign appears to the left of each dynamic
break point .
DISPLAY MODES WITH PUSH BUTTON
FIELDS: Display contains the contents of fields.
TABLES: Display the contents of internal table.
CALLS: Displays the current sequence of events, and the
sequence of calls up to the current breakpoint.
OVERVIEW :Displays the structure of the program to be
debugged.
SETTINGS: This mode displays the current Debugger
settings.
DEBUGGING SCREEN:
TYPES OF BREAK POINTS:
• Key word (statement) or event breakpoints
Set within the ABAP/4 debugger. The debugger interrupts the
program when the ABAP/4 processor comes in contact with a
specific key word (statement) or event in program’s code.
• When a static breakpoint is used?
Static break point are generally user-independent. On setting
this breakpoint , every use who executes the program
encounters the breakpoint. This is used when several
developers are working in the same program, and all wants to
the program to interrupt at the same place during execution .
Cont….
Dynamic:
Dynamic break point is user-specific. If we want to interrupt a
program when we execute and while others are running, we
use dynamic break-point. Dynamic breakpoints are more
flexible than static breakpoint , they can be removed or
deactivated during runtime.
They have the following advantages:
• You do not have to change the program code.
• You can set them even when the program is locked by
another programmer.
• You can define a counter.
DELETING BREAK POINT

It is necessary to remove the breakpoints after


debugging. Use function Utilities  Global search to help in
locating break-points in larger programs. It is necessary to
remove breakpoints since it may cause serious disruptions in
productive process.
Setting Dynamic Breakpoints

We can set dynamic breakpoint , without changing the program’s


code.
• Position the cursor on the line of the source code at which you
want to set the breakpoint.
• Choose Utilities Breakpoints Set or the Stop icon. The system
confirms that the breakpoint has been set.
• To display a list of all dynamic breakpoints in a program, choose
Utilities  Breakpoints  Display. You can use this list to navigate
to a particular breakpoint or to delete one or more breakpoints
from the program.
Setting Breakpoints…
At Statements: Choose Breakpoint Breakpoint at  Statement...
Breakpoint applies to all lines containing the specified statement.
At Subroutines :Choose Breakpoint  Breakpoint at  Event/Subroutine.
Breakpoint applies wherever the specified subroutine occurs in the
program code.
At Function Module: Choose Breakpoint  Breakpoint at  Function
module...
Breakpoint wherever the specified event, module pool, or subroutine
occurs in the program code.
At System Exceptions: Choose Breakpoint  Breakpoint at  System
exception
When a system exception is triggered, a warning triangle appears in
the line containing the statement that caused it. If you double-click the
warning triangle, the internal name of the runtime error appears.
WATCH POINTS:

A watchpoint is an indicator in a program that tells the ABAP runtime


processor to interrupt the program at a particular point. Unlike
breakpoints, however, watchpoints are not activated until the
contents of a specified field change. Watchpoints, like dynamic
breakpoints, are user-specific, and so do not affect other users
running the same program. You can only define watchpoints in the
Debugger.
SETTING WATCHPOINTS :
A watchpoint can be either local or global. Local watchpoints
are only valid in the specified program. Global watchpoints are
valid in the specified program, and also in all the other programs it
calls.
 Choose Breakpoint Create watchpoint or Press the
corresponding pushbutton
 Decide to set a local or global watchpoint .
 Enter the program and the name of the field for which you
want to set the watchpoint.
 Relational operator and comparison field .Fill in as per
requirement.
 A display of watch points can be viewed by goto-->control
debugging--> Watchpoint.
DELETING WATCH POINTS:

We cannot delete watchpoints by choosing Breakpoint Delete


or Breakpoint Deactivate/activate. Instead, proceed as
follows:
• Choose Goto Control debugging Watchpoints or the
Watchpoints pushbutton to display the watchpoint list.
Choose the trashcan icon in the line containing the
watchpoint you want to delete.
STEPPING THRU THE SOURCE CODE
• Single step : Use this option to step through the program
statement by statement. This allows you to branch to other
programs.
• Execute:Use this option to process a program line by line. All
of the statements on the current line are processed in a single
step. This allows you to process the whole program.
• Return:The Debugger returns to the point at which control
returns to the main program. Use this option to return from
other programs.
• 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.
DISPLAYING THE FIELD CONTENTS
While debugging display of the critical of the critical contents of the
fields are possible.
• Display of the contents up to eight fields or field strings can be
done. We can enter the field names directly in the spaces
provided or double click the field in the code display and the
system lists it as a variable automatically.
• We can use the variable screen to display the contents of any
system field or all field that a program references. Also the
debugger to display fields defined in the ABAP/4 dictionary can
be used.
• To display the contents of dictionary fields, we must define
relevant table in the TABLES statement of the current program.
• Additionally the contents of the fields from external programs
can be displayed. For this we need to place the name of the
external program in brackets in front of the field name.
DISPLAYING INTERNAL TABLES
Within the debugger , we can display the contents of an internal
table by choosing the table pushbutton.
• The system displays the table view. Specify a table name in
the internal table field or double click on the table. If the
internal table contains a header line, this line appears before
the actual table contents and is marked in the display by
>>>>>>>.The table rows are numbered. We can scroll through
the table display using the index field or the scroll icons. If we
want to see those parts of the tables that are not visible on the
left or right of the screen , use the push buttons for horizontal
scrolling or simply shift the title bar of the table.
• Using the column header line, we can also change the
sequence of the fields we want to see. If we remove a field
name from the column header line, then the system deletes
the field from the display. If we specify an incorrect field name,
the system displays a string of question marks.
Cont…

• If the space you leave to display a field is too small , the


system truncates the display and indicates this by a “<”
character.
• As with the field display , we can customize the display format
for internal tables. The standard entry in the format field is an
E (for edited) . you can change this to an X for hexadecimal or
a C for character display.
• Once we have finished examining the internal table , return to
the screen with the field display and program code by
selecting the program button.
REPLACING FIELDS AT RUNTIME
CHANGING INTERNAL TABLES AT
RUNTIME
The debugger allows to manipulate the contents of an
internal table during runtime. We can delete, edit or
add a row to an internal table.
• To delete an entry from an internal table:
1. Go to the table display screen
2. Enter the table name in the internal table field.
3. Choose enter.The system displays the table’s contents.
4.Place the cursor on the line you wish to remove from the
table.
5.Press ‘delete’ pushbutton.
The line disappears from the table and the system
adjusts the line numbering accordingly.
SWITCHING TO THE ABAP/4 EDITOR
We can switch from the debugger to ABAP/4 editor at any time. If
we discover a program error during the debugging process , for
example,we can enter the ABAP/4 editor to immediately correct
the error in the program’s code. We can also switch back to the
editor in order to set new static break-points.
• After we set static breakpoints in the editor,they are not active in
the debugger when we switch back.We must re-generate the
program.Then the breakpoints appear in the debugger.
• To return to the editor for the program currently being debugged ,
Select development-->ABAP/4 editor.

• *

You might also like