Anda di halaman 1dari 19

ABAP Debugger

The ABAP Debugger is an integrated test tool within the ABAP Workbench. You use it to check the program logic and to find errors in the source code of an ABAP program. In the Debugger, you can step through the source code of a program. The running program is interrupted after each step, allowing you to check its processing logic and the results of individual statements. As of Release 6.10, you can also run Business Server Pages (BSP) in the debugging mode. You can also display and set breakpoints here. Business Server Pages can be displayed in the Object Navigator when you select an appropriate application under BSP Application.

Features
The Debugger provides an efficient means of identifying errors in ABAP programs. It contains the following functions: Ways of starting the Debugger Choosing different views Choosing different execution options in the Debugger Displaying source code in the Debugger Setting and deleting breakpoints Setting and deleting watchpoints Stopping a program at a particular statement or event Displaying and changing field contents at runtime Displaying ABAP Objects and references Displaying and positioning strings Setting and deleting database locks Opening the ABAP Editor, or Object Navigator System settings and runtime warnings

Starting the Debugger


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.

Setting Breakpoints
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. A distinction is made between static and dynamic breakpoints. For further information about the different types of breakpoints and how to use them, refer to Breakpoints.

Running a Program in Debugging Mode


You can start the Debugger without previously having set breakpoints. This is the best procedure to use when you want to test a program right from the beginning. It is also useful if you do not know the program very well and therefore are not sure where best to set breakpoints. You can start the Debugger as follows: From the Object Navigator Select a report or transaction and program and choose Program Test Debugging. From the ABAP Editor From any screen From any screen Choose Program Execute Debugging (or the Debugging pushbutton). Choose System Utilities Debug ABAP. Enter " /h " in the command field.

Checking System Programs for Errors


To check a program or program component that is part of the ABAP Workbench (for example, the Screen Painter), you must use the system Debugger. To start the system Debugger, choose

ABAP Training

Page 1 of 19

System Utilities Debug system from any screen. To stop the system Debugger, choose Debugger Debugging off.

Displaying Program Attributes


You can display the attributes Fixed point arithmetic, System program and Unicode checks active of the program that has just been executed by choosing Goto Further Information Program Attributes.

Display Modes in the Debugger


When you are debugging a program, there are various display modes that you can use. All of the display modes have the same structure. The top part of the screen displays an extract of the program source code. The bottom part displays the information specifically available in that display mode. There are also pushbuttons on the screen allowing you to switch to the most frequently-used display modes.

ABAP Training

Page 2 of 19

Display Modes Available Using Pushbuttons


Fields The scrollable field display contains the contents of up to eight fields. The contents of the three most important system fields are always displayed. This is the default display mode in the Debugger. See also Processing Fields Displays the contents of an internal table. This mode allows you to display and edit the entries in an internal table. See also Processing Internal Tables A scrollable display containing up to 30 breakpoints. Next to each breakpoint is a counter. You can also delete breakpoints in this display. See also Managing Dynamic Breakpoints You can set a watchpoint for a field so that the program is interrupted whenever the value of that field changes. This display mode contains a list of watchpoints, the fields and programs to which they are assigned, the current values of the fields, and the conditions upon which the watchpoint is activated. See also Setting Watchpoints This mode displays the current sequence of events, and the sequence of calls up to the current breakpoint. The last active call is displayed at the top of the list; previous calls are listed in reverse chronological order. When an event (for example, START-OF-SELECTION) concludes, it is deleted from the display. This mode displays the structure of the program. It lists its events, subroutines, and modules, and shows which sections belong to which events. It also displays the section currently being processed. This mode displays the current Debugger settings. You can change the settings by selecting or deselecting various options. For further information, refer to Settings and Warnings

Table Breakpoints

Watchpoints

Calls

Overview

Settings

Other Display Modes


You can access other display modes by choosing Goto Display data object. Single field Displays the contents and technical attributes of a field. Structured field Strings Internal table Object Displays the components of a structure, along with their contents and attributes. If you double-click a component, the system displays detailed information for it. Display the content and current length of the string. You can also display part of the content by means of offset and length. Displays the type, line numbers and contents of an internal table. Displays the structure of an ABAP Object.

For further information on these displays, refer to Displaying Attributes and Displaying ABAP Objects

ABAP Training

Page 3 of 19

Breakpoints
Instead of starting an ABAP program directly in the Debugger, you can also debug a program by creating one or more breakpoints in the program. A breakpoint is a signal at a particular point in the program that tells the ABAP runtime processor to interrupt processing and start the Debugger. The program runs normally until the breakpoint is reached. There is also a special kind of breakpoint called a watchpoint. When you use watchpoints, the Debugger is not activated until the contents of a particular field change. For further information, refer to Watchpoints.

Breakpoint Variants
The Debugger contains different breakpoint variants: Static The BREAK-POINT statement in an ABAP program. Static breakpoints are not normally user-specific. However, you can make them user-specific. Directly-set dynamic breakpoints Breakpoint at statement Breakpoint at subroutine Breakpoint at function module Breakpoint at method Breakpoints at system exceptions Can be set in the ABAP Editor or the Debugger. Dynamic breakpoints are always user-specific, and are deleted when you log off from the R/3 System. The Debugger stops the program directly before the specified statement is executed. The Debugger stops the program directly before the specified subroutine is called. The Debugger stops the program directly before the specified function module is called. The Debugger stops the program directly before the specified method is called. The Debugger stops the program directly after a system exception, that is, after a runtime error has been intercepted.

Use
Static Breakpoints
Static breakpoints are not normally user-specific. Once a user has inserted a BREAK-POINT statement in an ABAP program, the system always interrupts the program at that point. You should only use static breakpoints during the development phase of an application. You should set static breakpoints whenever more than one programmer is working on the same program and you always want to stop the program in the same place.

Dynamic Breakpoints
Dynamic breakpoints are user-specific. You should, therefore, use them when you only want the program to be interrupted when you run it yourself. All dynamic breakpoints are deleted when you log off from the R/3 System. Dynamic breakpoints are more flexible than static breakpoints, because you can deactivate or delete them at 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 (for example, only activate the breakpoint after it has been reached five times).

Special Dynamic Breakpoints


Special dynamic breakpoints are useful when you want to interrupt a program directly before a particular ABAP statement, a subroutine, or an event, but do not know exactly where to find it in the program code. Event here is used to refer to the occurrence of a particular statement, for example, or calling up a method. Special dynamic breakpoints are user-specific. You can only set them in the Debugger.

ABAP Training

Page 4 of 19

Transferring Breakpoints to HTTP and Update Sessions


If an HTTP or update session is called from a Logical Unit of Work (LUW), new work processes are started for these new sessions. Breakpoints that were defined beforehand in the calling LUW are copied to these sessions where they can be displayed under breakpoints. If, for example, the update module func is called via CALL FUNCTION func IN UPDATE TASK , the new work process is displayed in a second window if Update debugging was selected under Settings in the debugging mode. All the breakpoints that were set in the calling LUW can then be processed here.

Static Breakpoints
You should only use static breakpoints during the development phase of an application. You must remove them from your program before you transport it.

Setting Breakpoints
To set a static breakpoint, use the ABAP statement BREAK-POINT . Place the breakpoint in the line at which you want to interrupt the program. program RSDEBUG_01. .... if SY-SUBRC <> 0. break-point. endif. .... When you run the program, the runtime processor interrupts it when the breakpoints occur. You can number your breakpoints to make them easier to identify ( BREAK-POINT 1, BREAKPOINT 2 ). Static breakpoints are not normally user-specific. The program is, therefore, always interrupted as soon as the runtime processor reaches the line containing the breakpoint. The program is interrupted regardless of the user who executes it. However, you can set user-specific static breakpoints using the BREAK statement followed by your user name. For example, if you use the statement BREAK SMITH , the program is only interrupted when user Smith runs it. Although user-specific breakpoints appear in the program code, they are not active when other users run the program. You should, however, be careful if an application is being used by several users with the same name.

Deleting Breakpoints
Since static breakpoints apply to all users, you must remove them from the program once you have finished testing it. In the ABAP Editor, you can find breakpoints quickly by choosing Utilities Global search. You can also use the Extended Program Check to find them. If you do not remove static breakpoints from your program, they will be transported to your production system. This could cause serious problems in the production system.

Dynamic Breakpoints
You can set up to 30 dynamic breakpoints without changing the program code. Dynamic breakpoints can be set either in the ABAP Editor or directly in the Debugger.

Setting Dynamic Breakpoints in the ABAP Editor


You can set dynamic breakpoints in the ABAP Editor regardless of whether you are in display or change mode. You can also set breakpoints directly from within the Debugger at runtime. To set a dynamic breakpoint in the ABAP Editor: 1. Position the cursor on the line of the source code at which you want to set the breakpoint. 2. 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 Dynamic Breakpoints in Debugging Mode


To set a dynamic breakpoint in the Debugger:

ABAP Training

Page 5 of 19

1. Position the cursor on the line in which you want to set the breakpoint. 2. Select the line by double-clicking it or choosing Breakpoint Set/delete. The system sets the breakpoint, and displays a small stop sign to the left of the relevant line. If the line already contained a breakpoint, it is deleted. When you finish your debugging session, the breakpoint is automatically deleted unless you have explicitly saved it.

Breakpoints at Statements
You can use this special kind of dynamic breakpoint to interrupt a program directly before an ABAP statement is processed.

Prerequisites
You must already be running the program in the Debugger.

Procedure
To set a breakpoint at an ABAP statement:

1.
2.

Choose Breakpoint Breakpoint at Statement...

Enter the ABAP statement. The system sets a breakpoint at all points in the program at which the ABAP statement occurs. 3. Choose ENTER. The breakpoint applies to all lines containing the specified statement.

Result
The system confirms the breakpoint and adds it to the list in the display. When you finish your debugging session, the breakpoint is automatically deleted unless you have explicitly saved it.

Breakpoints at Subroutines
You can use this special kind of dynamic breakpoint to interrupt a program directly before a subroutine is called.

Prerequisites
You must already be running the program in the Debugger.

Procedure
To set a breakpoint for a subroutine: 1. Choose Breakpoint Breakpoint at Event/Subroutine. 2. Enter the name of the subroutine before which you want to interrupt the program. By default, the Program field contains the name of the program that is currently active. The system sets a breakpoint wherever the specified subroutine occurs in the program code. 3. Choose ENTER.

Result
The system confirms the breakpoint. The breakpoint is added to the breakpoints displayed.

Breakpoints at Function Module


You can use this kind of dynamic breakpoint to interrupt a program directly before a function module is called.

Prerequisites
You must already be running the program in the Debugger.

Procedure
1. Choose Breakpoint Breakpoint at Function module...
2. Enter the name of the function module before which you want to interrupt the program. The system sets a breakpoint wherever the specified event, module pool, or subroutine occurs in the program code. 3. Choose ENTER. To set a breakpoint for a function module:

ABAP Training

Page 6 of 19

Result
If you entered a valid function module name, the system confirms that the breakpoint has been set. If the function module exists in the system, the new breakpoint is added to the display list.

Breakpoints at System Exceptions


You can use this special form of dynamic breakpoint to interrupt a program immediately after a runtime error has occurred.

Prerequisites
You must already be running the program in the Debugger.

Procedure
To set a breakpoint at a system exception: Choose Breakpoint Breakpoint at System exception.

Result
The system confirms the breakpoint. The breakpoint is added to the breakpoints displayed. 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.

Saving Breakpoints
If you want to leave the Debugger temporarily, you can save your dynamic breakpoints so that they are still active when you return to the Debugger within the same terminal session. To save the breakpoints that you have set in the Debugger: Choose Breakpoint Save. The system saves all of the breakpoints that you have set in the current program. These breakpoints will remain active until you either explicitly delete them or log off from the system.

You can also delete breakpoints that you have saved: By deleting individual breakpoints from the display and then saving again. In this case, only your selected breakpoints will be deleted.

By choosing Breakpoint Delete all. In this case, the system deletes all dynamic breakpoints.

Managing Dynamic Breakpoints


The ABAP Debugger provides a convenient user interface for managing breakpoints. To open the breakpoint display, choose Breakpoints, or, from the menu, Goto Control debugging Breakpoints.

Functions
This display mode contains the following functions for breakpoints:

Breakpoint Display
The scrollable breakpoint display contains up to 30 dynamic breakpoints. For breakpoints that you set directly, the program name and line number at which the breakpoint occurs are displayed. For special breakpoint forms, the list displays the statements, events, subroutines, and module calls at which the relevant breakpoints are set.

Counter
In the breakpoint display, you can specify a counter. When you use a counter, the breakpoint is not activated until it has been reached a specified number of times. For example, if you enter 5 for the counter, the breakpoint is not activated until it is reached for the fifth time. After the breakpoint has been activated, it remains so, and the counter no longer appears in the breakpoint display.

Deleting Breakpoints
Position the cursor on the breakpoint that you want to delete, and either double-click the line or choose Breakpoint Set/delete. To delete all breakpoints, choose Breakpoint Delete all.

ABAP Training

Page 7 of 19

Activating and Deactivating Breakpoints Position the cursor on the breakpoint that you want to activate or deactivate and choose Breakpoint Activate/deactivate.

ABAP Training

Page 8 of 19

Watchpoints
Like a breakpoint, 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.

Use
You set watchpoints in the Debugger to monitor the contents of specific fields. They inform you when the value of a field changes. When the value changes, the Debugger interrupts the program.

Features
You can set up to five watchpoints in a program. You can also specify the conditions on which a watchpoint is to become active. You can specify logical conditions between up to five conditional watchpoints. You can define watchpoints as either local or global. If you define a global watchpoint, it is active in all called programs. Local watchpoints are only active in the specified program. You can change and delete watchpoints.

Setting Watchpoints
If you want to interrupt a program when the contents of a field or structure change, use a watchpoint. You can set up to five watchpoints, including watchpoints for strings. 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.

Procedure
To set a watchpoint, start the Debugger and proceed as follows:

1.
2. 3.

Choose Breakpoint Create watchpoint or the corresponding pushbutton. The Create Watchpoint dialog box appears.

Decide whether you want to set a local or global watchpoint. Enter the program and the name of the field for which you want to set the watchpoint. In the Program field, the name of the program currently running is always defaulted. 4. If you want your watchpoint to be activated each time the contents of the field change, the definition is now complete, and you can return to the Debugger by pressing ENTER . 5. To create a conditional watchpoint, that is only activated when a particular situation arises, choose one of the following relational operators. Operator Meaning < <= = <> >= > 6. 7. Less than Less than or equal Equal Not equal Greater than or equal Greater than

You can use the Comparison field option to specify whether the comparison is to be carried out with a value that you specify or with the contents of another field. Depending on your choice from step 6, enter a value or a field for the comparison.

Result
The system confirms the watchpoint and adds it to the list in the display. When you finish your debugging session, the watchpoint is automatically deleted unless you have explicitly saved it.

ABAP Training

Page 9 of 19

Specifying Logical Links


If you have more than one conditional watchpoint, you can specify a logical link between them: OR Only one of the specified conditions must be met AND All of the conditions must be met.

To create a logical link between watchpoints: Choose Goto Control debugging Watchpoints or the Watchpoints pushbutton to open the watchpoint display. 2. Set the Logical operator between watchpoints option. The default value is always OR . 1.

Changing Watchpoints
1.
2. 3. 3.

Choose Goto Control debugging Watchpoints or the Watchpoints pushbutton to display the watchpoint list.
Choose the pencil icon in the line containing the watchpoint you want to change. Change the watchpoint attributes in the Create/Change Watchpoint. Choose ENTER .

Deleting Watchpoints
You cannot delete watchpoints by choosing Breakpoint Delete or Breakpoint Deactivate/activate. Instead, proceed as follows: 1. Choose Goto Control debugging Watchpoints or the Watchpoints pushbutton to display the watchpoint list. 2. Choose the trashcan icon in the line containing the watchpoint you want to delete.

Memory Monitoring with Watchpoints


You can use watchpoints to display changes to the references of strings, data and object references, and internal tables. By placing an ampersand (&) in front of the object name, you can display the reference in question in hexadecimal format. With internal tables, you can also display the table header by placing an asterisk (*) at the beginning of the name. &objectname Displays the references of strings, internal tables as well as data and object references Displays the table header of the internal table itab

*itab

Analyzing Source Code


The Debugger contains an extensive range of functions that help you to analyze the source code of a program. You can step through the source code of a program in four different ways.

Displaying the Source Code


All of the display modes in the Debugger have the same structure. The top half of the screen displays an extract from the program source code as it appears in the ABAP Editor.

Features
The Source code of field contains an extract from the program, subroutine, or function module currently being processed. The source code display also contains the following additional functions:

Expand/Reduce Program Segment


Use this button to close the information about the current display mode. The system then displays more of the source code. Use this button to reopen the information for the current display mode.

ABAP Training

Page 10 of 19

Entering Line Numbers


You can scroll in the source code using the arrow keys. If you enter a line number in the left-hand field, that line will become the top line of the display.

Scrolling by Double-Clicking
If you double-click the first column of a line, it becomes the top line of the display.

Scrolling one Screen at a Time


You can use the PgUp and PgDn keys to scroll up and down one page at a time in the source code.

Navigating Forwards and Backwards


If you choose Debugging Goto Statement, the line containing the cursor is displayed. This provides you with a straightforward way of navigating forwards and backwards in the displayed source code.

Displaying the Current Line


This arrow indicates the next line of source code that will be processed. Use this button to make the current line appear in the source code display.

Display After a 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.

Finding a String in the Source Code


To find a string in the source code, choose Edit Find in source code or the Find icon from the standard toolbar. A dialog box appears in which you can enter a string: To find the next occurrence of the same string, choose Edit Find next in source code, or the appropriate icon.

Stepping Through the Source Code


There are four different ways in which you can step through the source code of a program you want to analyze:

Execution Types in Debugging Mode


Single step Execute Use this option to step through the program statement by statement. This allows you to branch to other programs. 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. The Debugger returns to the point at which control returns to the main program. Use this option to return from other programs. 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.

Return Continue

Processing Fields Displaying Field Values at Runtime


You can use the Fields display mode in the Debugger to display the contents of program fields. The display can accommodate up to eight fields. This is the default display mode in the Debugger. The following data objects are supported: Single fields Structured fields

ABAP Training

Page 11 of 19

Strings Internal tables Objects With more complex data objects such as references or tables, the contents are not displayed directly in the default display mode. Instead, you have to double-click the field display to call up the appropriate attribute display.

Procedure
1. 2. From any display mode in the Debugger, choose Fields. Enter a field name directly in one of the fields in the display, or select a field by doubleclicking its name in the source code display. When you select a field from the source code display, the system automatically enters it in the field display. 3. Step through the program using one of the execution types.

Displaying Further Fields


The field display can contain up to eight fields, of which only four can be displayed at a time. You can display the other fields by using the scroll buttons.

Displaying System Fields


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

Displaying Fields from External Programs


You can also display the contents of fields from external programs if you know the names of these. To do so, enter the program name in parentheses before the field name: fieldname(programname).

Special Types of Field Display


As in the program source code, you can make offset and length entries for character-type fields. If, for example, you enter sy-datum+4(2 ) in the field display, the current month of the system date is displayed under Field contents. If you specify an integer in angle brackets after the name of an internal table, the content of the line that corresponds to the integer is output. The entry itab[4] , for example, displays the fourth line of the internal table itab . If the integer exceeds the number of current table lines, the table will be flagged as unknown. With data references, the content of the referenced data object is displayed if an arrow and asterisk are appended to the name of the reference. r->* displays the content of the field that is referenced by the data reference r . If you double-click a data or object reference under Field contents in the default display mode, all the attributes and field contents of the referenced data object are displayed in the next screen (data references). The attributes and values of the current instance of all referenced classes and interfaces are output under object references. 7<cl> , for example, displays all the values of the seventh instance from class cl . The headers of strings, internal tables as well as data and object references are displayed if you place an asterisk at the beginning of the name. For example, the header of the internal table itab is displayed in hexadecimal format if you enter *itab in the field display. The field contains zeros if a table does not have a header. If you place an ampersand at the beginning of the name, the reference of strings, internal tables as well as data and object references are displayed in hexadecimal format. The entry &s tr, for example, displays the reference to the string str .

Changing the Display Format


You can display the field contents either formatted for their data type or in hexadecimal format. Use this button to display the field contents in hexadecimal format. Use this button to display the field contents in their original output format.

Deleting All Field Names

ABAP Training

Page 12 of 19

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

Changing Field Values at Runtime


You can change the values of fields at runtime to see how the change would affect the program flow. Suppose you have found out that a field contains an incorrect value. You would be able to replace it with another value in the Debugger to test whether the program would run properly in that case. You can change the values of the following data objects of your program. If you enter a value with an incompatible type, the system displays an error message. Single fields Structured fields Strings Fields of internal tables Fields of classes and interfaces

Procedure
To replace the contents of a single field, proceed as follows: Choose Fields to open the field display mode. Double-click or enter the name of a field in the source code to place it in the field display. The field name and its current value appear in the display. 3. Enter a new value for the field. 4. Choose the pencil icon (Change field contents) at the end of the field display. 1. 2.

With certain data objects such as structures or internal tables, you first have to double-click the appropriate field name to display the attributes. You then have to double-click the individual fields again to open the display mode.

Result
The Debugger writes the new value to the program field and the system records the change in the system log. If you do not click the pencil icon, the changed value is ignored.

The Debugger accepts the values exactly as you entered them. You must, therefore, ensure that you use the correct format (upper and lowercase, left-justified entry for hexadecimal numbers).

Processing Internal Tables


Displaying Internal Tables
You can display and change the contents of internal tables (including nested tables) at runtime in the Debugger. The Debugger also provides information about the table type, table key, and the amount of memory it requires.

Procedure
1. 2. Choose Table from any display mode in the Debugger. The table display appears. Enter the name of an internal table in the Internal table field, or select a table by doubleclicking its name in the source code. 3. Choose ENTER . 4. Step through the program using one of the execution types.

Header Line
If the internal table has a header line, it is indicated by this icon. If you double-click the icon, the system opens the Structured field display. This contains the names of the components, their current values, and the technical data of the table.

Scrolling Vertically

ABAP Training

Page 13 of 19

The table lines are numbered. The first column of the header is an input field in which you can enter the number of the line you want to appear at the top of the display. You can also scroll using the scroll icons in the standard toolbar.

Scrolling Horizontally
You can use the scroll buttons to scroll through the table horizontally. If the table is too wide for all of it to be displayed, use the scroll keys, or move the column headers.

Moving Column Headers


You can change the order in which fields are displayed in the internal table display. To do so, overwrite the text in the field name list with the field names in the order in which you want them to appear. To remove a field from the display, delete its field name from the header. If you enter the name incorrectly, the system displays a sequence of question marks. If there is not enough room to display the entire field, the system shortens the field and displays the "<" character to inform you.

Shifting a Column to the Left


If you double-click a column heading, the table display shifts to the left. None of the columns to the left of the selected column heading are then visible. However, you can restore them to the display by scrolling horizontally.

Specifying a Table Type


Next to the table name, the Type field contains the table type. This may be standard, hashed, or sorted.

Changing the Display Format


As with the field display, you can change the display format in the internal table display mode. The Format field usually contains the value E (for display in columns with relevant formatting). However, it can also take the value X (hexadecimal display), or C (character display).

Resizing the Table Extract


Click this button to increase the size of the table extract that is displayed. Three lines of ABAP source code are displayed, and the rest of the screen is used to display lines of the internal table. Click this button to reduce the table display to five lines. The rest of the screen is used to display the ABAP program code.

Displaying Memory Use


To find out how much memory the internal table occupies, choose Goto Display condition Memory usage.

Changing Internal Tables


You can change the contents of internal tables in the Debugger at runtime. You can delete, edit, or add table lines.

Deleting Lines
1. 2. 3. 4. 5. To delete a line from an internal table: Open the internal table display mode. In the Internal table field, enter the name of the table. Choose ENTER . The system displays the contents of the table. Position the cursor on the line that you want to delete. Choose Delete. The line is removed from the table, and the system automatically corrects the line numbering.

Changing Lines
The Change, Insert, and Append functions are field-specific, and can only be used for a single field at a time. Suppose you want to edit the following line: LH001 FRANKFURT NEW YORK 145400 400 X First, you have to decide which field you want to edit. Then: Position the cursor on the relevant field in the line that you want to edit. Choose Change. The field appears in input mode. Enter a new value for the field. Choose ENTER . The system updates the line and displays the changed contents in the table.

1. 2. 3. 4.

ABAP Training

Page 14 of 19

Inserting Lines
The Insert and Append functions allow you to add a new line to an internal table. If you choose Append, the new line is added to the end of the table. If you choose Insert, you can add the new line at any position in the table. To insert a new line at the end of the table: Choose Append. Enter a value for the first field of the line. Choose ENTER . The system adds a new line to the end of the table, containing the value that you entered for the first field. Enter values in the remaining fields as described above. If you want to add a line in the middle of the internal table, place the cursor on the line after which you want to insert it. Choose Insert, then follow the procedure described above from step 2.

1. 2. 3. 4.

Attributes of Data Objects


In the Debugger, you can display the attributes and contents of data objects in a separate area of the screen. This technical information is available for the following data objects: Single fields Structured fields Strings Internal tables Data references

Objects

Procedure
To open the display: 1. Choose Goto Display data object { Single field | Structured field | String | Internal table | Object }. 2. Enter the name of the data object and choose Enter , or double-click the data object in the source code. 3. The following information is then displayed depending on the data object you selected: Single field Struc. field String Internal table Object Name, field contents, type, length, output length, decimal places Name, length, number, component name, type, length, contents Name, type, current length, content Name, type, format, line number, line contents Name, class/interface, number, attributes/interfaces, type, length, contents

If you want to display more information in the attribute overview on particular fields of a structure, table or class, open the detail display by double-clicking the appropriate field. Choose Back to return to the overview. If you enter the name of a single field in the attribute display for a structured field, the system switches automatically to the single field display. Likewise, if you enter the name of a structured field in the attribute display for a single field, the system will switch to the structured field display.

Displaying Data References


If you double-click a data reference dref in the Field names column, information on the technical attributes of this are displayed. If you double-click the Field contents column, the contents of the data reference are displayed. The referenced object is displayed when you double-click the data reference dref->* in the Field names column.

Displaying the Unicode Fragment View

The Unicode fragment view is displayed when you choose Goto Display data object System Information. In this view, structures, internal tables, strings, data references, and objects are split

ABAP Training

Page 15 of 19

into alignment gaps, byte and character-type areas, and all other types such as P, I, F, strings, references and internal tables. Adjacent character-type components of a structure (with the exception of strings) are combined internally to form exactly one group if there are no alignment gaps between these components. All possible alignment requirements for characters are taken into account here. Adjacent bytetype components are also combined in the same way.

Other Functions
The Single field display mode, like the Fields mode, can be used to change the contents of a field or display them in hexadecimal format. In the Structured field display mode, you can show and hide substructures. For further special types of display, refer to Processing Fields.

Displaying Objects in ABAP Objects


The Debugger displays the attributes of classes, instances, and interfaces in a similar way to structured fields.

Procedure
To display an object in ABAP Objects: Choose Fields. This opens the default display mode. In the ABAP program code display, double-click the name of an object to place it in the field display. The Field contents field contains the object ID (class name and identification number). 3. Double-click the object ID. The Debugger opens the Object display mode. You can also open the object display by choosing Goto Display data object Object. However, in this case, you must specify the object ID explicitly. 4. Adjust the display to your requirements by setting the Class attributes and instance attributes options and selecting a visibility section (public, protected, or private). 5. Choose Filter to filter the attributes for the display. The object attributes are listed with their names, technical properties (data type and length), and their content. The display also contains the interfaces. You can display its attributes by choosing Expand. If an attribute is a reference to another object, you can display the attributes of the referenced object by double-clicking the field contents of the object in the display. If you enter the name of a class (<name>) in the Object (Id) field, the system displays the static attributes of the class, regardless of whether it has been instantiated. 1. 2.

Other Functions
Navigation
If you double-click the name of an attribute, the system opens the single field display. If you double-click the name of an interface, the system displays only the attributes that belong to that interface.

References
If you position the cursor on a field in the field display that contains an object reference, you can find all variables or attributes (both local and global) that point to the object by choosing Goto System Find references. The same applies to data references.

Displaying Events
The event display provides an overview of all of the events belonging to an object and the handlers that are registered for them. To open the event display, choose Events. The system lists all of the events belonging to the object specified under Object (Id). The display lists the object IDs of all handler objects registered for the event and the handler methods that will be called when the event is triggered. Use the Object pushbutton to return to the ABAP Objects display.

If you enter a class in the Object (Id) field (<name>) and then choose Events, the system displays the handler methods and objects for all events of the class. The class does not have to have been instantiated.

ABAP Training

Page 16 of 19

Other Functions Displaying Lists


If you are testing a program that generates a list, you can display the list in the Debugger. As soon as the list has been created, the system displays this icon. Click it to open the list display. The display contains all lines of the list that have been generated so far with the appropriate formatting. The current list line is not formatted until it is complete (NEW-LINE).

Call Links
From the Debugger, you can open the ABAP Editor, the Object Navigator, and the Screen Painter. If you find an error in a program while you are testing it, this function allows you to switch directly to the ABAP Editor or Object Navigator to correct it straight away in the source code.

To open the ABAP Editor, choose Development ABAP Editor. The system opens a new session and displays the program you were debugging.
To open the Object Navigator from the ABAP Workbench, choose Development Object Navigator. The system opens a new session and starts the Object Navigator. To display the flow logic of a screen, choose Development Screen Painter. This function is only active in programs for which you have defined screen flow logic.

Debugging in Production Clients


Since the contents of the database in a production client must always be consistent, there are particularly strict requirements for debugging in them: Production clients do not have the value "T" in the CCCATEGORIE field of table T000. This is why the system must not execute a COMMIT WORK . What is particularly important is that all database changes can be rolled back in the event of a program termination. To ensure that this is possible, a dialog process converts to a debugging process. This process is assigned to the user for the duration of their debugging session. This is why no COMMIT WORK is executed by the system.

To ensure that debugging activities cannot block the whole system, only half of all dialog processes can be used for debugging.
Since only a restricted number of dialog work processes can switch to debugging mode, you should exit the Debugger as soon as you no longer need it. Otherwise, you will unnecessarily block the work process. In test clients, where data integrity is not so crucial, the number of dialog processes that are available for debugging is defined via the profile parameter rdisp/wpdbug_max_no. If another users want to debug the database, and the process cannot, therefore, convert to a debugging process, a COMMIT WORK must be executed after each step, and the process is released again for all other users. The database changes cannot, therefore, be rolled back if a program termination occurs.

Releasing Database Locks


During Debugging, the COMMIT statement, which indicates the end of a Logical Unit of Work (LUW), may occur after a significant number of debugging steps. Any database locks that are set are maintained for the whole of this time. There may be occasions when you want to interrupt your testing without actually ending the debugging session. In this case, you should release the database locks, otherwise other users will not be able to make changes until your debugging session is finished. To do this, choose Debugging Database Commit (unlock) to unlock the database and permanently write the changes to the database. Remember that this could, in certain circumstances, lead to database inconsistencies. If you want to undo all of the database changes that have been made since the last commit, choose Debugging Database Rollback.

ABAP Training

Page 17 of 19

You can check the last statements transferred to the database by choosing Goto System System areas after you have started the Debugger, and entering OSQL in the Area field.

Settings and Warnings


From the Debugger, you can set the debugging mode and the system behavior in the event of a kernel warning by choosing Settings.

System Debugging
If you set this option, the Debugger is also activated for system programs (programs with status S in their program attributes). When you save breakpoints, the System debugging setting is also saved.

Update Debugging
Update function modules are not processed in the same task as the program that is currently running in the Debugger. Instead, they run in an update work process. These function modules are therefore not included in debugging. Only if you select the Update debugging option can you display and debug them after the COMMIT WORK.

In Background Task: Do not Process


When you debug a program that calls function modules using the IN BACKGROUND TASK addition, they are processed in a background work process (additional internal session). If you set the In background task: Do not process option, the system collects the function calls, but does not start the background work process. The Debugger assigns a transaction ID, which identifies the background work process uniquely. You can now start the Debugger for the background work process using transaction SM58. You can select the function module concerned here, and then execute it via the Edit menu.

Automation Controller
This Debugger option controls the way in which requests to automation objects (Automation Server and GUI controls) are processed. 1. If the option is not set, the requests are processed as they would normally be in the ABAP program. Requests with the NO FLUSH addition are not processed until An explicit flush occurs A request is processed that does not have the NO FLUSH addition. 2. If you select this option, all requests are processed synchronously, regardless of any NO FLUSH additions. This helps you to find errors. If an error occurs when the automation queue is being processed, the synchronous request processing option allows you to identify the request in which the error occurred. Enabling this option dramatically affects the runtime of the program, since the ABAP program cannot continue processing until the request has been executed by the receiver. You must bear in mind that the receiver the automation server or control on the presentation server may be linked using a slow WAN connection.

Creating Exception Objects


The following functions are supported for class-based exceptions: If the INTO ref addition is missing in the CATCH statement, you can create an exception object in the Debugger by choosing Settings. 2. When you choose Display the Exception Object, the attributes and interfaces of the exception class are displayed together with their contents. When you choose Statement that Cause the Exception, the line of the source code containing the statement that caused the exception is displayed. The statement is marked explicitly in the source code. 1.

Memory Monitoring
After each ABAP statement, the system examines the roll area of the current session. This allows you to check whether neighboring memory areas have been overwritten.

ABAP Training

Page 18 of 19

You can also display the memory usage for objects, tables, references and single fields by choosing Settings Memory Display On/Off. A distinction is made here between allocated and referenced memory. The memory actually used for each data object is also indicated. You can display a hit list of the 25 data objects with the highest memory consumption by choosing Goto System System areas. You can enter the following values in the Area field: Hit list Area ITAB-TOP25 OBJ-TOP25 REF-TOP25 ALL-TOP25 Displays max. 25 internal tables Displays max. 25 objects Displays max. 25 references Displays the 25 data objects with the highest memory consumption

Runtime Warnings
The profile parameter abap/warnings controls the behavior of the R/3 System when a kernel warning occurs. You can display and change it using Transaction RZ11. The Debugger also allows you to override the default setting of this parameter during your debugging session by choosing one of the following three options: Log warnings: Any warnings that occur are recorded and listed in the Debugger under Settings. Stop at warning: The system stops processing in the line of the program in which the warning occurred. Dump at warning: The system triggers a short dump when a warning occurs.

You can display the last runtime error that occurred by choosing Development Display last short dump. You can also use the transaction last_shortdump.

ABAP Training

Page 19 of 19

Anda mungkin juga menyukai