Tuesday 13 September 2016

Activate Trace in SAP system using ST12

There are several transaction codes available to activate the trace in SAP system for example ST01, ST05 and ST12.

But from the Basis administrative perspective ST12 is the most powerful transaction code which can be used to trace the user activity to capture the performance statistics.

There are 4 sections available for the input which is necessary to start the trace.

1.    Trace for
2.    ABAP trace
3.    Performance traces
4.    Start Trace

[1] TRACE FOR

There are 4 modes available.

  1. User/Tasks: This is to capture the activities performed by an user

Note: At a time trace is possible only for 1 user

  1. Workprocess: Trace for the workprocess allows us to select a specific server for which trace is required. If not selected, all the servers will be captured for the trace.

  1. Current mode: To trace our own activity. This option is used trace the flow of a Transaction or a Program

  1. Schedule: To trace the activities which will be performed at a scheduled time. This is used to trace the batch job based on the selection criteria (Job name, User name, ABAP Program and variant of this program)

Note: In general this option is used if no one from the Basis team is available to switch on the trace during that specific future period.


Note: Of the above 4 modes, most of the time we use the User/Tasks mode.

There are 5 fields available under this mode User/Tasks.

  1. Comment: Any description, for example...'long running query'

  1. Server: Server name on which user is performing the activity, it is recommended to select "ALL servers" which means the trace will be collected for all the servers

  1. Username: SAP user ID for which trace is required

  1. Tasktype: Type of work process. it is recommended to select "*" so that all the tasks will be captured

  1. No. trace activations: Recommended to keep the default value

[2] ABAP TRACE

  • There is a setting available under ABAP trace "Size&Duration", where we can specify 'size of the output file' and the 'duration' for which output is required. Trace will be stopped if it exceeds the file size.
  • It is advised to keep it as "Max." so that the complete trace will be captured until the trace is stopped. However better to have several smaller traces for long activities. 

[3] PERFORMANCE TRACE

There are 3 kind of operations available here:

  1. SQL: If the program access the database table, it tracks the corresponding SQL operation
  2. RFC: Performance of the calls made by the program will be captured
  3. Enqueue: Application locks information like who, where and when are captured

[4] START TRACE

  1. Select either the ABAP Trace or Performance trace or both. It is advised to select both.
  2. Switch on the trace by selecting the option "Start trace".
  3. Inform user to perform the activity.
  4. Once the user is confirmed that the activity is completed, select the "End traces & collect".
  5. This will pop-up a new screen of "Collect traces", select the required rows and then  'Enter'.
  6. The trace generation may take some time, after which the trace is ready for the analysis.