In S4HANA standard jobs are scheduled in a different way.
This wblog will answer the following questions:
- How to see then new standard jobs via transaction SJOBREPO?
- Where to find more information on more advanced functions?
- Which background OSS notes can I read on the S4HANA stand batch job repository?
Viewing the job repository
Start transaction SJOBREPO to view the job repository:
Use transaction SWF_JOBREPO_SLG1 to see logs of potential job issues.
To assign a standard user to job steps use transaction SJOBREPO_STEPUSER to set standard job step user:
Advanced functions in SJOBREPO
All the advanced configuration functions of the S4HANA job repository can be found as PDF attachment to OSS note 2190119 – Background information about S/4HANA technical job repository.
Background OSS notes
Useful background OSS notes:
2581518 – SAP_BASIS Jobs in the Technical Job Repository (SJOBREPO)
2318468 – S4TWL – JOB SCHEDULING
2822002 – How to manage S/4 HANA technical job repository via SAP BPA by Redwood: basically you cannot manage technical jobs via SAP BPA by Redwood.
This blog will explain how to debug a background batch program with real background mode (SY-BATCH is X).
Questions that will be answered are:
- How to debug a running job?
- How to debug a completed job?
Starting the debug mode for batch job
First we plan a single run of the batch job. In our example we run program RSWAITSEC which does nothing more than wait.
In SM37 show the job run:
Select the job and in the command line enter the background debug command JDBG:
Now the debugger starts first in the batch job part. Hit F7 a few time (F7 = jump back out of routine) until you reach the real program:
As you can see here the SY-BATCH variable is X, which means you are debugging with real background mode on.
SM50 background debugging
If you want to debug a running job, you have to goto SM50 and select the background process. Then choose the menu option Administration / Program / Debugging. Confirm the prompt:
Wait until the running SQL statement has completed and debug mode will start.
Please be very careful with this kind of debugging in a productive system.If you cancel the debug session there might be a rollback work statement triggered, which can cause database inconsistencies.
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 analyse 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?
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
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.
Result is shown correct working, number of batches and wait time:
Background job analysis tool
Start transaction ST13 and start tool BACKGROUND_JOB_ANALYSIS. Or directly start program /SSA/BTC.
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
Programs BTCTRNS1 and BTCTRNS2 can be used for mass forced stop and start of batch jobs. See this blog
for more details.
Batch job interception
For more information on batch job interception, please read this blog.
Ignoring large spool output of a batch job
In some cases a batch job will generate a large amount of spool output which is clogging the spool system, but is never used. In this case you can set up the job to put the output to output device NULL. For setup read this blog.
Check job step users
If you want to quickly check which user ID ‘s are use inside batch job steps, it is best to quickly go to table TBTCP. Here you can quickly see across many batch jobs which step users are used.
Debugging batch jobs
For debugging batch jobs, please read this dedicated blog.
Batch jobs full
If there are no batch processes free any more, you might see this screen in SM37:
When you face this situation check in SM66 if there are BTC processes available.
If you still face issues check OSS note
Deletion of batch jobs
Deletion of batch jobs is done via standard SAP program RSBTCDEL2.
Delay in batch jobs
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
Standard batch jobs in S4HANA
Standard batch jobs in S4HANA are planned via transaction SJOBREPO. For more details read the dedicated blog.
This blog will explain how to setup SAP batch job interception.
Questions that will be answered in this blog are:
- How to activate SAP batch job interception?
- How does an intercepted job look like?
Activating SAP batch job interception
Before you can begin the setup of the batch job interception you must run program INITXBP2 in SE38:
Next you have to start transaction CRIT and create the profiles.
First create the default SAP profile by clicking on the SAP logo. Activate it. Next step is to create the profile in which you want to do the interception. In the screen above click on the create profile button. Now enter a criteria. For simplicity we have called it interception. In our case we intercept all except a list of authorized users. In the user list we include the basis users and the background users (in this example WF-BATCH). Save the data.
Next step is to activate this profile:
Working of interception
When a batch job is planned the interception checks if the job should be intercepted or not. As a test logon as end user and launch a job. In our case the user ENDUSER tries to launch a job from SLG2 transaction to delete application logs. This jobs is intercepted ans shows like this in SM37:
The job does not start immediately, but shows in intercepted state. If user with release rights now goes to SM37 for this job, he can release the intercepted job.
This blog explains how to mass stop and mass start batch jobs as admin. This especially usefull putting the SAP system in maintenance mode. Maintenance mode can be needed for upgrade, support package patching or data conversion.
Questions that will be answered are:
- How to mass stop batch jobs?
- Can I plan new jobs I need during the suspend mode?
- How to mass start batch jobs again?
Stopping all batch jobs for maintenance mode
Stop all batch jobs: start transaction SE38 and start program BTCTRNS1.
All currently planned jobs will be put into a Released/Suspendeded mode:
This means the already planned jobs (periodically or not) will not be started.
During this suspend mode new jobs can be planned by admin. These new jobs will be executed.
Starting all batch jobs after end of maintenance
Start all batch jobs again: start transaction SE38 and start program BTCTRNS2.