Features
The SQL Trace is especially useful for:
Development
SQL Trace can help JDO, enterprise beans, servlet and JSP developers to learn which kind of database accesses their code produces.
1. Performance analysis
Typically, performance issues are caused by inefficient database accesses. In this case SQL Trace can be used to show the issued SQL statements and their duration, thus helping to identify inefficient SQL statements.
Typically, you should use the SQL Trace when you need to check the behavior of a particular application. This is the following scenario:
...
You launch the SQL Trace application.
You activate the SQL Trace.
You run the application that you want to trace.
You deactivate the SQL Trace.
You set filters optionally.
You evaluate the trace.
You can also evaluate a trace that already exists.
The SQL Trace also provides functions for file administration.
SQL Trace is less suitable for detecting general performance issues. Therefore, we do not recommend that you keep it constantly activated, as it consumes additional resources.
Initial Screen
Calling
You can call the initial screen of the test tool using transaction code ST05 or by choosing Test ® Performance Trace in the ABAP Workbench.
Functions
The following functions are available on the initial screen:
Select trace:
· Select the trace mode SQL Trace, Enqueue Trace, RFC Trace, or Table Buffer Trace. You can select mutliple trace modes simultaneously.
Select trace function:
· Start the trace recording.
· Stop the trace recording.
· Branch to trace list, detailed list, or time-sorted list.
· Branch to Explain SQL to analyze an SQL statement without an explicit trace file.
Trace files are managed by the system. Thus they can be saved, like any other object; saved trace files can be displayed and deleted.
Trace Status
A trace can only be activated once on any application server. The Trace Status display informs you whether another user in the system has already activated a particular trace.
Prerequisites
You can only switch on the Performance Trace for a single instance. You should already have decided the scope and targets of your performance analysis.
Procedure
To analyze a trace file, do the following:
...
1. Choose the menu path Test ® Performance Trace in the ABAP Workbench.
The initial screen of the test tool appears. In the lower part of the screen, the status of the Performance Trace is displayed. This provides you with information as to whether any of the Performance Traces are switched on and the users for which they are enabled. It also tells you which user has switched the trace on.
2. Using the selection buttons provided, set which trace functions you wish to have switched on (SWL trace, enqueue trace, RFC trace, table buffer trace).
3. If you want to switch on the trace under your user name, choose Trace on.
If you want to pass on values for one or several filter criteria, choose Trace with Filter.
Typical filter criteria are: the name of the user, transaction name, process name, and program name.
4. Now run the program to be analyzed.
You will normally analyze the performance trace file immediately. In this case, it is a good idea to use a separate session to start, stop, and analyze the Performance Trace
If you are shown trace kernel errors on the initial screen (for example, not enough storage space available), you must first remove the errors or have them removed by your system administrator.
The selected trace types can be changed as required during a performance trace interval (time between switching on and off the trace). The user (user group) must remain unchanged.
Result
The results of the trace recording are written to a trace file. If trace records are overwritten during the trace interval, the system displays a message to inform you when you analyze the trace file.
The results of the trace recording are stored to ten trace files. Overwriting trace records, however, cannot be entirely excluded in this case either.
The Performance Trace records all database access calls, table buffer calls, remote calls, or calls for user lock activity. These measurements can affect the performance of the application server where the trace is running. To preserve system performance, you should therefore turn off the trace as soon as you finish recording your application.
Prerequisites
You have started the trace and finished running the program that you want to analyze.
For performance reasons, you should switch off the traces as soon as you have finished recording.
Procedure
To deactivate the trace:
...
1. Choose Test ®Performance Trace in the ABAP Workbench.
The initial screen of the test tool appears. It contains a status line displaying the traces that are active, the users for whom they are active, and the user who activated them.
2. Select the trace functions that you want to switch off.
3. Choose Deactivate Trace.
If you started the trace yourself, you can now switch it off immediately. If the performance trace was started by a different user, a confirmation prompt appears before deactivation-
Result
The results of the trace are stored in one or more trace files. You can then analyze the performance data stored in the trace file. See also, Analyzing Performance Data.
Prerequisites
Once you have switched off the performance trace, you can analyze the data The data is analyzed, even repeatedly, until its trace records are overwritten in the trace file. The trace files are managed by the SAP system. You can therefore keep a trace file for editing and delete it later through the menu Performance Trace->Save Trace, Display Saved Trace, and Delete Saved Trace.
Procedure: Overview
Before you start analyzing the trace records, you must first switch off the Performance Trace. (It is also possible to display a trace without switching it off beforehand. In this case, however, the display procedure is also recorded in the trace file, in accordance with the set filter criteria for the trace.
For more information, refer to:
Stopping the Trace Recording.
Before displaying the trace records, you can use a display filter to specify the records to be edited and the information that you want to look at.
For more information, refer to:
Display Filters.
When you display the trace records, you can choose between a basic list and an extended list. Both lists display an overview of the logged actions and performance data. In addition, you can display a trace list sorted by time.
For more information, refer to:
Displaying Lists of Trace Records.
In both lists – the simple trace list and the extended list – you have the same range of functions for analyzing the listed statements and other performance data.
The time-sorted trace lists is only slightly different from the trace lists mentioned above. For more information on the transaction, process type, client, and user, call up the function Display->User, Transaction and so on…… in the Goto menu.
For more information, refer to:
Analyzing Trace Records
Other analysis options depend on the trace types that you are using. See also:
SQL Trace or
Display Filter
Prerequisites
You have switched off the performance trace and have opened the display filter after choosing Display Trace or the corresponding menu entry from the initial screen of the performance trace.
Use
You can use the display filter (Set Restrictions for Displaying Trace) to restrict the number of logged trace records that are displayed on the basic list (Trace List), detailed list, or time-sorted list.
Features
If you do not enter any selections, all of the trace records are selected.
Specifying the Trace Type to Display
The SAP system also initializes this parameter from the system environment. The default trace type is SQL trace. If you start the display filter directly after the recording, the trace type appears as it was last configured.
Specifying the Trace Interval
The system initializes the trace interval from 00:00:00 to the current system time on today’s date. However, if you start the display filter directly after the recording, the trace interval is set from the start time to the end time of the recording.
Note that if you are working on a distributed system, where the clocks on the database server and the application servers are not synchronized, any times determined automatically by the system may be inaccurate, which in turn may mean that not all trace records are displayed.
Enter Further Selections
For further information refer to:
Update Selection Criteria
With this button, your display filter entries are updated. You can also use the ENTER key for this.
Select Operator for Selection Conditions
With this button, you can change the default option and select and operator. To do so, place the cursor on the relevant parameter.
Initialize the Selection Criteria
If you repeat the performance trace during a session, the default filter parameters are set to your last selections. Use the Initialize All Selection Criteria function (right mouse button) to restore the original defaults.
Delete Selected Selection Criterion
Choose this button to reset restrictions for individual parameters (see also Other Selection Options).
See also Displaying Lists of Trace Records.
Other Filters
You can also filter the trace record display using the following parameters:
User
Objects
1. SQL trace: Table name that the SQL statement refers to
2. Enqueue trace: Lock object that the statement refers to
3. RFC trace: Instance on which a function is executed
4. Table buffer trace: Name of the table that the access is limited too
Duration
Operations
5. SQL trace: Database operations
6. Enqueue trace: Operation for the lock object
7. RFC trace: Characteristics of the execution (client/server)
8. Table buffer trace: Name of the buffer operation
The default filters are:
1. For User, the current user
2. For Objects, the display of the system tables is suppressed. Currently, these are the tables D010*, REPOLOAD, REPOSRC, REPOTEXT, DYNPSOURCE, DYNPLOAD, DYNPTXTLD, DDLOG.
The Duration and Operations parameters are not initialized
You can specify a numeric value for the Duration. This is measured in microseconds. For all other parameters, you can enter a pattern or name. In addition to alphanumeric characters, you can also use the wildcard characters ‘*’ and '+’ in patterns.
You can also change the operator in a specification for further filtering. To do this, position the cursor on the relevant parameter and choose Selection Options. A dialog box then appears in which you can specify whether trace records satisfying the condition should be included (green traffic light) or excluded (red traffic light) from the selection.
For the duration, restricting to an interval of 1000 to 5000 seconds may be of use.
Displaying Lists of Trace Records
Prerequisites
You have chosen the Display Trace function and specified the value range for the display in the Display Filter, where you have also displayed the trace liste, detailed list, or time-sorted list.
Lists
The detailed list contains the complete trace list. The detailed list merely contains three additional columns for the display.
In the time-sorted list, you can display information about the transaction, process type, client, and user by choosing Display -> User, Transaktion, and so on, in the Goto menu.
There is a range of analysis functions that you can use both on the trace list and on the detailed list. All lists have the same functions. You can switch between the trace and detailed lists via a button.
The first line of the list contains a subheader, which remains unchanged for all trace records of a program to be analyzed. It contains the following information:
- Name of the transaction, process identification number, process type, client, and user name.
The next line contains the following headers:
Duration Execution time of the statement. The time is displayed in the format milliseconds.microseconds.



