# Cancelled and Long-Running Background Jobs Report

> A custom ALV report that lists background jobs that were cancelled, are still running or finished far above their usual runtime, with the step program, variant, step user and a comparison with the average runtime of recent days. When night jobs go wrong, the BASIS team sees in one list in the morning what deviated and by how much.

- Type: Report, Custom development, ALV report
- Module: BASIS
- Estimated effort: S (3–4 working days)
- Last updated: 2026-11-17
- URL: https://nekuhub.com/en/reports/cancelled-and-long-running-background-jobs-report/


## Why is the standard not enough?

SM37 lists jobs by status and date range and shows the duration, but it does not compare today's runtime of a job with its own historical average, does not calculate the delay against the planned start and does not show the step program and variant in the main list. How many times in a row a periodic job was cancelled is not visible either. The custom report does these comparisons and distributes the result in a morning email.

### Closest standard alternatives

- SM37: Lists jobs by status and date; no comparison with the historical average, start delay or count of consecutive cancellations.
- ST03N: Gives background workload as aggregated statistics; it does not produce a findings list per job.

## Tables used

| Table | Role | Access | Join | System |
|---|---|---|---|---|
| TBTCO | Job header: status, planned and actual start, end, server (driving table) | Read | - | ECC + S/4 |
| TBTCP | Job steps: program, variant and step user | Read | TBTCP-JOBNAME = TBTCO-JOBNAME AND TBTCP-JOBCOUNT = TBTCO-JOBCOUNT | ECC + S/4 |
| TRDIRT | Title of the step program | Read | TRDIRT-NAME = TBTCP-PROGNAME AND TRDIRT-SPRSL = SY-LANGU | ECC + S/4 |

## Selection screen parameters

| Parameter | Description | Type | Reference field | Required |
|---|---|---|---|---|
| S_JOBNM | Job name | Range / multiple | TBTCO-JOBNAME | No |
| S_SDLUS | Scheduling user | Range / multiple | TBTCO-SDLUNAME | No |
| S_STRTD | Start date | Range / multiple | TBTCO-STRTDATE | Yes |
| S_PROG | Step program | Range / multiple | TBTCP-PROGNAME | No |
| P_DEVPCT | Runtime deviation threshold (%) | Single value | - | No |
| P_REFDAY | Reference period (days) | Single value | - | No |
| P_ACTMIN | Long-running active job threshold (min) | Single value | - | No |
| P_CANC | Show cancelled jobs | Checkbox | - | No |

## Output columns

| Column | Source |
|---|---|
| Job name | TBTCO-JOBNAME |
| Status | TBTCO-STATUS |
| Scheduled by | TBTCO-SDLUNAME |
| Step program | TBTCP-PROGNAME |
| Program title | TRDIRT-TEXT |
| Variant | TBTCP-VARIANT |
| Step user | TBTCP-AUTHCKNAM |
| Start date | TBTCO-STRTDATE |
| Start time | TBTCO-STRTTIME |
| Runtime (min) | Calculated: End − start (active job: now − start) |
| Average runtime (min) | Calculated: Average of finished runs in the last N days |
| Deviation % | Calculated: (Runtime − average) ÷ average × 100 |
| Start delay (min) | Calculated: Actual start − TBTCO-SDLSTRTDT/SDLSTRTTM |
| Consecutive cancellations | Calculated: Number of consecutive cancelled recent runs of a periodic job |
| Server | TBTCO-REAXSERVER |

## How does the report work?

1. Jobs that started within the selected date range or are still running are read from TBTCO: job name, job count, status (STATUS: A cancelled, R active, F finished), scheduling user, planned and actual start and end.
2. Runtime (min) = end date/time − start date/time; for active jobs the current time is used instead of the end. Start delay = actual start − planned start (SDLSTRTDT/SDLSTRTTM).
3. Reference runtime: the average of the successfully finished (F) runs of the same job name in the last N days. Deviation % = (runtime − average) ÷ average × 100.
4. Jobs included: cancelled ones; those above the deviation threshold; those active for longer than the threshold. For periodic jobs, the number of consecutive cancelled runs is counted.
5. The step program, variant and step user (AUTHCKNAM) are added from TBTCP and the program title from TRDIRT. For multi-step jobs, the first cancelled step is shown.
6. The result is sorted by finding in ALV; double-clicking the job name opens the job log in SM37.

## Authorization objects

- S_BTCH_ADM: Display background jobs of all users (BASIS administrator)
- S_BTCH_JOB: Display other users' jobs by job group

## Frequently asked questions

### Which jobs count as "long-running"?

There are two criteria: a finished job whose runtime exceeds its own average of the last N days by more than the threshold percentage, or a job that has been active longer than the threshold in minutes. Both thresholds are set on the selection screen.

### Does the error message from the job log appear in the list?

In the basic version you jump from the job name to the SM37 job log for the error. If needed, the last error line of the log can also be read and added as a separate column; this takes about one extra day.

### Does the report work on S/4HANA?

Yes. TBTCO, TBTCP and TRDIRT keep the same structure in S/4HANA. Jobs scheduled through Application Jobs (Fiori) are stored in the same tables, so they are included.

---
Let us build this report for your system: https://nekuhub.com/en/request-a-quote/?report=basis-cancelled-long-running-jobs
