Batch jobs tips & tricks

This blog will give tips and tricks on batch jobs.

Questions that will be answered are:

  • How to check a job is not running already before starting new one?
  • How to build in a wait step into a batch job?
  • How to set the RV variables automatically in table TVARVC?
  • How to validate that the basic batch job system is working ok?
  • How to analyze the jobs running in my system?
  • How to mass stop and start batch jobs?
  • How to set up batch job interception?
  • How to ignore large spool output of batch jobs?
  • How to see the batch job delay timing?
  • How to plan standard jobs in S4HANA?
  • How do I set up batch job server groups?
  • How can I mail the spool of a batch job?
  • How can I mail if job was successful or not?
  • How to check the consistency of the batch job tables and how to repair?
  • How can I archive a print list?
  • How can I archive a job log?
  • How can I get job statistics?
  • How to read content from batch job variants?
  • How to find batch jobs with deleted or locked step users?
  • How to debug a batch job?
  • How to find who deleted a batch job?
  • How to check in case of batch job delay?
  • How to quickly check health of batch job scheduler?
  • How to trigger batch job event?

SAP FAQ note on background jobs

SAP has FAQ note on background jobs: 3008195 – FAQ: Background Processing BC-CCM-BTC-*.

Prevention of same job still running

If you want to prevent same job from starting, while a previous instance is still running, you need to add program RSBTONEJOB or RSBTONEJOB2 as first step in the batch job. This step will detect if the previous instance is still running and abort to avoid the next steps from being executed. More background in OSS note 557610. The scope of both programs is in principle limited to be used for idocs and CUA. To extend the scope or in case of issues, read the instructions in note 3225033 – Behavior of program RSBTONEJOB, RSBTONEJOB2 not as expected.

Forcing a batch program to wait

If for some reason you need a batch program to wait between steps, you can use program RSWAITSEC as a step. This program will only do a wait for x amount of seconds.

Setting current date in the TVARVC table for the RV variables

The RV variables for current date, month and year are often used in month end closing batch jobs. Running program RVSETDAT will set the current dates for RV TVARC variables.

Checking basis background job system settings and working

If you want to validate if the background job system function itself is working properly, start transaction SM65 background processing analysis tool.

SM65 start screen

Result is shown correct working, number of batches and wait time:

SM65 result screen

Bug fixes for SM65:

Background job analysis tool

Start transaction ST13 and start tool BACKGROUND_JOB_ANALYSIS. Or directly start program /SSA/BTC.

Batch job analysis tool

Pending on your selection you get a graphical overview or a full list for you to speed up your analysis.

Mass stop and start of batch jobs

Also check this note for clean up of BTCDELAY table: 3222291 – Superfluos Entries in BTCDELAY Table.

In some cases you might want to find out who manually deleted a batch job.

Unfortunately you first need to activate the logging via program BTCAUX06:

To view job deletions you need to go to transaction SM51, menu option Goto, Trace, Instance Trace, Search Trace. Then look for pattern BP_JOB_DELETE.

More information in OSS note 850885 – Logging the deletion of jobs and 3325374 – How to log job deleted in Background Processing.

A batch job is not started immediately, but with a delay. This delay is set via RZ11 parameter rdisp/btctime and default setting is 60 seconds. More information can be found in OSS note 923228 – Background job scheduler: Use of processes that have become free.

See new note 3236046 – Test report for immediate start for program BTCAUX25 that will test immediate start.

Standard batch jobs in S4HANA

Standard batch jobs in S4HANA are planned via transaction SJOBREPO. For more details read the dedicated blog.

Batch job server groups

If you have a large production system with many application servers you can setup batch job server groups to have batch jobs run on a set of dedicated application servers. To set up batch job server groups start transaction SM61 and click the button Job server groups:

Job server groups

Here you can define the job server group and assign application servers to them. Background is in OSS note 612838 – Administration of job server groups.

job statistics

This gives statistical output:

Job statistics output

Batch jobs with deleted or locked step users

If a batch job step user is locked or deleted, that step will fail. To find such batch jobs, follow the steps as described in this blog.

Batch job delay

Batch job delay can be set with parameter rdisp/btctime. Default is 60 seconds.

See also OSS notes 3080021 – Jobs are started with delay and 3148846 – Background Jobs with status “No free batch work processes available”.

And these notes:

3275278 – Background jobs are started with delay / 3355049 – Correction for Note 3275278.

How to read content from batch job variants

In quite some cases the basis team is asked: in which batch job variant is this company code XXXX used? Or we need to add another sales organization to all the batch jobs, can you provide us a list with jobs using sales organization YYYY? How to get this data is answered in this dedicated blog.

How to check health of batch job scheduler

Start transaction SM61. Now select the Time-Driven scheduler. Select the server and choose the health check tab. Now press the check button:

Batch job event triggers

Batch jobs can also be triggered using events. Read more in this blog on batch job event triggers.

Batch job monitoring

Batch job monitoring can be done with SAP Focused Run. Read more in this blog.

Background OSS notes

3008195 – FAQ: Background Processing BC-CCM-BTC-*

S4HANA readiness check 2.0

SAP has released the S4HANA readiness check 2.0.

This blog will answer the following questions:

  • How to install S4HANA readiness check 2.0?
  • How to run the S4HANA readiness check 2.0?
  • How to see the results for the S4HANA readiness check 2.0?
  • Where to find more background information on the SAP readiness check 2.0?

How to install S4HANA readiness check 2.0?

SAP OSS note 2758146 – SAP Readiness Check 2.0 & Next Generation SAP Business Scenario Recommendations and 2913617 – SAP Readiness Check 2.0 contain all the installation instructions.

Short sequence of steps:

  1. de-implement OSS note 2310438 – SAP Readiness Check for SAP S/4HANA – Managed System if it was applied
  2. Implement OSS note 2745851 – Business Process Improvement Content for SAP Readiness Check 2.0 and Next Generation SAP Business Scenario Recommendations
  3. Update or implement OSS note 2185390 – Custom Code Analyzer
  4. Update or implement OSS note 1872170 – ABAP on HANA sizing report (S/4HANA, Suite on HANA…)
  5. Update or implement OSS note 2399707 – Simplification Item Check
  6. Implement OSS note 2769657 – Interface Discovery for IDoc as part of Readiness Check
  7. Implement OSS note 2612179 – DVM API to trigger and monitor DVM ST14 analyses for Readiness Check
  8. Implement OSS note 2972792 – Financial Data Quality: Trigger Data Collection Reports to Check Your Financial Data Quality and to Enable the Financial Data Quality Check in SAP Readiness Check
  9. Implement OSS note 2903677 – SAP Readiness Check: Effort Drivers of Simplification Items Check
  10. Implement OSS note 3010669 – Enhancements to SAP Readiness Check Dashboard for Business Partner/CVI
  11. Implement OSS note 2758146 itself

Next to these notes, if you are using ATC, it is wise to also apply OSS note 2781766 – Enabling ATC check result export for SAP Readiness Check 2.0.

Also apply the notes mentioned in OSS note 3061414 – Enabling extended integration impact analysis for SAP Readiness Check, if you want to include ALE scenario’s in your analysis.

As you can see from the list of OSS notes there are improvements in the area of idocs, data volume management and business process analysis.

For this reason SAP recommends to run the S4HANA readiness tool on productive system.

It is possible to run on a recent copy, provided you copy the ST03N data from production to the recent copy. This process is described in OSS note 2568736 – SAP Readiness Check for SAP S/4HANA – copy ST03N data.

Troubleshooting guide is OSS note 2968380 – SAP Readiness Check Report 2.0 – troubleshooting guide.

Other notes to check:

Run S4HANA readiness check 2.0

There are 2 data analysis programs to run: SYCM_DOWNLOAD_REPOSITORY_INFO and RC_COLLECT_ANALYSIS_DATA.

First you run SYCM_DOWNLOAD_REPOSITORY_INFO on development system to fetch information about your Z coding:

The tool will launch batch job. After job is done download the zipfile to your local PC.

If you are asked to regenerate the ABAP indexes run program SAPRSEUC in the background and be very patient. See blog on ABAP where used index for more background information. See also OSS note 2655768 - Custom Code Analyzer - The where-used list index for customer objects is not up to date.

Second program you need to run on production. So you first need to transport all the notes to production. The notes are large and can take up to 20 minutes import time. So take a quiet time at the productive system to import them.

Start program RC_COLLECT_ANALYSIS_DATA in your productive system:

Select your target version and press execute. This will launch multiple batch jobs. Wait for all the jobs to finish and start program again to download the ZIP file to your PC.

CVI integration

As explained in OSS note 3071549 – Buttons in the report RC_COLLECT_ANALYSIS_DATA the report RC_COLLECT_ANALYSIS_DATA now has a link to the CVI integration (customer vendor).

Data profiling

More information the data profiling done by the readiness check can be found in OSS note 3112362 – SAP Readiness Check for SAP ERP Usage and Data Profiling.

Uploading the data

SAP OSS note 2758146 – SAP Readiness Check 2.0 & Next Generation SAP Business Scenario Recommendations contains the upload URL. The current URL is http://rc.cfapps.eu10.hana.ondemand.com .

Hit the start New Analysis button and upload the file from the RC_COLLECT_ANALYSIS_DATA program. Wait for the SAP site to finish the analysis. It will be visible on the site as Recent Analysis.

Don’t forget to push the update analysis button to upload the second file with the custom code analysis from program SYCM_DOWNLOAD_REPOSITORY_INFO.

The results

Now you can start to enjoy the results:

You can use the settings button to allow more people to view the analysis results.

New functions

SAP keeps on improving the readiness check 2.0. The new features are published in SAP blog.

Background information

More background information can be found at:

More S4HANA conversion preparation steps

For more S4HANA conversion preparation steps, read this blog.

Table logging

Table logging captures all table changes. This blog will answer the following questions:

  • How to activate table logging in general?
  • How to check if for specific table the logging is active?
  • How to check table changes for a specific customizing action?
  • How to check general table change?
  • How to delete table logging?
  • When not to use table logging?
  • How can I review table logging for audit purposes?

Table logging activation

In RZ11 system parameter Rec/Client determines the table logging for the complete system. Make sure the value is set to ALL.

See also OSS note 2437986 – SCU3 | How to enable logging in the system. And explanation note 3000730 – Impact on enabling table logging with profile parameter rec/client.

As of new S4HANA 2021 installations or upgrades the activation is done by default: 3093760 – Table Data Change Logs In ABAP Platform.

Table logging per table

In transaction SE11 enter the table you want to check and then go to the technical settings. As example table T000:

SE11 technical settings table logging

At the section Data Changes you can see that Log Changes has been activated.

Mandatory table logging

In OSS note 112388 – Tables with obligatory logging the mandatory table logging is explained. Which tables are logged is explained in OSS note 2543478 – SCU3 | Which tables are logged?.

How to view table changes?

The common way to view table changes is via transaction SCU3. At the start screen press the button analyze logs:

In the next selection screen enter the table to analyze. In this example we analyze table T000:

T000 table changes

Make sure to set the radio button to Tables. Output of the changes to table T000 then looks as follows:

T000 table changes output

Here you can see changes done by user ILLEGALUSER. At which date and time they were done, and the old and new value.

See also OSS note: 3311577 – SCU3 | How to find out, if table change logs exists for a specific time interval.

Bug fixes:

Checking table changes from customizing

If you are in a customizing action and you want to see who did perform changes, select the menu Utilities and then option Change Log. Select date and time frame to analyze and press Execute. As example here changes to Plant Definition (table T001W):

T001w changes

See also OSS note 3195801 – SPRO | SM30 | How to check the result of a customizing transport and 1834956 – SCU3 | How to enable logging for importing to the system via tp (or R3trans).

Custom tables and standard SAP tables

By default a lot of SAP configuration and important setting tables have the log changes activated. But not all. It is not uncommon to activate table logging for standard SAP configuration tables important for your business. For important custom configuration Z tables you might want to activate table logging.

Table logging is not a replacement for change documents. Standard SAP generates change documents for changes to documents that must be kept for tracking and audit purposes. This is common for all major transnational objects and its underlying tables. That is why for example for an important table like VBAK (sales order header) the table logging is off: change documents are already generated.

It is very bad practice to make use of table logging for business data reasons. Table logging is used for recording changes to configuration and if all theses logs are deleted there should be no business impact.

Background OSS note: 3153906 – SCU3 | How to enable logging for tables in customer name space.

Deletion of table logging

Table logging can be deleted with transaction SLG2.

Make sure only very limited amount of people have access to SLG2 and the below program SBAL_DELETE.

SLG2 can run for a long time. For background read OSS note 2507213 – SBAL_DELETE runs too long

Please be aware the deletion is cross client! See OSS note 3000914 – SCU3 | RSTBPDEL | Caution: The table is cross-client.

Other bug fix notes:

Review of table logging for audit

OSS note 112388 – SAP system audit | Tables requiring logging explains the audit relevance of table logging and explanation about program RDDPRCHK.

Table logging can be reviewed with program RDDPRCHK:

Bug fixes for RDDPRCHK:

SAT ABAP runtime analysis for ABAP web applications

SAT ABAP runtime analysis is a great tool for analyzing performance issues. This tool can also be used to analyze ABAP web dynpro and FIORI applications. For more background on SAT tool itself, read this blog.

Questions that will be answered in this blog are:

  • How to run SAT tool for ABAP web applications?

Running SAT tool for ABAP web applications

Start transaction SAT, and press the button Schedule in the block For User/Service.

You now reach the measurement overview screen:

Now select the Schedule Measurement button. In the next screen fill out the user to trace and very important: switch the object type to URL and process type to HTTP:

Do not press the schedule measurement button yet. First go to the ABAP web application to the part you want to measure for performance. Afterwards delete the browser, since it will keep on sending data.

No you have to go back to the SAT start screen and click on the tab Evaluate:

Double click on your measurement line. The system will now read the measurement log files and process them. This can take some time. The end result screen looks again like a normal SAT result screen: