ABAP Debugging Overview

download ABAP Debugging Overview

of 41

Transcript of ABAP Debugging Overview

  • 7/29/2019 ABAP Debugging Overview

    1/41

    v5.0

    ABAP Overview Training

    http://basellworld.basell.com/servlet/PB/menu/-1/index.htmlhttp://basellworld.basell.com/servlet/PB/menu/-1/index.htmlhttp://basellworld.basell.com/servlet/PB/menu/-1/index.htmlhttp://basellworld.basell.com/servlet/PB/menu/-1/index.html
  • 7/29/2019 ABAP Debugging Overview

    2/41

    v5.0

    2

    AGENDA

    1. Introduction

    2. Components of an ABAP Program / SAP Transaction

    3. Introduction in to the ABAP Runtime environment and

    Debugging facilities

    4. Examples / Exercises

  • 7/29/2019 ABAP Debugging Overview

    3/41

    v5.0

    3

    1. Introduction

    Landscape: Database, Application and Presentation server

    Processes

    Data Dictionary

    Components of ABAP: Reports, Dialog Programming, SAP script

    / smartform, BDC and user exits

    Basic commands

  • 7/29/2019 ABAP Debugging Overview

    4/41

    v5.0

    4

    2. Components of an ABAP Program code

    Purpose of that Chapter:

    In order not to get lost in the coding you need to know Where

    you are how a program is structured and how to navigate in it

    To make the debugging more efficient, it is necessary to learn

    how to debug only the relevant parts of the program and to skip

    unimportant parts.

    This is a small repetition from ABAP basic programming, Please

    note that we will not discuss all details of all Program

    components.

  • 7/29/2019 ABAP Debugging Overview

    5/41

    v5.0

    5

    2. Components of an ABAP Program code

    All ABAP programs are modular in structure and made up of processing

    blocks. There are two kinds of processing blocks, those that are calledfrom outside a program by the ABAP runtime system, and those that canbe called by ABAP statements in ABAP programs.

    Source Code Modules

    Programs and Program includes

    Program Macros

    Procedures

    Form routines

    Function Modules

  • 7/29/2019 ABAP Debugging Overview

    6/41

    v5.0

    6

    2. Components of an ABAP Program code

    Source Code Modules:

    When you modularize source code, you place a sequence of ABAP statements in a

    module. Then, instead of placing all of the statements in your main program, you justcall the module.

    When the program is generated, the source code in the modularization unit is treatedas though it were actually physically present in the main program. Source codemodules help you to avoid repeatedly writing the same set of statements and to makeyour programs easier to read and understand. They are not used to modularize tasksand functions. You should use procedures for this purpose.

    ABAP contains two kinds of source code modules: Local modules are called macros,and cross-program modules are called include programs.

  • 7/29/2019 ABAP Debugging Overview

    7/41v5.07

    2. Components of an ABAP Program code

    MACROS

    If you want to reuse the same set of statements more than once in a program, you can include

    them in a macro. For example, this can be useful for long calculations or complex WRITEstatements. You can only use a macro within the program in which it is defined, and it can onlybe called in lines of the program following its definition.

    DEFINE .

    END-OF-DEFINITION.

  • 7/29/2019 ABAP Debugging Overview

    8/41v5.08

    2. Components of an ABAP Program code

    Include Programs

    Include programs are global R/3 Repository objects. They are solely for

    modularizing source code, and have no parameter interface

    They have the following functions:

    - Library: Include programs allow you to use the same source code in differentprograms. For example, this can be useful if you have lengthy data declarationsthat you want to use in different programs.

    - Order. Include programs allow you to manage complex programs in an orderly way.Function groups and module pools use include programs to store parts of theprogram that belong together. The ABAP Workbench supports you extensivelywhen you create such complex programs by creating the include programsautomatically and by assigning them unique names. A special include is the TOPinclude of a program. If you name it according to the naming convention, it isalways included in program navigation and in the syntax check.

  • 7/29/2019 ABAP Debugging Overview

    9/41v5.09

    2. Components of an ABAP Program code

    Procedures

    Procedures contain a set of statements, and are called from other ABAP programs.

    ABAP contains the following kinds of procedures:

    Subroutines:

    Subroutines are principally for local modularization, that is, they are generally called from the program in which they are defined.

    You can use subroutines to write functions that are used repeatedly within a program. You can define subroutines in any ABAP

    program.

    Function Modules:

    Function modules are for global modularization, that is, they are always called from a different program. Function modules containfunctions that are used in the same form by many different programs. They are important in the R/3 System for encapsulating

    processing logic and making it reusable. Function modules must be defined in a function group, and can be called from any

    program.

    Methods:

    Methods describe the functions and behavior of classes and their instances in ABAP Objects. Methods must be defined in classes.

    When you call them, you must observe certain special rules of object-oriented programming.

    You can call procedures either internally or externally. If you call procedures externally, it is important that you understand how

    memory is organized in the R/3 System, how screens are processed, and how interface work areas are used.

  • 7/29/2019 ABAP Debugging Overview

    10/41v5.010

    2. Components of an ABAP Program code

    Defining SubroutinesA subroutine is a block of code introduced by FORM and concluded by ENDFORM.FORM [USING ... [VALUE(][)] [TYPE |LIKE ]... ]

    [CHANGING... [VALUE(][)] [TYPE |LIKE ]... ].

    ...

    ENDFORM.

    is the name of the subroutine. The optional additions USING and

    CHANGING define the parameter interface.

    Calling SubroutinesYou call subroutines using the statementPERFORM... [USING ... ... ]

    [CHANGING... ... ].

    Subroutines can call other subroutines (nested calls) and may also call themselves(recursive calls). Once a subroutine has finished running, the calling programcarries on processing after the PERFORM statement. You can use the USING and

    CHANGING additions to supply values to the parameter interface of the subroutine.

  • 7/29/2019 ABAP Debugging Overview

    11/41v5.011

    2. Components of an ABAP Program code

    Function Modules:

    Function modules are procedures that are defined in function groups (special ABAP programs with type F)and can be called from any ABAP program. Function groups act as containers for function modules thatlogically belong together. You create function groups and function modules in the ABAP Workbench usingthe Function Builder.

    Function modules allow you to encapsulate and reuse global functions in the R/3 System. They are stored ina central library. The R/3 System contains a wide range of predefined function modules that you can callfrom any ABAP program. Function modules also play an important role in data base updates and in remote

    communications between R/3 Systems or between a R/3 System and a non-SAP system.

    Unlike subroutines, you do not define function modules in the source code of your program. Instead, youuse the Function Builder. The actual ABAP interface definition remains hidden from the programmer.

  • 7/29/2019 ABAP Debugging Overview

    12/41v5.012

    2. Components of an ABAP Program code

    To call a function module, use the CALL FUNCTION statement:CALL FUNCTION

    [EXPORTING f1 = a 1.... f n = a n][IMPORTING f1 = a 1.... f n = a n][CHANGING f1 = a 1.... f n = a n][TABLES f1 = a 1.... f n = a n][EXCEPTIONS e1 = r 1.... e n = r n

    [ERROR_MESSAGE = r E][OTHERS = ro]].

  • 7/29/2019 ABAP Debugging Overview

    13/41v5.013

    3. Introduction in to the ABAP Runtime environment andDebugging facilities

    Purpose of that Chapter:

    After that Chapter you should know / know how to perform:

    How to start the Debugger

    To name the components and the functionality of the ABAP debugger

    How to step trough / navigate the coding (during a debugging session)

    How to display the content of variables / internal tables

    How to change the content of variable / internal tables

    How to set Break points

    How to set Watch points

  • 7/29/2019 ABAP Debugging Overview

    14/41v5.014

    3. Introduction in to the ABAP Runtime environment andDebugging facilities

    How to start the Debugger

    Start from any point you are by typing /h in the command field (Except: SAP displayscurrently a popup window )

    From Transaction SE38:

    - Enter the Program name- Press the debugging button

    - Disadvantage: The debugger will show the handling of the selection screen.

  • 7/29/2019 ABAP Debugging Overview

    15/41v5.015

    3. Introduction in to the ABAP Runtime environment andDebugging facilities

    How to start the Debugger

    From Transaction SE80

    1. Enter the program name and checkProgram and click Display

    2. Put the cursor on the program name anpress the execute button

    3. Click on Debugging in Execution Type

    Popup.

    Advantage:

    Debugging starts directly in the programevent processing

  • 7/29/2019 ABAP Debugging Overview

    16/41v5.016

    3. Introduction in to the ABAP Runtime environment andDebugging facilities

    Components of the ABAP Debugger

    Navigationtrough the

    coding

    Creation ofwatch points

    NextProgramstep to beexecuted

    Navigationtrough the

    coding

    Creation ofwatch points

    Switch to theinternal table

    display

    Currentlyactive ABAP

    Program

    Include inwhich the

    current codingis located

    ProgramCoding line

    number

    Delete all

    variablesfrom

    Scroll troughthe list ofvariables

    ImportantSystem

    Variables

    List of variablesfor which the

    content shouldbe analysed

  • 7/29/2019 ABAP Debugging Overview

    17/41v5.017

    Introduction in to the ABAP Runtime environment andDebugging facilities

    Display Modes of the ABAP Debugger:

    Fields:The scrollable field display can display the

    contents of up to eight fields. It also alwayscontains the values of the three mostimportant system fields.

    This is the default display mode in the Debugger.

    Table:The Displays the contents of an internal table.

    You can also edit the contents of the tablein this mode

    Break points:Scrollable display containing up to 30

    breakpoints. You can also deletebreakpoints from the display, and set acounter for each one.

  • 7/29/2019 ABAP Debugging Overview

    18/41v5.018

    Introduction in to the ABAP Runtime environment andDebugging facilities

    Display Modes of the ABAP Debugger:

    Watch Points:The scrollable field display can display thecontents of up to eight fields. It also alwayscontains the values of the three mostimportant system fields.

    This is the default display mode in the Debugger.

    Calls (Call stack):Displays the active sequences of events andcalls up to the current breakpoint. The last call is

    displayed at the top of the list, with previous calls

    below. As soon as an event (such as START-

    OF-SELECTION) is finished, it disappears from

    the list..

    Overview:Displays the structure of the program. Thisdisplay contains the events, subroutines,and modules in the program, and showswhich section of code belongs to whichevent. The section currently beingprocessed is displayed

  • 7/29/2019 ABAP Debugging Overview

    19/41

    v5.019

    Introduction in to the ABAP Runtime environment andDebugging facilities

    Display Modes of the ABAP Debugger:

    Setting:

    Displays the current Debugger settings. You canchange these using the checkboxes

  • 7/29/2019 ABAP Debugging Overview

    20/41

    v5.020

    Introduction in to the ABAP Runtime environment andDebugging facilities

    Navigation trough the coding

    There are four different ways of stepping through program code in the Debugger:

    Single step:

    Use this option to step through the program a statement at a time. This is particularly suitablewhen you want to look into subroutines and function modules, since this method steps throughthem as well as the main program. After processing a subroutine or function module, theDebugger returns to the statement in the main program that follows the call.

    Execute:

    This option processes a program a line at a time. All steps in the same line are processedtogether. If you are positioned on a line that calls a subroutine and choose Execute, the systemexecutes the subroutine and proceeds directly to the next line in the main program, bypassingthe statements in the subroutine.

    Return:

    Returns to the position at which a calling program regains control. Use this option when you aredebugging a subroutine or function module and want to return to the program that called it.

    Continue

    Use this option to process the program up to the next breakpoint (dynamic or static) or up to thecursor position. If there are no more breakpoints in the program and you have not set a cursor,the system processes the remainder of the program and ends the debugging session.

  • 7/29/2019 ABAP Debugging Overview

    21/41

    v5.021

    Introduction in to the ABAP Runtime environment andDebugging facilities

    Displaying Field content:

    - In the Fields display mode in the Debugger, you can display, and also change, the contents ofup to eight program fields. This is the default display mode in the Debugger.

    Procedure:

    - From any display mode in the Debugger, choose Fields.

    - Enter the field names, either directly in the input fields, or by double-clicking the field name inthe source code display. The system automatically enters the field name in the display.

    - Step through the program to analyze the coding.

  • 7/29/2019 ABAP Debugging Overview

    22/41

    v5.022

    Introduction in to the ABAP Runtime environment andDebugging facilities

    Displaying Field content:

    - Displaying Other Fields

    The field display only has space for four fields. However, you can use the scroll

    buttons to display other fields.

    - Displaying System Fields

    This mode allows you to display the contents of system fields or fields definedin the program. The three most important system fields (SY-SUBRC, SY-TABIX, and SY-DBCNT) are always displayed.

    - Displaying Fields From External ProgramsYou can also display the contents of fields from external programs as long asyou know the program name. Enter the program name in parentheses beforethe field name.

    - Changing the Display Format

    You can display the field contents with their normal formatting or in hexadecimalform.

    Use this button to display the field contents in hexadecimal form

    Use this button to display the field contents in their normal output format.

    - Deleting All Field Names

    Use this button to delete all of the field names from the field display.

  • 7/29/2019 ABAP Debugging Overview

    23/41

    v5.023

    Introduction in to the ABAP Runtime environment andDebugging facilities

    Displaying Internal Tables : The Debugger allows you to display and change the contents of simple or nested internal

    tables. The table display mode also allows you to find out information about the table type,table key, or memory use of an internal table.

    Procedure:

    1. From any display mode in the Debugger, choose Goto => Table or pressThe table display mode appears.

    2. In the Internal table field, enter a table name (or double-click the name of an internaltable in the source code display).

    3. Choose ENTER .

    4. Step through the program to analyze the source code.

  • 7/29/2019 ABAP Debugging Overview

    24/41

    v5.024

    Introduction in to the ABAP Runtime environment andDebugging facilities

    Displaying Internal Tables :

    Header LineIf the internal table has a header line, this is indicated by the hat icon. Double-click the icon to go to the Structured field display.This displays the component names, their current contents, and the technical attributes of the table structure.

    Scrolling Vertically

    The table lines are numbered. The fist column of the display heading is an input field in which you can enter the line of the tablethat you want to display.

    You can also use the normal scrolling keys to scroll page by page.

    Scrolling Horizontally

    Use the scrolling buttons to scroll through the internal table horizontally if the table is too wide to display on the screen. You canalso shift the column headings

    Shifting Column Headings

    You can rearrange the order in which the fields are displayed by shifting the column headings. Simply overwrite the existingheadings with the sequence that you want. You can remove a field from the display by deleting its heading from the displayheader. If you enter an incorrect name, the system displays a row of question marks.

    If there is insufficient room to display the whole f ield, the system truncates the display and indicates this with the "

  • 7/29/2019 ABAP Debugging Overview

    25/41

    v5.025

    Introduction in to the ABAP Runtime environment andDebugging facilities

    Changing the Values of Fields at Runtime:While you are debugging a program, you might want to change the content of specific fields to

    influence your program's flow. For example, suppose your debugging session reveals that a fieldcontains a wrong value. The Debugger allows you to replace the wrong value with a correct one.

    You can now see whether the program works properly when the field values are correct.

    You can change the values of all fields, database tables (with offset), and internal tables

    referenced in a program. The system displays a message to notify you of any format errors.

    Procedure1. Switch to field display mode.

    2. Double-click a field to place it in the field display. The field is displayed with its current value.

    3. Enter a new value for the field contents.

    4. Choose the pencil icon at the end of the line. Result

    The Debugger writes the new value into the program field(s), and records the change in the system log.

    If you forget to click on the pencil icon, the system ignores the values you entered.

    The Debugger records the values exactly as you enter them. You must therefore make sure that youuse the correct format (upper/lowercase, left-justified input for hexadecimal numbers).

  • 7/29/2019 ABAP Debugging Overview

    26/41

    v5.026

    Introduction in to the ABAP Runtime environment andDebugging facilities

    Changing Internal Tables at Runtime:

    The Debugger allows you to manipulate the contents of an internal table during runtime. You can delete, edit,

    or add a row to an internal table.

    Deleting a Row :

    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 contents of the table.

    4. Place the cursor on the line you wish to remove from the table.

    5. Choose Delete.

    The line disappears from the table and the system adjusts the line numbering accordingly.

  • 7/29/2019 ABAP Debugging Overview

    27/41

    v5.027

    Introduction in to the ABAP Runtime environment andDebugging facilities

    Changing Internal Tables at Runtime:

    Editing a Row

    The functions Modify, Insert, and Append are field-specific in the Debugger. You can only applythem to one field at a time. For example, if you want to edit the following line:

    bukrs gjahr rjahr belnr buzei rblnr rbuze

    |1500 |2002 |2002 |5110000727|001 |5105603189|000001|

    you first need to decide which field to change. Then, do the following:

    1. Place the cursor on the row and field you want to edit.2. Choose Change. The system displays one field of the chosen row in the input mode.

    3. Enter a new value for the field.

    4. Choose ENTER .

    The system updates the line and displays the new contents in the table.

  • 7/29/2019 ABAP Debugging Overview

    28/41

    v5.028

    Introduction in to the ABAP Runtime environment andDebugging facilities

    Changing Internal Tables at Runtime:

    Adding appending a Row:

    The Insert and Append functions allow you to add new lines to an internal table. Append places thenew line at the end of the table. Insert lets you position the line anywhere. To add a new row to the

    end of the table:

    1. Choose Append.

    2. Enter a value for the first field in the line.

    3. Choose ENTER .

    The system adds a line to the table and fills in the first field.4. Enter the remaining fields of the line by following the procedure for editing a row as described

    above.

    To insert a new line anywhere in the internal table, position the cursor on theline directly following the line where you want the new row to appear. Then,choose the Insert button and proceed as you would if you wanted to append theline.

  • 7/29/2019 ABAP Debugging Overview

    29/41

    v5.029

    Introduction in to the ABAP Runtime environment andDebugging facilities

    BreakpointsAs well as running a program from the beginning in the Debugger, you can also set a precise point in

    the program at which the Debugger is called by setting one or more breakpoint. A breakpoint is a signalfrom the ABAP program to the runtime processor to interrupt processing and start the Debugger.

    As an alternative to breakpoints, you can set watch points. Watch points activate the Debugger when

    the contents of a selected field change. For further information, refer to Watch points

    Static To set a static breakpoint, enter the ABAP statement BREAK-POINT directlyin the program code. Normally user-independent, they can also be madeuser-specific.

    Dynamic breakpoints setdirectly

    These are set in the ABAP Editor or the Debugger, and are displayed as stopsigns. Unlike static breakpoints, they are always user-specific, and aredeleted when you end your terminal session.

    Statement breakpoint This special form of dynamic breakpoint is set in the Debugger. TheDebugger interrupts the program immediately before the specifiedstatement is executed.

    Event breakpoint This form of dynamic breakpoint is set in the Debugger. The Debugger

    interrupts the program immediately before the event, subroutine, or modulepool is called.

    Breakpoints at functionmodules

    The Debugger interrupts the program immediately before a function moduleis called.

    Breakpoints at systemexceptions

    The Debugger interrupts the program as soon as a system exceptionoccurs, that is, when a runtime error is caught by a CATCH statement.

  • 7/29/2019 ABAP Debugging Overview

    30/41

    v5.030

    Introduction in to the ABAP Runtime environment andDebugging facilities

    Dynamic Breakpoints

    Dynamic breakpoints are user-specific. You should therefore use them whenever you want to interrupta program without affecting other users. When you log off from the R/3 System, all of your dynamic

    breakpoints are automatically deleted.

    Dynamic breakpoints are more flexible than static breakpoints, since you can delete or deactivate them

    at runtime. This has the following advantages:

    You do not have to change the source code

    You can set them even if other developers are blocking the program that you are testing

    You can set a counter (for example, only activate the breakpoint when it is reached for the fifthtime)

    I d i i h ABAP R i i d

  • 7/29/2019 ABAP Debugging Overview

    31/41

    v5.031

    Introduction in to the ABAP Runtime environment andDebugging facilities

    Dynamic Breakpoints

    You can set up to 30 dynamic breakpoints without having to change the source code of your program.

    You can set them either in the ABAP Editor or directly in the Debugger:

    Setting Dynamic Breakpoints in the ABAP Editor

    In the ABAP Editor, you can set dynamic breakpoints in either change or display mode. You can also set

    breakpoints at runtime directly within the Debugger. To set a dynamic breakpoint in the ABAP Editor:

    1. Place the cursor on the line of code at which you want to set the breakpoint.

    2. Choose Utilities => Breakpoint => Set.

    The system confirms that the breakpoint was set. It is displayed as a stop sign to the right of the programcode.

    You can display a list of all dynamic breakpoints in a program by choosing Utilities => Breakpoints =>

    Display. The dynamic breakpoint display lets you navigate to a certain breakpoint or delete one or all

    breakpoints from your program code.

    Setting Dynamic Breakpoints in the Debugger1. Place the cursor on the line where you want to set the breakpoint.2. Select the line either by choosing Breakpoint => Set/delete or by double-clicking.

    The system sets a breakpoint at the line and places a small stop to the left side of the line indicating a

    breakpoint. If the line already contains a breakpoint, the system deletes it.

    When you finish your debugging session, your breakpoint will be deleted unless you haveexplicitly saved it.

    I t d ti i t th ABAP R ti i t d

  • 7/29/2019 ABAP Debugging Overview

    32/41

    v5.032

    Introduction in to the ABAP Runtime environment andDebugging facilities

    Special Dynamic BreakpointsSpecial dynamic breakpoints are useful whenever you want to interrupt a program directly before a

    particular ABAP statement, subroutine, or event, but you are not sure exactly where that statement,subroutine or event occurs. Special dynamic breakpoints are user-specific, and can only be set in the

    Debugger.

    Breakpoint at ABAP Statement

    1. Choose Breakpoint => Breakpoint at => Statement.

    2. The following screen appears

    1. Enter the ABAP statement.

    2. Choose ENTER .The system sets a breakpoint in all liens containing the given statement.

    The system confirms the breakpoint and adds it to the breakpoint list. When you end your debugging

    session, the breakpoint is deleted automatically unless you save it explicitly.

    I t d ti i t th ABAP R ti i t d

    http://help.sap.com/saphelp_46b/helpdata/en/d1/802133454211d189710000e8322d00/content.htm
  • 7/29/2019 ABAP Debugging Overview

    33/41

    v5.033

    Introduction in to the ABAP Runtime environment andDebugging facilities

    Breakpoints at Subroutines, Events, ModulesThese special dynamic breakpoints allow you to interrupt a program directly before a subroutine,

    event, or module is called.Procedure

    1. Choose Breakpoint => Breakpoint at => Event/Subroutine.

    2. The following dialog box appears:

    1. Enter the subroutine, module, or event before which you want to interrupt the program.

    2. Choose ENTER.

    The system sets a breakpoint immediately before all calls to the subroutine, module or event.

    Result

    The system confirms the breakpoint and adds it to the breakpoint list. If the subroutine, module,or event does not exist in the program, the system displays a message and does not set thebreakpoint

    I t d ti i t th ABAP R ti i t d

  • 7/29/2019 ABAP Debugging Overview

    34/41

    v5.034

    Introduction in to the ABAP Runtime environment andDebugging facilities

    Breakpoints at Function Module Calls

    These dynamic breakpoints allow you to interrupt a program directly before a particular function

    module is called.Procedure

    1. Choose Breakpoint => Breakpoint at => Function moduleThe following dialog box appears:

    2. Enter the function module before which you want to interrupt program processing.The system sets a breakpoint each time the function module appears in the program.

    3. Choose ENTER .If you entered a function module that exists in the system, the system confirms the breakpointand adds it to the breakpoint list.

    I t d ti i t th ABAP R ti i t d

  • 7/29/2019 ABAP Debugging Overview

    35/41

    v5.035

    Introduction in to the ABAP Runtime environment andDebugging facilities

    Breakpoints at System ExceptionsThis special form of dynamic breakpoint allows you to interrupt a program immediately after a

    system exception has occurred (Short dump).

    ProcedureChoose Breakpoint => Break point at => System exception.

    ResultThe system confirms the breakpoint and adds it to the breakpoint list.

    When a system exception is triggered, a warning triangle icon appears in the line that caused it.

    Double-click the icon to display the ID of the runtime error.

    Introduction in to the ABAP Runtime environment and

  • 7/29/2019 ABAP Debugging Overview

    36/41

    v5.036

    Introduction in to the ABAP Runtime environment andDebugging facilities

    Watch pointsWatch points, like breakpoints, provide a signal from the program to the ABAP runtime processor

    to interrupt processing at a particular point in the program. Unlike breakpoints, watch points onlyactivate the Debugger when the contents of a field change. Like dynamic breakpoints, watch points

    are user specific, that is, they do not affect other users who are running the program at the same

    time

    You can only set watch points in the Debugger.

    UseYou can set watch points in the Debugger for specific fields. They allow you to determine when the

    contents of a certain field change. The Debugger interrupts the program as soon as the fieldcontents change.

    Features You can set up to five watch points in a program.

    You can also specify conditions that have to be met before a watch point becomes active.

    You can define a logical relationship between up to 5 conditional watch points.

    See also Specifying Logical Relationships Between Watch points. You can define watch points as either local or global. Local watch points are only active in the

    current

    program. Global watch points are valid in the current program and in any other programs that it

    calls.

    You can change watch points.

    You can delete watch points.

    Introduction in to the ABAP Runtime environment and

  • 7/29/2019 ABAP Debugging Overview

    37/41

    v5.037

    Introduction in to the ABAP Runtime environment andDebugging facilities

    Setting Watch pointsUse watch points when you want to interrupt a program when the contents of a field or structure

    change. You can set up to five watch points.Watch points can be either local or global. Local watch points are only active in the current

    program. Global watch points are active in the current program and any programs that it calls.

    You set watch points in the Debugger.

    Procedure1. Choose Breakpoint => Create watchpoint.

    The following dialog box appears:

    2. Decide whether you want to create a local or a global watch point.

    3. Enter the name of the field for which you want to set the watch point.

    4. If you want your watch point to be activated each time the field contents change, you have now

    entered all of the necessary information, and can return to the Debugger by choosing ENTER .

    The watch point now appears in the watch point list.

    5. If you want to specify conditions for the watch point, continue with step 5.

    6. To create a conditional watch point, choose one of the following relational operators:

    Introduction in to the ABAP Runtime environment and

  • 7/29/2019 ABAP Debugging Overview

    38/41

    v5.038

    Introduction in to the ABAP Runtime environment andDebugging facilities

    Setting Watch pointsTo create a conditional watch point, choose one of the following relational operators:

    Operator Meaning

    = or eq Equal

    or ne Not equal

    < or lt Less than

    = or ge Greater than or equal

    > or gt Greater than

    Introduction in to the ABAP Runtime environment and

  • 7/29/2019 ABAP Debugging Overview

    39/41

    v5.039

    Introduction in to the ABAP Runtime environment andDebugging facilities

    Specifying logical Conditions between WatchpointsIf you create more than one conditional watchpoint, you can link them using a logical operator:

    OR: only one of the conditions must be met.AND: All conditions must be met.

    Procedure:To establish a logical relationship between watch points:

    Open the watch points list by choosing Goto => Watch points.

    Set the Logical operator option. The default is always OR.

    Introduction in to the ABAP Runtime environment and

  • 7/29/2019 ABAP Debugging Overview

    40/41

    v5.040

    Introduction in to the ABAP Runtime environment andDebugging facilities

    Changing a Watchpoint1. Choose Goto => Watch points to display the watch points.

    2. Click the pencil icon in the line containing the watch point that you want to change.

    The following dialog box appears:

    1. Change the attributes of the watch point2. Choose ENTER .

    Introduction in to the ABAP Runtime environment and

  • 7/29/2019 ABAP Debugging Overview

    41/41

    Introduction in to the ABAP Runtime environment andDebugging facilities

    Deleting Watch points

    You cannot use Breakpoint => Delete or Breakpoint => Deactivate/ activate to deactivate or delete a

    watch point. Instead, you must:

    1. Choose Goto => Watch points to display the watch points.

    2. Click the trashcan icon in the line containing the watch point that you want to delete