SAPFree referencePDF, Excel, Word exportSAP ECC 6.0All SAP ECC 6.0 tools

SAP Batch Job Tables (TBTCO, TBTCP) and Job Status Codes

A reference of the tables behind SM36 and SM37 on SAP ECC 6.0, with key fields and how they join, plus every TBTCO-STATUS value and what to do about it. Use it to build job reports in SE16N, SQVI or ABAP.

Download:
SectionTable or codeDescriptionKey fields or SM37 labelJoin to or actionTypical use
Tables
TBTCO
Job header: one row per job run
JOBNAME, JOBCOUNT; STATUS, SDLSTRTDT, SDLSTRTTM, STRTDATE, STRTTIME, ENDDATE, ENDTIME, SDLUNAME, REAXSERVER, JOBCLASS
TBTCP on JOBNAME + JOBCOUNT
Runtime and failure reports across all jobs
Tables
TBTCP
Job steps
JOBNAME, JOBCOUNT, STEPCOUNT; PROGNAME, VARIANT, AUTHCKNAM (step user), LISTIDENT (spool), XPGPROG (external program)
TBTCO on JOBNAME + JOBCOUNT; TSP01 on LISTIDENT = RQIDENT
Find jobs running a given program or variant
Tables
TBTCS
Time schedule control for scheduled periodic jobs
JOBNAME, JOBCOUNT, SDLSTRTDT, SDLSTRTTM, PRDMINS
TBTCO on JOBNAME + JOBCOUNT
Next planned start of time-based jobs
Tables
BTCEVTJOB
Jobs waiting for events
EVENTID, EVENTPARM, JOBNAME, JOBCOUNT
TBTCO on JOBNAME + JOBCOUNT
Which jobs start after event SAP_END_OF_JOB or a custom event
Tables
BTCSED
Descriptions of system event IDs
LANGUAGE, EVENTID, DESCRIPT
BTCEVTJOB on EVENTID
Document SAP-delivered events
Tables
BTCUED
Descriptions of user event IDs
EVENTID, language and description text
BTCEVTJOB on EVENTID
Document custom events created in SM62
Tables
TSP01
Spool requests
RQIDENT (spool number), RQOWNER, RQ0NAME, RQ1NAME, RQ2NAME, RQCRETIME
TBTCP on RQIDENT = LISTIDENT
Locate the spool list of a job step
Tables
TSP02
Output requests for spool requests
PJIDENT (spool number), PJNUMMER
TSP01 on PJIDENT = RQIDENT
Was the job output printed and where
Tables
VARID
Variant directory
REPORT, VARIANT; ENAME, AEDAT
TBTCP on PROGNAME = REPORT and VARIANT
Who created or changed a job variant
Tables
VARIT
Variant texts
LANGU, REPORT, VARIANT, VTEXT
VARID on REPORT + VARIANT
Variant descriptions for documentation
Tables
VARI
Variant contents (cluster storage)
RELID, REPORT, VARIANT (cluster key)
Read with function RS_VARIANT_CONTENTS, not SE16
Selection values used by a job step
Tables
TST01 / TST03
TemSe object directory and data, where job logs are stored
TemSe object name
Read job logs with BP_JOBLOG_READ
Job log text, never queried directly
Status
P
Scheduled: job defined, no start condition released
SM37: Scheduled
Release in SM37 (Job > Release)
Jobs left unreleased after a transport or copy
Status
S
Released: start condition set, waiting for time or event
SM37: Released
Change start condition, unrelease, delete
Normal state of periodic jobs between runs
Status
Y
Ready: start time reached, waiting for a free background work process
SM37: Ready
Check SM50 for busy BGD processes
Long Ready times indicate too few background work processes
Status
R
Active: running in a background work process
SM37: Active
Check status, cancel active job, debug via SM50
Long runners and stuck jobs
Status
F
Finished: all steps ended without error
SM37: Finished
Display job log and spool
Normal end
Status
A
Canceled: a step ended with an error or the job was cancelled
SM37: Canceled
Display job log, check ST22 for dumps
Failure monitoring
Status
Z
Put active: transitional status while the job is being handed to a work process
Constant btc_put_active
Normally changes to R within seconds
Jobs stuck in Z point to work process or server problems
Status
X
Unknown status
Constant btc_unknown_state
Run the consistency check in SM65
Inconsistencies after server crashes
Tools
SM36 / SM37 / SMX
Define jobs, monitor all jobs, monitor own jobs
Job name, user, status, date
TBTCO, TBTCP
Daily job operations
Tools
SM62 / SM64
Maintain background events / trigger an event
EVENTID, parameter
BTCEVTJOB
Event-driven job chains
Tools
BP_JOB_READ / BP_JOBLOG_READ
Function modules to read job data and job log
JOBNAME, JOBCOUNT
TBTCO, TBTCP, TemSe
Custom job monitoring programs
Tools
JOB_OPEN / JOB_SUBMIT / JOB_CLOSE
Function modules to create and release jobs from ABAP
JOBNAME, JOBCOUNT returned by JOB_OPEN
SUBMIT ... VIA JOB is an alternative to JOB_SUBMIT
Program-scheduled jobs
Tools
RSBTCDEL2
Report to delete old job data and logs
Age in days, job name pattern
Usually scheduled as standard job SAP_REORG_JOBS
Keep TBTCO and TemSe small

Status letters are the constants defined in the background processing include LBTCHDEF (btc_scheduled P, btc_released S, btc_ready Y, btc_running R, btc_finished F, btc_aborted A, btc_put_active Z, btc_unknown_state X). Verify field lists in SE11 on your release.

Get your job landscape reviewed

Send us an export of TBTCO and TBTCP for one month and we will return failure hotspots, Ready-time peaks and jobs with no owner.

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

Was this tool useful?

How to use it

Filter the Section column: Tables for the data model, Status for TBTCO-STATUS values, Tools for transactions, function modules and reports. A job is identified by JOBNAME plus JOBCOUNT (an 8-character number assigned at creation), so every join uses both fields. TBTCO has one row per job run; periodic jobs create a new JOBCOUNT for each run, which is why counting rows by JOBNAME shows run history.

Worked example: which jobs run program X with which variant

In SE16N or SQVI, join TBTCP to TBTCO on JOBNAME and JOBCOUNT. Filter TBTCP-PROGNAME = 'RMMRP000' and TBTCO-STATUS = 'S' to find released MRP jobs, then read TBTCP-VARIANT and TBTCP-AUTHCKNAM to see the variant and step user. Join VARID on REPORT = PROGNAME and VARIANT to see who last changed the variant. For finished runs, TBTCP-LISTIDENT gives the spool number, the same as TSP01-RQIDENT. In Open SQL the core is: SELECT o~jobname o~status o~strtdate p~progname p~variant FROM tbtco AS o INNER JOIN tbtcp AS p ON p~jobname = o~jobname AND p~jobcount = o~jobcount, which works on any ECC 6.0 release.

  • Runtime: ENDDATE/ENDTIME minus STRTDATE/STRTTIME in TBTCO
  • Delay: STRTDATE/STRTTIME minus SDLSTRTDT/SDLSTRTTM
  • Failures: STATUS = 'A' by date and JOBNAME

Reading the status codes

P and S are planning states: P means no start condition is released, S means the job waits for its time or event. Y means the start time is reached but no background work process is free, so a growing number of Y jobs at peak times is a capacity signal, not a job problem. R is running, F finished and A canceled. Z is a short transitional state while the job is handed to a work process. X means the system cannot determine the state, typically after a server crash; run the consistency check in SM65 before deleting anything.

Gotchas

Job logs are not in TBTCO or TBTCP; they are TemSe objects, so read them with BP_JOBLOG_READ or SM37, never by querying TST03. VARI is a cluster table, so variant values need RS_VARIANT_CONTENTS. TBTCO-SDLUNAME is the user who scheduled the job, while TBTCP-AUTHCKNAM is the user whose authorizations each step runs under; audits need the step user. If RSBTCDEL2 is not scheduled, TBTCO and TemSe grow without limit and SM37 selections slow down.

Frequently Asked Questions

Which SAP table stores batch jobs and their steps?

TBTCO holds the job header with JOBNAME, JOBCOUNT, status and start and end times. TBTCP holds the steps: one row per STEPCOUNT with the program (PROGNAME), variant and step user. Join them on JOBNAME and JOBCOUNT.

Which table links a batch job to its spool?

TBTCP-LISTIDENT contains the spool request number created by the step. It matches TSP01-RQIDENT, where the spool request owner, names and creation time are stored. TSP02 holds the output requests for that spool.

What are the SAP batch job status codes?

In TBTCO-STATUS: P scheduled, S released, Y ready, R active, F finished, A canceled, Z put active (transitional) and X unknown. SM37 shows the same states with labels. The letters are constants in the include LBTCHDEF.

Which table stores job variants?

Variant names per program are in VARID, texts in VARIT, and the selection values in cluster table VARI. The variant used by a job step is in TBTCP-VARIANT. Read variant values with function module RS_VARIANT_CONTENTS rather than directly.

If you want operations staff to ask in plain English which jobs failed last night and why, answered from TBTCO and job logs on your own servers, we can set that up.