Symptom
You wish to analyze the performance of a particular transaction/report/job and would like to use transaction ST12 (also known as Single Transaction Analysis).
Image/data in this KBA is from SAP internal systems, sample data, or demo systems. Any resemblance to real data is purely coincidental.
Environment
Transaction ST12 is available as of basis release 4.6B. It is delivered via the addon ST-A/PI (Application servicetools for EarlyWatch/GoingLive, see SAP Note 69455).
The ST-A/PI version should be 01F* or higher.
The feature to switch on the ABAP trace for another user requires:
- on basis 4.6*: Addon ST-A/PI >= 01F*, Kernel 46D patchlevel >= 1805
- on basis 6.x: Addon ST-A/PI >= 01G*, Kernel 640 patchlevel >= 83
- on basis 7.0 or higher: Addon ST-A/PI 01G*
Resolution
ST12 is the Single Transaction Analysis tool. ST12 integrates ABAP traces (SE30/SAT) and Performance traces (ST05) into a single tracing tool.
ST12 will also try to retreive and save to the database up to 20 STAT records (STAD) generated by the the traced user.
(Performance traces in ST12 are limited to SQL, RFC, and Enqueue activity)
- ABAP traces were traditionally captured, collected, and analyzed in SE30 and SAT. ABAP traces are written to ATnnnnnn files in the SAP DIR_DATA directory.
- Performance traces were recorded and analyzed in ST05. Performance traces are written to TRACEnn files in the SAP DIR_LOGGING directory.
- STAT records are automatically written to STATnn files in the DIR_DATA dorectory and are typically viewed with transactions STAD and STATS.
We refer to the combined capture and collection of ABAP traces, Performance traces, and STAT records as an "ST12 trace".
Tracing methods, configuration, and collection
Analyzing collected traces
About ST12
Tracing methods, configuration, and collection
With this method, activities of a specific user in the current instance/system are captured.
1. Configure the trace.
Comment : <something that helps colleagues/SAP identify the trace>
** Server : <instance in which the user will be active; default is the local instance>
Username : <name of the user to be traced>
† No. Trace Activations : at least 20
‡ Size&Duration : Large
** If you don't know which instance the user will be active in, select <All Servers>
† One ABAP trace is activated per matching user session/mode up to the "No. trace activations" value.
This means that if the chosen user has many parallel sessions/modes in the system and "No. trace activations" is set too small, then the activity which you wish to trace may not be captured.
‡ If the activity to be traced is quite long (10+ minutes), it's recommended to change Size&Duration to Max
2. Click the "Start trace" button.
(If you are tracing yourself, or have chosen a Server other than < Local>, there will be a popup. Click the Enter button on the popups to close them.)
You should now see rows in the trace monitor table, and the "Start trace" button should now be "End traces & collect":
3. Reproduce the problem.
Have the user re-create the performance problem.
It's best for the user to be prepared ahead of time. After the traces have been started, the user should only have to click once to reproduce the problem.
Traces that contain many dialog steps are difficult to analyze. An ST12 trace should contain as few dialog steps as possible.
If multiple steps in a transaction are slow, capture multiple ST12 traces, one for each slow step.
Wait until the slow activity is complete.
4. Once the slow activity is complete, click the "End traces & collect" button.
The "Collect traces" dialogue window will open showing us the ABAP traces that have been captured.
5. Select all the rows in the table and click the Enter button. (Each row represents an ABAP trace)
(If you are trying to trace Update2 tasks, click the Update2 checkbox before clicking the Enter button.)
After clicking Enter, you will see a message:
6. Wait for the async trace collectors to finish.
7. The traces are now ready for Analysis.
With this method, activities of a particular Workprocess are captured.
1. Provide a comment that helps identify the trace to colleagues and SAP.
2. Choose the server that contains the Workprocess that you wish to trace. It's also recommended to set Size&Duration to Max.
3. Click the "Start traces for workprocess" button. You will be shown a screen with a WP table for the chosen server.
4. Select the desired WP and click the "Start traces for selected workprocess" button.
Clicking refresh shortly after starting the trace, each trace should display a green square, indicating each trace is on for that WP.
5. When the activity has finished, or after the trace has been on for some time, select the WP again and click the "End all traces and collect" button.
After clicking "End all traces and collect", you will see a message:
6. Click "back" and wait for the async trace collectors to finish.
7. The traces are now ready for Analysis.
With this method, activities in the current session/mode will be traced. (In other words, the current SAPGUI window.)
(This means that external activities such as RFC/HTTP calls, even when made to the local instance/system, will not be traced because the FMs & handlers are executed in different sessions/modes.)
1. Provide a comment that helps identify the trace to colleagues and SAP.
2. Select either Transaction or Program and provide the name of the transaction/program that contains the steps you wish to trace.
3. Choose whether or not to enable "Particular units".
When "Particular units" is disabled/unchecked, all dialog steps within the transaction/program are traced.
When "Particular units" is enabled/checked, the ABAP trace will not start recording until "/ron" is entered in the command field. Conversely, "/roff" will suspend ABAP trace recording.
(ABAP trace recording can also be turned on/off via the menu: System → Utilities → Runtime Analysis → Switch On/Off)
It's strongly recommended to enable "Particular units" and use "/ron" and "/roff" to trace only the relevant dialog steps. Tracing unecessary dialog steps makes analysis of ABAP traces more difficult.
4. Click the "Execute / start trace" button. You will be taken to the initial screen of the transaction/program that was provided.
5. Recreate the performance problem. (If "particular units" was enabled, use "/ron" and "/roff" to trace only the desired dialog steps.)
6. Click Back (F3) until you reach the ST12 screen again.
When you reach the ST12 screen again, you will see a message:
7. Wait for the async trace collectors to finish.
8. The traces are now ready for Analysis.
Analyzing collected traces
Once the trace is collected the trace is ready for analysis. In the bottom pane as highlighted, select the Trace which is of concern to us.
Then select either one of the above 4 highlighted options for the analysis. The 'Full screen' button can be used to show the
overview of all the traces collected.
The ABAP trace is one of the most useful analysis options available in ST12 trace. It provides a Top Down flow of any Hotspot/Program/Transaction
and provides a Functional Time Distribution of a flow. It displays the hierarchical order in which the call statements are executed. So it can be used
to identify the issues in the flow hierarchy.
For Basics of ABAP trace, please see SAP Note 755977.
The above screenshot is a Per Call View of the ST12 trace. The view can be changed into a Modularized by selecting the Per Mod Unit button
as highlighted above. This will give a modularized flow of the Code called inside a particular module.
The “Top Down Call Tree”(as highlighted below) option clicked when the cursor placed on a Modularization Unit Call(Method/Performs) displays all calls to the selected unit labeled as ‘0’,’1′ are statements inside this modularization unit, ‘2’ the statements in modularization units one level below, and then iteratively down up to 30 levels. Letters are used to designate lower levels.
Double-clicking on any of the line navigates us to the source code. This can be used to identify the impact point.
ST12 trace captures the minute details of the flow such as the Loop statements performance, which can be used for a detailed analysis of the flow.
As the ABAP trace captures the complete flow, this can be used as an effective tool to identify the Customer Modifications or User Exit.
Note: The call hierarchy considers the call on Forms, Methods, Functions, SQL statements, Loops, Call Screen to PBO, PAI Modules.
Performance trace of ST12 is equivalent to the ST05 trace. It displays performance parameters of all the database statements executed in the flow.
SQL summary is the aggregation of SQL trace records from the Performance trace. SQL
provides the details like Execution time, No. of records selected, Total duration, server details, etc. on a query on a database table. Double-clicking on any record takes the flow to a screen which displays the list of programs which has queried on the table and the SELECT query as such.
Displays the statistic records saved by the async trace collector for that ST12 trace. These records are the same as the records that can be queried in transaction STAD. Only up to 20 statistic records will be saved.
About ST12
When an ST12 trace is ended, trace collectors are started asynchronously.
The trace collectors have 3 tasks:
• Retrieve the ABAP traces from the ATnnnnnn files in DIR_DATA, prepare the ABAP traces for analysis, and commit them to the DB.
• Retrieve the SQL Performance trace records from the TRACEnn files in DIR_LOGGING and aggregate them to generate the SQL summary.
• Retrieve 20 STAT records generated by the traced user and commit them to the DB.
While the async trace collectors are running, the ST12 trace status will be busy :
When the trace collectors are finished (and after refreshing ST12), the ST12 trace status will be green :
Trace collection may require a few seconds or it may take some minutes, it depends on the size of the generated traces.
If the trace collectors fail to finish, then some features of an ST12 trace may be partly or completely unavailable.
Keywords
ST12 trace , performance analysis tool , single transaction , high response time , st12 abap trace , net time , performance traces , SQL summary, stat records , ENQUEUE trace , RFC trace , ST05,SE30, /SSA/STA