How to run ST12 to do a performance trace or review a existing trace

SAP ST12 can trace SQL, ABAP, Remote Function Call and Enqueue operation of a program/job. Trace would show time consumption on different code level from program subroutine/funtion module to individual ABAP code or SQL statement so you know where time is spent by the program, that helps you to find improvement opportunity or direction. This is a powerful performance analysis transaction I use very often when other performance tools like STAD etc is not enough for performance trouble-shooting.

Following are general steps of run ST12 trace.

1. Run SAP transaction ST12

2. Specify what to be traced

3. Choose trace options

4. Start/activate trace

5. End and collect trace

6. Review and navigate the trace

7. watch-out

1. Run SAP transaction ST12

Enter “ST12” in command window and press “return”, then following screen shows up ( Your version might be slightly different)

This is a 1st screen of ST12 transaction. From this screen, you can start a new trace or review collected trace.

2. Specify what to be traced.

You select one of 4 trace modes: User/Tasks, Workprocess, Current mode and Schedule by clicking corresponding button. indicates current mode. Following example is telling that ST12 is under “User/Task” mode.

This is to trace activities executed under a single user. Such as online user or background user etc

This is to trace a running SAP work process. You use this when business is complaining job is long running and you would like to find out what is going on with the job.

This is to trace activities under yourself.

this is to schedule system to trace a future activities when none is available to trace online

“Comment” field – you can enter free text related to your case – like “EDI Big order creation” or your TEST-case ID etc. This helps you to remember what the trace is for.

“Server” field – If your system has several servers, here you need to put SAP instance name where the user is executing the transaction if the user is on the different server which you are doing the trace. You can simply choose “ALL servers” option in the pop-up window.

“Username” – In “User/Tasks” mode, specify the SAP user account for traced.

“Tasktype” – In “User/Tasks” mode, specify type of SAP work process executed by the selected users

“No. trace activations” – In “User/Tasks” mode, specify # of traces – one trace is normally one work process. This option in lower version is not available.

“Transaction” – In current mode, specify transaction code of the transaction to be traced.

“Program” – In current mode, specify name of the program to be traced.

3. Choose trace options

You can specify technical trace scope for the job/program being traced in the following section of ST12 screen

You can select do “ABAP trace” or/and “Performance traces”. To make it simple, I suggest that you select both. However if you are only concerned about non-database time, you can select “ABAP trace” option only etc.

You can specify ABAP trace options

you can click on “Particular units” and use “Further opt” to enter the specific program module which you would like to trace. I seldom used this option.

The internal table options is important for performance analysis –especially if STAD shows that a program/job spent it’s most of time on CPU time. It would track time spent on the internal table.

– Here you specify file size – the trace would stop when it reach the file size. For long running program, I suggest that you do several smaller trace instead of one big trace.

– This influence time accuracy of recording. It is an operating system dependant. If your system does not have option “auto”. Please refer to SE30 document on what is right mode for system.

You can choose one or more of RFC, SQL, and Enqueue option.

This option would track SQL operation. If your program accesses no database table, enabling this option would do nothing.

This option would track performance of all Remote Function Call made by the program – when and where and duration of calls.

This option would track application locks situation such as when, where, who etc.

4. Start trace

After you specify all those info in the previous section, and you can start your trace. There is a difference on how to start trace. After all above input, you need to click the button to continue..

“User/Tasks” mode, when user is ready to execute the transaction, you can click the button to tell system to trace activities under that user. System would record all activities under the specified user while trace is on. After you click the trace button, following screen shows up. Please pay attention that since I did not choose “RFC” option—so RFC trace is not started in the following screen.

“Workprocess” mode, This is to trace one of active user jobs/programs. You click the button to start the process. but actual trace is not happening yet. Since SAP does not know which process to be traced. SAP would show SM50 process monitoring screen like below, on this screen, you can select work process based on user ID or program by placing cursor on the desired line, then click “activate” button to start trace as showed in following screen.

Following the click, the system would show following

 

5. End and collect trace

After expected tracing duration or transaction being traced is completed, you need to end the tracing and collect the tracing result.

“User/Tasks” mode – as showed in the corresponding screen in step 4, you click button to end and collect your traces. When you do that, following screen might show up to allow you to specify what trace you would like to generated

You can select all entries or specific entry based on your need, you can enter filter as well. After you made your selection, you can click “enter” button. you are done. However the system might take some time to generate trace, I waited about 1-2 minute before I can review the trace data. Click “Cancellation” button if you would like to discard your trace data.

“Workprocess” mode – as showed in the corresponding screen in step 4, you click button in the same window you activate a work process trace to end and collect your trace. That is it.

6. Review and navigate the trace

You need to select which trace you need to review, then determine whether you would like to see ABAP trace, or/and Performance trace. For new version, we have “SQL summary” and STAD data available for the trace.

Refer to step 1 screen, in the section, you can find interested trace log by comment, date time and SAP user who starts the trace etc. You can select a trace log by clicking corresponding entry.

Then you can evaluate ABAP, SQL trace/RFC trace/Enqueue trace by clicking one of button in following list.

ABAP trace

Clicking ABAP trace button, you would get a screen like

ABAP trace is showing time consumption at different program code level.

There are several navigation/analysis buttons. Those are just to change what you would see. For example, you can sort display by %, you can select on entry and show hierarchy etc for analysis purpose.

Performance trace

Clicking “performance trace” button, you would get the same trace you would normally get via SAP transaction ST05, namely SQL trace, RFC trace, Enqueue trace depends on what has been selected when a trace is turned on. The performance trace screen following the click is like

The menu “Trace List” has following important operation to analyze your SQL statement as show below.

SQL summary(See detail below), combined Table accesses and Display Identical Selects are all handy feature for you to analyze performance of database access from traced SAP program/transactions.

SQL summary

Click “SQL summary” button, you would get SQL summary screen which is similar to what you got from ST05 but with more information like server, redundant# etc…

SQL summary is a new feature from ST12. I like this – it saves my time to generate the summary in old version. It could take long time to generate a SQL summary if your trace collects a lot of SQL activities and your ST12 version does not have this feature.

Following is sql execution plan which shows database access strategy used to read table TF011.

Depends on your incident, you might find that it is useful to see ” Summary for ABAP traces” as well as do some online document for your trace.

7. Watchout

There are several points – you need to watch out

1. One instance of SAP or one server can have only one people doing trace at one time.

2. Zombie trace can exist in the system depend on your case. Zombie trace can impact reliabilities of your trace. So make sure that there is no “zombie trace” in the system before you start the trace. You can use program SAPRSATRA_MONITOR to kill zombie trace, refer to SAP OSS note 1156324 for more detail.

3. I prefer to do a short trace under half hour normally.. If a program is running long, I would normally do several short traces. Or you can schedule your testing case to make it sure that it is not running too long. Any testing case runs over 1.5 hr is too long.

If you wonder how to interpret the trace data, I would try to cover this in subsequent posting.

4 thoughts on “How to run ST12 to do a performance trace or review a existing trace”

  1. Bravo. Finally, somebody has understood the problem of Basis Administrators
    tackling those “Hello World” ABAP modules !!

    Thanks for your contribution.

    Kumar from Germany
    ===============

Leave a Reply