An Overview of ABAP Debugger Settings and System Areas
For site licenses and volume subscriptions, call 1-781-751-8799. 1
The ABAP Debugger contains a wealth of settings and information about your ABAP environment that can be extremely helpful to you during troubleshooting. Here, you will learn what the debugger settings do and when you can use them, as well as how to find specialized internal system information in the debuggers system areas. An O ve rvie w o f AB AP D e b u g g e r S e ttin g s a n d S yste m Are a s A u th ro The ABAP Debugger Settings Select Settings !Display and change all in the debugger menu to view the debugger settings (see Figure 1). As shown in Figure 2, the scope of these settings Figure 1 The Debugger Settings Setting Scope Can You Save It? System debugging External session Yes Always Create Exception Object External session Yes Check Sorting Before READ BINARY SEARCH Check Sorting Before PROVIDE Internal session No Automation Controller: Always process requests synchronously Internal session No In background task: Do not process Internal session No Update debugging External session No Memory monitoring External session No Figure 2 The Scope of the Debugger Settings SAP Professional J ournal J uly/August 2004 2 www.SAPpro.com 2004 SAP Professional J ournal. Reproduction prohibited. All rights reserved. is quite different. Some settings are available in the current external session (window), while others are only active in the current internal session and are lost when you enter a new internal session. You can save some settings along with current breakpoints by click- ing on the save button ( ) in the application toolbar of the debugger. This action makes these settings active for all external sessions of your current logon. Figure 3 provides an overview of when to use these settings in your daily troubleshooting sessions. The ABAP Debugger System Areas The ABAP Debugger provides a wide range of infor- mation about the ABAP environment of the program in general. But you can find specialized internal information hidden in the system areas of the debug- ger. Although most of this information is only rele- vant for ABAP kernel developers at SAP, some of these areas can be extremely helpful for your ABAP troubleshooting sessions. Figure 3 When to Use the Debugger Settings Setting Description System debugging In the program attributes (the radio buttons in the ABAP Editor, transaction SE38), you can designate a program as a system program. The debugger then skips the program if system debugging is turned off. If you have problems that involve system programs (such as a function that cant be accessed in the debugger), turn on this setting. You can also turn on system debugging by entering /hs in the command field in the debugger. Always Create Exception Object If you catch an ABAP exception in your program via the ABAP statement CATCH CX_MY_EXCEPTION without specifying a reference variable to which the exception object can be moved, you normally cant see or analyze the exception object in the debugger. If you turn on this setting, a Display Exception Obj. magnifier button ( ) appears next to the exception name (as shown in the screenshot below) for examining the created exception object: (continued on next page) An Overview of ABAP Debugger Settings and System Areas For site licenses and volume subscriptions, call 1-781-751-8799. 3 Setting Description Check Sorting Before READ BINARY SEARCH The sort order for an internal table must match the keys used in a READ BINARY SEARCH statement. (See the ABAP keyword documentation for READ.) If the sort order is incorrect, because the table was either never sorted or sorted with the wrong sort key fields, the results of the READ BINARY SEARCH statement will be unpredictable. Maybe youll get lucky and the entry will be found by chance. However, the entry will probably not be found even if it actually exists, which can result in nasty troubleshooting scenarios. In addition, if you suspect that the table is not sorted correctly because the READ fails despite the fact that the entry exists, it is difficult to prove by analyzing the possibly thousands of lines in the table. When you turn on this setting (introduced in SAP Web AS 6.10), the system checks the sort order of each internal table before executing the READ BINARY SEARCH statement. If the sort order is incorrect, you get a runtime error ITAB_ILLEGAL_ORDER that identifies the incorrect lines. For example, the dump ITAB_ILLEGAL_ORDER contains the following error message: In the case at hand, the rows 2 and 3 of the table "\PROGRAM=ZBGTEST\DATA=ITAB" weren't sorted according to the key specified in the READ statement. Check Sorting Before PROVIDE Similar to the Check Sorting Before READ BINARY SEARCH setting, except for the PROVIDE statement. The sort order of the internal tables is also critical. Automation Controller: Always process requests synchronously This setting applies to the SAP Control Framework, which is the ABAP interface for GUI controls such as the Tree Control, the ALV Grid Control, and the HTML Control. For performance reasons, the events and requests for these controls are normally queued and flushed together (asynchronously), rather than passed directly to the GUI frontend. Therefore, it is difficult to determine which queued request is responsible for a specific control error. Turn on this setting to flush all control requests of a running transaction immediately and show the resulting error. This setting influences only the internal session that you are debugging. Because of the synchronized communication between the backend and the GUI, the application performance degrades accordingly. In background task: Do not process Sometimes you need to analyze transactional Remote Function Calls (tRFCs) that are called with the IN BACKGROUND TASK addition, as follows: CALL FUNCTION '' IN BACKGROUND TASK BACKGROUND TASK function calls are registered, but not processed directly, at the CALL FUNCTION statement. During the next COMMIT WORK statement, these registered functions are called along with the other tRFC functions for this logical unit of work (LUW) on the specified destination. The debugger cant follow these RFC calls after the COMMIT WORK, because the debugger is attached to one process. The only way to debug these function modules is to turn on this setting. When you turn on this setting, these tRFC modules are stored in the system for debugging instead of being sent. Use the tRFC Monitor (transaction SM58) to analyze the unprocessed LUWs and select Edit !Debug LUWto debug them. Figure 3 (continued) (continued on next page) SAP Professional J ournal J uly/August 2004 4 www.SAPpro.com 2004 SAP Professional J ournal. Reproduction prohibited. All rights reserved. Setting Description Update debugging If your program includes a SET UPDATE TASK LOCAL statement to turn on synchronous updates, you dont need this setting. However, sometimes you need to analyze asynchronous updates, which are functions that are called with the IN UPDATE TASK addition as follows: CALL FUNCTION '' IN UPDATE TASK These update functions are not called directly. Instead, they are part of an LUW that is executed after the next COMMIT WORK statement. (See the ABAP keyword documentation for IN UPDATE TASK.) This LUW is executed asynchronously in a special update work process, perhaps even on another server. The debugger cant follow these update modules, because the debugger is attached to one process. If you dont use this setting, you wont see anything for update modules during debugging. The only way to debug these function calls is to turn on this setting. When you turn on this setting, a second debugger window pops up after the COMMIT WORK statement. It displays the RSM13000 program (the central update handler), which launches the update functions sequentially. You can skip the irrelevant internal update code of the RSM13000 program. Set a breakpoint in the update function of interest. Start debugging the application, turn on this setting, and continue debugging until you reach the breakpoint in the update module. Memory monitoring This internal setting is not relevant for ABAP developers. If you turn on this setting, the system checks the memory segments in order to find memory overwrites after each executed statement. SAP uses this setting internally to find potential kernel bugs. Turning on this setting significantly decreases application performance. Figure 4 Displaying the System Areas in the Debugger Figure 3 (continued) An Overview of ABAP Debugger Settings and System Areas For site licenses and volume subscriptions, call 1-781-751-8799. 5 To access the system areas, select Goto !System Areas !Internal Information in the debugger menu. (In SAP R/3 4.6C or earlier, select Goto !System ! System Areas.) The debugger shows a list of the avail- able system areas, as shown in Figure 4. Either double-click on a system area or insert the name in the Area field to see its contents. Figure 5 contains the most interesting system areas and when to use them. Figure 5 Useful Debugger System Areas for ABAP Developers System Area Description SMEM SET/GET a parameter stored in SAP memory. You use the ABAP statement SET PARAMETER to set a parameter. This system area provides the parameter name (such as GUI_IS_ON) and its content. For example: 1 GUI_IS_ON ( 1) <X> 2 GUI_HAS_ACTIVEX ( 1) <X> MEMORIES ABAP memory. To fill ABAP memory from your program, use the following ABAP statement: EXPORT TO MEMORY ID <id>. This system area allows you to view the ABAP memory, find your memory ID, and check the content. This action is helpful in the debugger if, for example, at an IMPORT FROM MEMORY statement you see that the memory ID is no longer available, and you want to find out what freed it. ITAB-TOP25 List of the 25 largest internal tables of all loaded programs (see the screenshot below). This system area is valuable for performing memory analysis on a program. As of SAP Web AS 6.20, use the even more powerful Memory Inspector by selecting Goto !display condition !memory use in the debugger menu. (Watch for an upcoming SAP Professional Journal article on the Memory Inspector.) (continued on next page) SAP Professional J ournal J uly/August 2004 6 www.SAPpro.com 2004 SAP Professional J ournal. Reproduction prohibited. All rights reserved. System Area Description DATASETS List of files you created with an OPEN DATASET statement. SCREEN Available as of SAP Web AS 6.20. Provides the screen structure (the attributes of the screen fields) for the fields of the current screen (see the screenshot below). Figure 5 (continued)