SM37: Checking a Monthly Batch Job (Selection, Job Log, Periodic Runs, Background-Only Variants)
How to check in SM37 whether a monthly batch job finished correctly: the selection screen, the numbers and buttons on the job overview, how to read the job log, how a periodic job creates its next run, background-only variants that do not appear on the selection screen, and DB02 SQL for checking.
Note: screens, menus and settings can differ by SAP release and system configuration. Screen labels are given with their English GUI names. SQL results are from a demo system.
1. SM37 selection screen (Simple Job Selection)
| Field | Example | Meaning |
|---|---|---|
| Job name | part of the name + * | * means "any characters". If you know only part of the name, put * before and after it |
| User name | * | The default is your own user ID. Jobs created by other users appear only after you change it to * |
| Job status | all except Sched. | Released (waiting), Ready, Active (running), Finished (completed), Canceled (stopped with an error) |
| Job start condition | today to today | Jobs that started, or are scheduled to start, in this range. To see the next run, extend the end date past its date |
| ABAP program name | program name | Finds jobs that ran this program even if you do not know the job name |
2. Reading the job overview
Executing the selection opens the job overview. These are the columns to check on a job line.
| Column | Meaning |
|---|---|
| Status | "Finished" (green) means the job ran to the end. "Canceled" (red) means it stopped with an error |
| Duration (sec.) | The actual run time, from start to end |
| Delay (sec.) | How late the job started compared with its scheduled time. Scheduled 05:00:00 and started 05:00:33 gives 33 seconds |
| Spool | An icon appears if the job created an output list. Blank means there is no spool |
3. Buttons on the job overview
| Button | What it does |
|---|---|
| Refresh | Reads the list again with the same selection, to see whether a running job changed status |
| Release | Releases a job in status "Scheduled" (planned but not yet released) so that it can run |
| Stop icon (cancel active job) | Stops a job in status "Active" (running) |
| Delete (trash can) | Deletes the selected job run. Its job log is deleted too, so do not use it when you only want to check |
| Spool | Shows the output list created by the job |
| Job log | Shows the messages written during the run. The processed count is usually checked here |
| Step | Shows which program, variant and user the job runs with |
| Job details | Shows the scheduled time, actual start and end time, period and similar data on one screen |
| Application servers | Shows the SAP servers that run batch jobs and their status. Not needed for checking results |
4. Double-click a job: the Display Job screen
Double-clicking a job line on the overview opens a screen that shows how the job is scheduled.
| Item | Meaning |
|---|---|
| Job class | Batch priority. A is the highest, C is normal (the default) |
| Exec. target | The server to run on. If blank, the job runs on any free batch server |
| E-mail notification / Spool list recipient | Who receives the job status or result by mail. A job without spool has no list to send |
| Planned start / Job frequency | Scheduled date and time of this run, and the period (monthly etc.) |
| Job steps | Number of defined steps (programs to run) |
| Start condition | Shows the start date, time and period settings in detail |
| Predecessor job / Successor job | Shows jobs chained before or after this job |
| Job selection / Own jobs | Back to the SM37 selection screen / show only jobs created by your user |
5. Reading the job log
In a batch run, messages raised during processing go to the job log instead of the screen. Messages from the batch system, from the program, and from standard functions the program calls are mixed together, so use the message class to tell them apart. The example is a monthly job that calls the standard price change function.
| Message (example) | Class / No. | Written by |
|---|---|---|
| Job ... started | 00 516 | Batch system |
| Step 001 started (program ..., variant ..., user ID ...) | 00 550 | Batch system. Shows which variant and user the job ran with |
| Price change document ... posted | CKPRCH 019 | The standard price change function called by the program. These lines appear even if the program has no output code |
| Profit center was set to ... | KI 339 (type I) | Information message from standard processing. Not an error |
| A result such as "success n / failed m" | Z message class | Written by the program itself. Use this line for the processed count |
| Job finished | 00 517 | Batch system. The time between the first line and this line is the duration on the job overview |
6. When a spool is created
A program that does not call its ALV screen in batch, like the one below, creates no spool.
END-OF-SELECTION.
IF sy-batch IS INITIAL. "only when run from the screen
IF gt_result[] IS NOT INITIAL.
CALL SCREEN 0100. "ALV screen
ENDIF.
ENDIF.
"in batch the screen is not called, so no spool is created
| Case | Spool |
|---|---|
| WRITE list output in batch | Created |
| Full-screen ALV called in batch (REUSE_ALV_GRID_DISPLAY, CL_SALV_TABLE) | Created, output as a list |
| In batch the program only saves and ends, without calling the ALV screen | Not created. The spool column on the job overview is blank |
| WRITE ... TO variable (converting a value to text) | Not output, so unrelated to spool |
7. A periodic job creates a separate line for each run
A monthly job is not one line that keeps running. Each run is a separate line with a different job count (JOBCOUNT). The line for the next run is created in status "Released" when the current run starts.
Check it in the job header table TBTCO.
SELECT j.JOBNAME, j.JOBCOUNT, j.STATUS,
CASE j.STATUS WHEN 'P' THEN 'Scheduled' WHEN 'S' THEN 'Released' WHEN 'Y' THEN 'Ready'
WHEN 'R' THEN 'Active' WHEN 'F' THEN 'Finished' WHEN 'A' THEN 'Canceled'
ELSE 'Other' END AS STATUS_TEXT,
j.SDLSTRTDT AS PLAN_DATE, j.SDLSTRTTM AS PLAN_TIME, /* scheduled start */
j.SDLDATE AS CREATED_ON, j.SDLTIME AS CREATED_AT, /* when this line was created */
j.STRTDATE, j.STRTTIME, j.ENDDATE, j.ENDTIME, /* actual start, end */
j.PRDMONTHS AS PERIOD_MONTHS
FROM TBTCO j
WHERE j.JOBNAME LIKE '%part of job name%'
ORDER BY j.SDLSTRTDT DESC, j.SDLSTRTTM DESC;
| JOBCOUNT | Status | Scheduled start | Line created at | Actual start |
|---|---|---|---|---|
| 05003300 | S Released | 2026-11-01 05:00:00 | 2026-10-01 05:00:33 | (not run yet) |
| 05000101 | F Finished | 2026-10-01 05:00:00 | 2026-09-01 05:00:01 | 2026-10-01 05:00:33 |
| 05000100 | F Finished | 2026-09-01 05:00:00 | 2026-08-01 05:00:01 | 2026-09-01 05:00:01 |
Result from the standard monthly job RMMVRZ00 on a demo system. The November line was created at 05:00:33, the moment the October run actually started. The October line was created when the September run started.
8. What happens when you delete a line
| Line deleted | Result |
|---|---|
| This run's "Finished" line | Only the record and job log of that run are deleted. The next run's "Released" line exists separately, so the schedule continues |
| The next run's "Released" line | The next run does not happen. The run after it would have been created when the next run started, so nothing runs from then on. To restart, schedule the job again in SM36 |
9. A variant that is not on the selection screen: Only for background processing
Sometimes the variant shown in the job log or step is not in the variant list of the program's selection screen. A variant saved with "Only for background processing" can be used only in batch. In the case checked here, the program had only this variant, so the "Get variant" button did not appear on the selection screen at all.
| Where | What you see |
|---|---|
| Job log second line / SM37 "Step" | The variant the job uses |
| SE38 → program → subobject "Variants" → Display | Variant list and values, including background-only variants |
| Selection screen → Save → Variant Attributes | "Only for background processing" checkbox |
| Table VARID, field ENVIRONMNT | A Background and online / O Online / B Background |
A variant saved from the selection screen and a variant shown in SE38 are the same object.
10. DB02: the variants of a program and their environment
SELECT v.REPORT, v.VARIANT, v.ENVIRONMNT, e.DDTEXT AS ENV_TEXT,
v.ENAME, v.EDAT, v.AENAME, v.AEDAT
FROM VARID v
LEFT JOIN DD07T e ON e.DOMNAME = 'VARID_ENV' AND e.DOMVALUE_L = v.ENVIRONMNT
AND e.DDLANGUAGE = 'E' AND e.AS4LOCAL = 'A'
WHERE v.MANDT = '100' /* client */
AND v.REPORT = 'PROGRAM_NAME' /* program */
ORDER BY v.ENVIRONMNT DESC, v.VARIANT;
| REPORT | VARIANT | ENVIRONMNT | ENV_TEXT |
|---|---|---|---|
| RM07DOCS | DYN_VAR_1000 | B | Background |
| RM07DOCS | IGVG | B | Background |
| RM07DOCS | YG-DYN_003 | B | Background |
Part of the result for the standard report RM07DOCS on a demo system. The user columns are left out of the table.
11. DB02: job steps (program, variant, user)
SELECT s.JOBNAME, s.JOBCOUNT, s.STEPCOUNT,
s.PROGNAME, s.VARIANT, s.AUTHCKNAM AS BATCH_USER
FROM TBTCP s
WHERE s.JOBNAME LIKE '%part of job name%'
ORDER BY s.JOBCOUNT DESC, s.STEPCOUNT;
| JOBCOUNT | STEPCOUNT | PROGNAME | VARIANT | BATCH_USER |
|---|---|---|---|---|
| 05000101 | 1 | RMMVRZ00 | &0000000000010 | (user ID) |
Result from a demo system.
12. When variant values and actual run values differ: SY-BATCH
Even if a variant holds a fixed year and month, a program that overwrites the date in batch runs for the current month every time. Check the program code, not only the variant values.
IF sy-batch IS NOT INITIAL. "only when running in background p_gjahr = sy-datum(4). "current year CONCATENATE '0' sy-datum+4(2) INTO p_perde. "current month (e.g. 010) ENDIF.
SY-BATCH is a system field that is filled when the program runs in background.
13. Fewer standard messages in the log: message control
Some standard messages written to the job log can have their type changed or be switched off in message control (OBA5). Whether a message can be changed is stored in table T100S.
SELECT m.ARBGB, m.MSGNR, m.TEXT,
s.MSGTA AS ALLOWED_TYPES, s.MSGTD AS DEFAULT_TYPE, s.XIGNO AS CAN_SWITCH_OFF
FROM T100 m
LEFT JOIN T100S s ON s.ARBGB = m.ARBGB AND s.MSGNR = m.MSGNR
WHERE m.SPRSL = 'E'
AND ( (m.ARBGB = 'KI' AND m.MSGNR = '339')
OR (m.ARBGB = 'CKPRCH' AND m.MSGNR = '019') );
| Message | T100S | Result |
|---|---|---|
| KI 339 Profit center was set to &1 | Allowed types S, I; default I; can be switched off: X | Can be changed in message control |
| CKPRCH 019 Price change document & posted | No entry | Cannot be switched off by settings |
Based on a demo system. Whether the message control setting also applies to the batch job log needs to be checked separately.
14. Running another program after this one
| Method | Setting | Note |
|---|---|---|
| Schedule as a successor job | SM36 new job → start condition "After job" → enter the predecessor job name | Whether it follows every run when the predecessor is periodic needs to be checked |
| Add a step to the same job | Add the program as step 2 of the existing job | Steps run in order within the same job |
15. Monthly check
| Step | What to do |
|---|---|
| 1 | SM37: part of the job name + user name * + today's date, then Execute |
| 2 | Check that the status is "Finished". If it is "Canceled", read the error message in the job log |
| 3 | Check the processed count in the program's result message near the end of the job log |
| 4 | Check that the next run's "Released" line exists (extend the end date, or query TBTCO) |
Korean version of this post: blog.naver.com/jeonnow/224428170551
Comments
Post a Comment