ERPClimb logoERPClimb

ABAP · Intermediate · Configuration

How to set up and analyze an SAP ST05 SQL performance trace

Capture one reproducible read-only workload and identify expensive or repeated SQL statements before proposing an ABAP performance correction.

APPLICABILITY
SAP ECC or S/4HANA on-premise and Cloud Private Edition with SAP GUI and Performance Trace access. This transaction-based exercise does not apply to Public Edition; use supported cloud monitoring tools there.
TOOLS / TRANSACTIONS
ST05 · SE38 or SA38 · SQL Trace

Your project assignment

A hypothetical support team observes that a custom stock report has become slow. The developer uses an isolated test run to separate database round trips from other processing, and compares a baseline against a reviewed improvement without modifying SAP data.

Where to start: URLs and transactions

Transaction
ST05
Test execution
SA38 or the report's approved transaction
Report example
ZTRAIN_STOCK_READ (hypothetical)

Prerequisites

  • An approved non-production trace window and authorization to use ST05.
  • A known read-only report and repeatable selection variant.
  • A small test dataset and baseline runtime; agree on sanitization of trace evidence.

Configuration workflow

From slow report to evidence-based SQL optimization

All steps visible. Play or advance one stage at a time.

From slow report to evidence-based SQL optimizationBaseline: Fixed selection and output → ST05 scoped capture: SQL trace for one user → Database calls: Executions, duration and rows → ABAP source review: One justified change and retest. If it works: Useful comparison, Same result; lower measured cost. If it fails: Inconclusive trace, Check scope, load and selection1BaselineFixed selection and output2ST05 scoped captureSQL trace for one user3Database callsExecutions, duration and rows4ABAP source reviewOne justified change and retestWORKSUseful comparisonSame result; lowermeasured costFAILSInconclusive traceCheck scope, load andselection
Measure the same workload before and after. ERPClimb original instructional diagram · not a live SAP screenshot.

Hands-on implementation — step by step

Follow the screen navigation, replace example values with approved project values, and mark each step after checking its result. The screens below are original teaching aids, not live SAP screenshots. Progress is local to this visit.

0/6 completed
  1. 1

    QA → establish baseline

    Run the read-only report once using a fixed small selection and record the elapsed time and expected output count. Retain the same conditions for the comparison.

    QA → establish baselineERPClimb · illustrative screen
    Variant
    ZTRACE_SMALL (hypothetical)
    Output
    Record count and elapsed time

    Expected result: A repeatable baseline is recorded.

    Why this matters: A changed selection or different workload makes before and after timings difficult to compare.

  2. 2

    ST05 → trace selection

    Open Performance Trace, select SQL Trace and check whether another authorized trace is already active. Coordinate with Basis rather than interrupting a colleague's measurement.

    ST05 → trace selectionERPClimb · illustrative screen
    Trace type
    SQL Trace
    Scope
    Own test user

    Expected result: The correct trace type and agreed scope are identified.

    Why this matters: The narrow scope reduces unrelated statements and avoids unnecessary exposure of other users' data.

  3. 3

    ST05 → activate trace

    Activate the SQL trace for the authorized test identity using available filters. Keep the capture on the application server and execution context appropriate to your release.

    ST05 → activate traceERPClimb · illustrative screen
    User
    Your approved QA identity
    Capture window
    One controlled report run

    Expected result: The SQL trace is active for the intended test.

    Why this matters: The trace must cover the execution context of the workload or relevant database calls may be missing.

  4. 4

    Execute report → stop trace

    Repeat the exact baseline selection once. Immediately return to ST05 and deactivate your trace, including when the report fails.

    Execute report → stop traceERPClimb · illustrative screen
    Selection
    Same as baseline
    After execution
    Deactivate Trace

    Expected result: The workload has been captured and tracing is stopped.

    Why this matters: Keeping the trace active adds overhead and may capture unrelated data.

  5. 5

    ST05 → display and summarize

    Display the trace for the test window and analyze the SQL entries, number of executions, duration, rows and available source positions. Focus on repeated or costly statements.

    ST05 → display and summarizeERPClimb · illustrative screen
    Time window
    Recorded start and end
    Analysis
    Execution count, total duration, records

    Expected result: One or more candidate statements have been isolated with evidence.

    Why this matters: Total cost can arise from a single expensive query or many individually cheap round trips.

  6. 6

    Compare → retest a reviewed correction

    Review the ABAP source for the candidate statement, propose a minimal change, and repeat the same short trace after the correction in the development or QA system.

    Compare → retest a reviewed correctionERPClimb · illustrative screen
    Comparison
    Same selection and comparable load
    Acceptance
    Same business result, fewer calls or lower cost

    Expected result: The before and after results show whether the correction helped.

    Why this matters: Performance improvements must preserve business semantics, authorization behavior and result completeness.

Project acceptance checklist

Use this checklist to prepare evidence for your project lead.

0 of 4 checks marked. This does not certify the SAP configuration.

Validate your configuration

  • Trace is inactive after the measurement.
  • The identified SQL candidate is supported by execution counts and durations; the retest preserves expected output.

Common errors and what to check

  • empty trace.

    Check: Check scope, application server and whether the report actually ran in the captured context.

  • excessive unrelated entries.

    Check: Narrow the user and time window rather than interpreting noise.

  • elapsed time varies widely.

    Check: Compare multiple equivalent runs and account for cache and load effects.

  • no SQL bottleneck.

    Check: Investigate ABAP runtime or remote calls using the appropriate approved tool.

ST05 troubleshooting: for empty trace check user and server; for unclear SQL cost compare executions, duration and rows.
ST05 troubleshooting: for empty trace check user and server; for unclear SQL cost compare executions, duration and rows. ERPClimb original illustration.

More in the SAP Library

Need help with a configuration error? Open ERPClimb Copilot.

Technical references & further reading

Official documentation for technical verification, release compatibility and further study.