Developer ToolsFree generatorPDF, Excel, Word exportSAP ECC 6.0All SAP ECC 6.0 tools

SAP Transaction Code Usage History: SWNC_COLLECTOR_GET_AGGREGATES Report Generator

This generator writes an ABAP report for SAP ECC 6.0 that reads transaction and report usage from the ST03N workload collector with SWNC_COLLECTOR_GET_AGGREGATES and ranks entries by dialog steps, distinct users and average response time. It loops over as many months, weeks or days as your collector still holds.

Fill in

TOTAL for all application servers, or one instance name as shown in ST03N.

First day of month for M, the week start date shown in ST03N for W.

For example ME* or Z*.

Generated code
Download:

ABAP report: transaction usage from the workload collector

REPORT z_tcode_usage_swnc.

* Transaction and report usage from the ST03N workload collector.
* Aggregates by ENTRY_ID (transaction code or report) and user (ACCOUNT).

TYPES: BEGIN OF ty_user,
         entry_id TYPE swncaggusertcode-entry_id,
         account  TYPE swncaggusertcode-account,
         count    TYPE p LENGTH 16 DECIMALS 0,
         respti   TYPE p LENGTH 16 DECIMALS 0,
       END OF ty_user,
       BEGIN OF ty_tcode,
         entry_id TYPE swncaggusertcode-entry_id,
         count    TYPE p LENGTH 16 DECIMALS 0,
         respti   TYPE p LENGTH 16 DECIMALS 0,
         users    TYPE i,
       END OF ty_tcode.

DATA: lt_raw   TYPE STANDARD TABLE OF swncaggusertcode,
      ls_raw   TYPE swncaggusertcode,
      lt_user  TYPE STANDARD TABLE OF ty_user,
      ls_user  TYPE ty_user,
      lt_tcode TYPE STANDARD TABLE OF ty_tcode,
      ls_tcode TYPE ty_tcode,
      lv_start TYPE d VALUE '20260101',
      lv_c8    TYPE c LENGTH 8,
      lv_year  TYPE n LENGTH 4,
      lv_month TYPE n LENGTH 2,
      lv_tcode TYPE tstct-tcode,
      lv_text  TYPE tstct-ttext,
      lv_avg   TYPE p LENGTH 16 DECIMALS 1,
      lv_n     TYPE i.

START-OF-SELECTION.

  DO 9 TIMES.
    REFRESH lt_raw.
    CALL FUNCTION 'SWNC_COLLECTOR_GET_AGGREGATES'
      EXPORTING
        component     = 'TOTAL'
        periodtype    = 'M'
        periodstrt    = lv_start
      TABLES
        usertcode     = lt_raw
      EXCEPTIONS
        no_data_found = 1
        OTHERS        = 2.
    IF sy-subrc = 0.
      LOOP AT lt_raw INTO ls_raw.
        IF ls_raw-entry_id CP '*'.
          ls_user-entry_id = ls_raw-entry_id.
          ls_user-account  = ls_raw-account.
          ls_user-count    = ls_raw-count.
          ls_user-respti   = ls_raw-respti.
          COLLECT ls_user INTO lt_user.
        ENDIF.
      ENDLOOP.
    ELSE.
      WRITE: / 'No workload data for period starting', lv_start.
    ENDIF.

* Next period: D = next day, W = next week, M = first of next month
    CASE 'M'.
      WHEN 'D'.
        lv_start = lv_start + 1.
      WHEN 'W'.
        lv_start = lv_start + 7.
      WHEN OTHERS.
        lv_year  = lv_start(4).
        lv_month = lv_start+4(2).
        IF lv_month = 12.
          lv_month = 1.
          lv_year  = lv_year + 1.
        ELSE.
          lv_month = lv_month + 1.
        ENDIF.
        CONCATENATE lv_year lv_month '01' INTO lv_c8.
        lv_start = lv_c8.
    ENDCASE.
  ENDDO.

* One row per transaction: total steps, total response time, distinct users
  LOOP AT lt_user INTO ls_user.
    ls_tcode-entry_id = ls_user-entry_id.
    ls_tcode-count    = ls_user-count.
    ls_tcode-respti   = ls_user-respti.
    ls_tcode-users    = 1.
    COLLECT ls_tcode INTO lt_tcode.
  ENDLOOP.

  SORT lt_tcode BY count DESCENDING.

  WRITE: / 'Entry (tcode/report)', 42 'Steps', 62 'Users', 74 'Avg resp', 90 'Text'.
  ULINE.
  LOOP AT lt_tcode INTO ls_tcode.
    lv_n = lv_n + 1.
    IF lv_n > 100.
      EXIT.
    ENDIF.
    CLEAR lv_text.
    lv_tcode = ls_tcode-entry_id.
    SELECT SINGLE ttext FROM tstct INTO lv_text
      WHERE sprsl = sy-langu
        AND tcode = lv_tcode.
    IF ls_tcode-count > 0.
      lv_avg = ls_tcode-respti / ls_tcode-count.
    ELSE.
      lv_avg = 0.
    ENDIF.
    WRITE: / ls_tcode-entry_id(40), 42 ls_tcode-count, 62 ls_tcode-users,
             74 lv_avg, 90 lv_text.
  ENDLOOP.

Verify in SE37 that SWNC_COLLECTOR_GET_AGGREGATES has COMPONENT, PERIODTYPE, PERIODSTRT and table USERTCODE (structure SWNCAGGUSERTCODE with ENTRY_ID, ACCOUNT, COUNT, RESPTI) on your release. The FM also has ASSIGNDSYS (default SY-SYSID) and FACTOR (default 1000), which scales time fields, so compare the average response time with ST03N before quoting it. Rows are split by TASKTYPE (dialog, RFC, background and so on); the report merges them.

Get a usage-based S/4 scope check

Send us the exported usage list and we will flag unused custom transactions and reports so they can be dropped from S/4HANA remediation.

Optional. The tool and every export work without this. No spam.

Was this tool useful?

Where usage history lives

There is no simple transparent table of transaction usage. The statistics records written by each work process are aggregated by the workload collector into totals per day, week and month, which ST03N displays and which SWNC_COLLECTOR_GET_AGGREGATES returns as internal tables. The USERTCODE table gives one row per task type, user (ACCOUNT) and entry (ENTRY_ID: transaction code, or report name for background and RFC work), with step counts in COUNT and response time in RESPTI. How far back you can go depends on the collector reorganisation settings in ST03N, which Basis controls; months are usually kept longer than days.

How to use it

Set the component to TOTAL, choose M for monthly data and the first day of the oldest month you want, then the number of months. Paste the report into SE38 and run it in the background for long ranges. A period with no data writes a line instead of stopping the run, which tells you where retention ends. Use a pattern such as Z* to see only custom transactions, or ME* for purchasing. The output gives total steps, the number of distinct users and average response time per entry, with the TSTCT text for real transaction codes.

  • Run with D for a quick test: daily data is small.
  • Export the list to a spreadsheet for licence or role reviews.
  • ENTRY_ID for batch work may contain the report and job name, so the TSTCT text stays empty.

What it is used for

Usage history answers three recurring questions. Licence reviews: which users only ran display transactions. Role clean-up: which transactions in a role were never executed in a year. S/4HANA preparation: which custom programs and transactions are actually used, so that unused custom code is not remediated. For the last one, SAP also offers usage procedure logging (SUSG) and the ABAP Call Monitor (SCMON) where installed through ST-PI or the release, which record usage at program and procedure level and are better for custom code decisions.

Limits and alternatives

The collector is only as good as its retention: if Basis keeps three months, you get three months. Single statistics records in STAD are kept for a short window (often around two days), useful for who-ran-what-just-now. The Security Audit Log (SM20, configured in SM19 or RSAU_CONFIG) records transaction starts per user if that event class is active, which is better evidence for audits than workload data. RFC entries show the calling function or program, not the remote system's transaction. Combine sources when a decision depends on the answer.

Frequently Asked Questions

Which SAP table stores transaction code usage history?

No single transparent table does. Workload statistics are aggregated by the ST03N collector and read with SWNC_COLLECTOR_GET_AGGREGATES, whose USERTCODE table returns usage per user and transaction. STAD holds raw records for a short time, and the Security Audit Log holds transaction starts if configured.

How far back can I see transaction usage in SAP?

As far as the workload collector retention allows. In ST03N, the collector and performance database settings define how long daily, weekly and monthly aggregates are kept. Monthly totals usually survive longest. If the report returns no data for older months, retention has removed them; ask Basis to extend it before an S/4 or licence project.

How do I get a list of SAP transaction codes?

All transaction codes are in TSTC, with texts in TSTCT by language (SPRSL). SE93 displays and maintains them. That list shows what exists; this report shows what is actually used, which is usually a small fraction of the full list in a typical ECC system.

What do COUNT and RESPTI mean in SWNCAGGUSERTCODE?

COUNT is the number of dialog steps (or executions for non-dialog task types) for that user and entry in the period. RESPTI is the aggregated response time. The FACTOR parameter of the FM scales time values, so compare one entry with ST03N before relying on absolute times.

If you want Basis and licence owners to ask questions about ECC usage in plain English on your own servers, we can build that layer over the collector data this report reads.

ArchRay builder
Design the on-prem AI stack for SAP ECC 6.0: model, GPUs, RAG pipeline, guardrails
See memory, speed and cost as you swap parts, then export the diagram. Free, in your browser.
Open the builder

Keep exploring

Free tools

ERP fixes and how-tos

Runs with your ERP

AI on your ERP

Integrations