Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 34

Background Job Processing

Background job is a non-interactive process that runs behind the normal interactive
operations. They run in parallel and do not disturb interactively (foreground jobs)
processes and operations
It is scheduled from SM36 You can analyze it from SM37 by viewing its job log.

O ADVANTAGES OF BACKGROUND JOBS


• It reduces manual effort & automates the task.
• It can be scheduled as per the user's choice.
• It reduces user interaction and can run seamlessly in the background without user
input
• Once you define the variant for the background job, the user doesn't have to worry
about value input in the field. Thus, user confusion is also reduced.
• Ideal for time-consuming/resource-intensive programs which can be scheduled to run
at the night (when the system load is low).

Background jobs are classified into three categories

Class A (High/critical Priority): - Some tasks are urgent or critical and must be
scheduled with class A priority job. Class A priority reserves one or more
background work processes. Users have to decide how many background
work processes should be assigned to Class A priority jobs. Suppose a user
chooses 2 background work processes for this category than available
background work processes for class B and C = (Total number of work
processes set in operation modes RZ03)- (Background work processes
allowed to class A category).

Class B(Medium Priority): - Once Class Jobs are completed, Class B jobs will start
executing in the background before class C jobs.

Class C(Low Priority): -It runs after both class A and class B jobs are completed.

Status of Background jobs

Scheduled:- You have defined the program name and variant but not
defined start conditions like Start Date, End Date, Frequency, etc. That
means you have not defined when a job should be scheduled in the
system.

Released:-All required criteria are fulfilled for the job definition. The start condition is a
must for the job to be in release status.
Ready:- All the required conditions are met to run the job in a background work
process. But the job scheduler has put the job in the queue because it is waiting for the
background work process to be free.

Active:- Job has started running in the background. We cannot change


the status of the job once it is in Active Status.

Finished:- Job is executed successfully . It means the desired task is completed


without any error.

Cancelled:- There are two possibilities for


this. The Administrator has forcefully canceled the job or there might be some issue with
the job. You can investigate this from Job logs.

How to schedule the background job?

You can schedule the background job using SM36. Planned or immediate jobs can be
scheduled.

Step 1) Execute T-code SM36.

Ste
p 2) Fill in the job name, priority{A/B/C) and the target server. Background jobs
once scheduled on a target server run on that server. The main purpose of
defining the target server is workload balancing.
Step 3) Click on "spool list recipient". You will get output in your mailbox. You can
check email from SBWP.

Step 4) Insert your SAP username and click the copy button

Step 5) Click Step button to define ABAP program, variant's details, etc

Step 6) Define program name, and variant details.


1. Enter your program name, Variant name in the field. If you have not created a
variant as per your requirement, then leave it blank.
2. Press the save button.
Step 7) Once you schedule the job you will get the following screen.

Step 8) Click Start conditions to fill start date, end date, frequency, etc for the job. If
you do not specify the start condition the job will always remain in the scheduled
status. A job in scheduled status will never run.

1. Click on Date/Time(For periodic jobs). If you click "Immediate" then the job will
start running right away. But it will not be set as a periodic job. It’s like "press and
run."
2. Define job 1s start date/time ,end date/time. The job will be released only
once it meets its Scheduled start date/time.
3. Press periodic values.
Step 9) Click on Hourly/Daily/Weekly period to define the frequency of the job as per
your requirement. We will select Other Period.

Step 10) Here you specify the recurring criteria of the job. For example, You can
have the Job run after every 5 days from the Start Date. Here we select a job to run
every 10 minutes.
Step 11) Click on the save button.

Step 12) Click on save again.


Step 13) Click save again.

Step 14) Once Job step and start conditions are defined the following window will
appear.

Step 15) Press save

.
Step 16) Goto SM37 to know the status of the job.

Step 17) Select your criteria for the job which you want to monitor.

1. Put your job name and username who scheduled the job.
2. Select the status of the job.
3. Specify the date range. In our scenario, we just specify the end date while
keeping From Date Open.

Step 18) You will get the following screen. Look at the status, it's a released means
start conditions are met, and the job is in the queue is waiting
for the background work process to be free.
How to Reschedule a background job

Rescheduled jobs will not run in the future. Remember, you cannot reschedule the
job once it's in active status.

Step 1) Execute SM37.

Step 2) Fill out the criteria.

1. Job name and username by which job is scheduled.


2. Select the status. To reschedule the job you can only select Released/Ready
status.
3. Specify the date range.
4. Press Execute(F8) button.
Step 3) Select a specified job and press Job ->
(Released -> Scheduled).

Step 4) You will find the message in the status bar once you press "Released ->
Scheduled".

SAP SM37: How to Monitor a Background Job

Monitoring background job is important because once you schedule the job it might be
canceled due to some error. To investigate the root cause use SM37.

Step 1) Execute T-code SM37


Step 2) Fill the required criteria.

1. Job name and username(who scheduled the job). You can put * to get details of all
jobs scheduled by all the users.
2. Select job status which you want to monitor. If you find that a background job is not
completed, select Canceled status.
3. Put the date range as per your requirement.

Step 3) You will get a screen as shown below.

Step 4) Click on Job Log button to trace the error due to which job was canceled

Step 5) You will get the following details. In the below example, job was canceled since there
was an issue with RFC connection to the remote system. As a resolution use SM59 to check
if there is an authorization issue to the remote system.
Sometimes jobs in Active status may also cause an issue.

You may face issues like tablespaces are full; the duplicate job is running with the same
name and timing, the job is selecting or updating large data, etc.
You can also check such jobs from SM37. Follow the procedure below
Step 1) Execute SM37.

Step 2) Fill in the required criteria.


1. Job name and username(by which job is scheduled).
2. Select the job status which you want to monitor. If you find a system performance
issue or if a task is not completed for a very long time, then select active status.
3. Put the date range as per your requirement

Step 3) Look into the Duration column (which signifies the job is running for n seconds). If
you find a large number in duration then investigate the job details from the job log. Some
jobs use a large number of data. Using SE16 check table entries for the tables used by the
job.

Sometimes jobs show to be in Active Status even though they are completed.

How do correct them? Follow the below set of procedures -

Step 1) As shown above, Execute T-code SM37 and select the job with an active status.
Step 2) Select the active job which is causing the problem.
Step 3) Click the Job->Check the status

Step 4) In the status bar of the window you will find as below message. This will repair Job
Status if there was a problem.

Step 5) If still job is in running status


then go to SM50. The below screen will open. Have a look at the "Reason" column which
shows any errors or exceptional issues. Investigate it further.
Interview question and answer for Background jobs / Known issues / Reasons for
cancellation of SAP Job

What are the categories to execute SAP Background jobs?

A: Class A (High Priority) — This is used for urgent or critical tasks. These tasks must be
scheduled with class A priority job. Class A job reserves one or more background work
processes.
Class B (Medium Priority) — These jobs are executed after the completion of Class A high-
priority jobs.

Class C (Low Priority) — These jobs run once class A and class B jobs are completed.

What are the different options available for scheduling a background job? What start
conditions type can be used?

A: To schedule a background job you must specify the conditions that will trigger the job to
start. The different types of start conditions you want to use are:
 Immediate
 Date/Time
 After Job
 After Event
 At Operation Mode.

What are the different types of job status? Can you unschedule an active job?

A: The different types of status are –


Scheduled, Released, Ready, Active, Finished, and Cancelled You can’t unschedule a job if it
is active. You need to wait for the completion of the job to unscheduled it.

What is the use of commit value while deleting jobs in SAP system?

A: Commit value is proportional to program performance. If the commit value is high, then
job deletion will run faster. Recommended value is >= 1000.

Can I reserve background work processes for individual applications or users?


A: No. Reservation is only possible for job class A

Can I assign priorities (job classes) in the function modules 'JOB_OPEN', 'JOB_SUBMIT',
and 'JOB_CLOSE'?

A: No. If jobs of class A or B must be scheduled automatically, you can do this as follows:
You schedule a job of the required class and set it to start periodically.

Can I influence the priority of the jobs, regardless of the job class?

A: In distributed systems via a well-designed distribution on the servers - see Note


24092.

Can I save job logs in the database (analogously to the spool)?

A: There is no such option in the standard.

What happens if the background work process needs to be switched and a job is
running in that work process?

A: The instance kernel waits for the job to finish before the background workprocess is
switched to an alternate type. Jobs are never terminated by the R/3 system to make way for
an op-mode switch.

Can job definitions be transported into other clients or systems?

A: No. Job definitions contain system specific parameters (target host, user, program,
operation mode, ...). Therefore it wouldn't make sense to develop a transport tool. .

For similar reasons, copying a job across clients is not foreseen. The following trick,
however, is possible: Login to the target client (the one, where the job is to be copied to).
The user must have job administrator authorizations. Then using transaction SM37 all jobs
in all clients can be displayed. With the "Job > Copy" option a job can now be copied from
the source client (only steps, no start time).

Does the user receive a message if their job is canceled?

A: No, but as of Release 4.x, canceled jobs can trigger an alert in RZ20 which allows you to
react correspondingly.
How can I set that a periodic job is to be deleted after a maximum waiting time?

Example: A job is to run every 15 minutes after 08:00 hours. Automatic deletion is to apply
for each of these jobs if it has to wait more than 20 minutes for execution.

A: Schedule the job with the following parameters: Start time 08:00 hours, No start after
08:20 hours, period 15 minutes. For each job, move the earliest and latest start time by 15
minutes in each case.

How can I set that a periodic job no longer runs as of a certain date?

A: This is not provided in the standard system. It can, however, be implemented with the
function modules 'JOB_OPEN', 'JOB_SUBMIT' and 'JOB_CLOSE' (see Note 4751).

Can I restrict the number of jobs that a user can schedule in order to avoid that a single
user uses all work processes?

A: No, a user can either schedule/releases job or he cannot.

What do I do if an error occurs?

A: See Note 37104

What are the house keeping jobs in sap basis?

A: SAP_REORG_JOBS - RSBTCDEL - Deletes old background jobs.


SAP_REORG_SPOOL - RSPO0041 - Daily Deletes old spool requests.
SAP_REORG_BATCHINPUT - RSBDCREO - Deletes old batch input sessions.
SAP_REORG_ABAPDUMPS - RSSNAPDL - Daily Deletes old dumps produced by ABAP
abnormal terminations
SAP_REORG_JOBSTATISTIC - RSBPSTDE - Monthly Deletes job statistics for jobs not run
since the specified date
SAP_REORG_UPDATERECORDS - RSM13002 - Daily Deletes old completed update
records
SAP_COLLECTOR_FOR_JOBSTATISTIC - RSBPCOLL - Daily Generates runtime statistics
for background jobs
SAP_COLLECTOR_FOR_PERFMONITOR - RSCOLL00 - Hourly Collects system
performance statistics.
What is a background processing batch scheduler?
A : To check the schedule background jobs and to execute them parameters like
rdisp/btctime is used. These parameters define background processing batch scheduler.

Name the phases of background that are processing in SAP?

A: Job Scheduling
Job Processing
Job Overview.

Mention the various categories which help in executing SAP Background jobs.

A: The categories are as follows –


Class A – High Priority: This category is mainly used for very critical and urgent tasks.
Hence, these tasks also get scheduled with class A priority job. Maybe one or more than
that background work process gets reserved by a Class A job.
Class B – Medium Priority: After the Class, A priority jobs get completed, these types of jobs
get executed.
Class C – Low Priority: After the completion of jobs of classes A and B, the job of class C
gets started.

Mention the options or condition types available for a background job to be scheduled.

A: The conditions must be specified in order for the background job to be started. This is
said to trigger the start of the job. The following are the different kinds of start conditions
that are to be used in order for the background job to be started –

Immediate
After Job
Date/Time
After Event
At Operation Mode.

What Are The States Of Back Ground Job ?


A:6 states
Scheduled
Ready
Released
Active
Finished
Cancelled.

Is It Safe To Delete Old Background Jobs Using The Program Rsbtcdel While Users Are
Working In The Prd Server?

A:Yes. It is safe to run this program while users are working since this only deletes jobs that
were completed or aborted, not active jobs.

Will A Client Copy Transfer The Background Job Schedules And All Client Dependent
Data?

A : SAP_ALL will copy all client-dependent data including schedules to the new client.
Remember that ABAP programs are always client-independent. Only the master data
(variant) is client-dependent.

Known issues / Reasons for cancellation of SAP Job.

1. User and password Issues (Authentication/ Authorization) user lock, userid expiry,
password change, lack of roles etc.
2. File system problems: BTC reads from the file system to update the database. File not
opened, or corrupted, file sharing issues, file came with different characters, file not found
as well.
3. Variants are not properly defined.
4. Deadlocks issue (Lock mechanism congested)
5. Update mechanism failed
6. Table space overflow (ORA-1653; ORA-1654)
7. Table space max extent reached (ORA-1631; ORA-1632)
8. Archive struck (ORA-255; ORA-272)
9. The memory is not sufficient and errors
(No Roll Area, PXA (Buffer), Page Errors)
10. Problem in the program and inputs (Indefinite loops like 1/0)
11. Dependent jobs/ events failure
12. Target systems are not available to process the jobs.

In real-time, we may face several scenarios like


i) Background job is processing slow
ii) ABAP program is taking a long time to complete execution
iii) Log_dir is getting full very fast

In the above cases, the Basis team should closely work with database teams and may have
to identify the reasons behind them to resolve the issues.

Example1: If a background job (or an ABAP program) is taking more time to complete, one
of the reasons could be statistics for underlying database tables that this job is accessing
were not up to date. We may have to run statistics to fix the performance issue.
Here we need to know which database table(s) is/are being accessed by job/ABAP program.

Example2: If a background job is running for a long duration and log_dir at the Operating
System level is reaching very high levels (ex: crossing 60% usage), then the reason could be
there is an issue with the underlying ABAP program. If single or multiple processes run for a
long time without committing work to the database, log hold-up will happen and log_dir
usage will increase. If it crosses 70%, the SAP system will face performance issues and if it
reaches 100%, the system wouldn’t be accessible.

To resolve this issue, developers need to modify ABAP program & make sure there are
frequent commit statements. In this case also, database team may request us to provide list
of tables that are being accessed by this job or program.

So, in this article, I’m covering the process of identifying database tables that are being
accessed by an ABAP program or a background job.
First of all, I will cover the process of identifying the underlying ABAP program for a given
background job. Let us say you want to identify, an underlying program for SAP standard
job BI_WRITE_PROT_TO_APPLLOG.
Goto SM37 transaction code and provide name of the job you would like to find abap
program for and execute the same:
It results in below screen:

In the above screen, select the job and click on step icon (highlighted) which results in
below screen

RSBATCH_WRITE_PROT_TO_APPLLOG is the underlying ABAP program for the given


background job BI_WRITE_PROT_TO_APPLLOG. Similarly, we can identify the program
for any background job.

Now, our next task is to identify database tables that are being accessed by the
RSBATCH_WRITE_PROT_TO_APPLLOG program or BI_WRITE_PROT_TO_APPLLOG job.

Go to SE38 transaction and provide the 722program name:


In the same screen, navigate to Utilities -> Environment Analysis as shown below

It will result in below screen.


As we need only database tables, please deselect all ticked options by clicking
highlighted icon and select only database table check box and execute (as shown below).
It will result in below screen, which lists the database tables that are being accessed by
this program.

This is the process to identify database tables for a given background job or an ABAP
program

How to prevent SAP background jobs from running?


If the background job in SAP is in released state, it will run at the mentioned time or when
respective event occurs (as per the job definition). If for any reason, you would like to hold the
job(s) from execution, you can do the same using SM37 transaction.
In real time scenarios, you may need to hold few jobs from execution like

After system refresh, you may have to hold jobs from execution in target system because the target
system consists of source system jobs and they shouldn’t run. So, it is suggested to hold all the jobs
from execution and release only required jobs and basis standard jobs(housekeeping jobs)
Sometimes, there might be duplicate schedule of same job and you want to hold the duplicate job
to prevent multiple executions
In these cases, to hold the jobs to prevent from execution, we need to set the status of
those jobs from “Released” to “Scheduled”. To do the same, we have login to SAP
system and go to transaction SM37 which will result in below screen.

In the above screen, select the job status as “Released” and keep all other options as
shown above and execute. This will list down all the released status jobs.

From the list, select tick those jobs that you would like to prevent from execution and
change the status from “Released to Scheduled” as shown below:
Then all the selected jobs status will be set as “Scheduled” and those jobs won’t get
executed till you release them again.

How to identify ABAP program for a given background job?

Sometimes, it is required to know the underlying ABAP program name for a background
job.
This can be identified as shown below:

Goto SM37 transaction code. It will result in below screen. Please input job name for
which you would like to know the underlying ABAP program.
After selecting necessary job status, click on execute which results in below screen

Double click on the above job name to display job details as shown below
Click on step icon (highlighted) which shows the step list overview (as shown in below
screen)

Highlighted item is the underlying program name/command.


Parameters is the variant for that program and User is the “user id” with which this job
will be executed.

Note: Sometimes, we can view multiple programs as steps based on the Job definition
done. In other words, a job can have multiple programs or commands as steps
A background job can have the following statuses :

Scheduled : This means that the steps that are required to make up the job are already
completed but the start condition is not yet specified.

Released : This means that all the steps that are required to make up the job including start
condition are defined. A job cannot be released without a start condition. A job can be
released only by the administrator or by the user who has proper authorizations.

Ready : This means that the job is ready for execution. It is kept in the wait queue by the job
scheduler and is waiting for the next free background workprocess to assign the same.

Active : This means that the job is currently active. In this state, job cannot be deleted or
modified.

If the active job is not running correctly, either it can be terminated or it can be canceled in
a background workprocess in debugging mode, analyse it and can be released again.

How to capture a background job ?

Goto SM37 transaction and navigate to Jobs -> Capture active job to capture the job. Once
the job is captured , analyse the same and you can release it again.
Please note that you should be in the application server on which the job is running to
capture a job. Otherwise, you cannot capture it.
How to terminate a background job ?

Goto SM37 and list all the jobs that are active between some time interval.
Once it listed the active jobs, identify the job that is to be deleted. Then navigate to Job ->
Cancel Active job and cancel the job.

Finished: The execution of the job has been completed successfully

Canceled: The job got aborted or canceled. This can happen for 2 reasons.

 One of the job step is terminated with an error


 An administrator has deliberately terminated the job due to various reasons like
running unusually for a long time
 How to schedule Basis standard jobs ?

 Goto transaction SM36 and click on "standard jobs" pushbutton. This inturn displays
standard jobs screen. Here select all the jobs and click on "default scheduling"
push button to schedule all of them as per their default schedule.


In case you would like to change the default schedule for each job, it can also be done by
selecting each job and defining its start date/time and periodicity in the same screen.

What is the need of scheduling basis standard jobs ?

Standard jobs are the jobs that should run regularly in the SAP system. These jobs will
perform housekeeping like deleting old spool requests (thus avoiding spool overflow),
deleting old background jobs/logs/updates/batch input sessions/ABAP short dumps,
collecting operating system/database level statistics (used for workload reporting) etc

What are the Standard jobs that should run in an SAP system & their significance ?

SAP_CCMS_MONI_BATCH_DP : Internally this job runs


RSAL_BATCH_TOOL_DISPATCHING report. This job dispatches monitoring architecture
methods

SAP_COLLECTOR_FOR_JOBSTATISTIC : Internally this job runs RSBPCOLL report. This


job generates run time statistics for background jobs

SAP_COLLECTOR_FOR_PERFMONITOR : Internally this job runs RSCOLL00 report. This


job collects data for the performance monitor

SAP_COLLECTOR_FOR_NONE_R3_STAT : Internally this job runs


RSN3_STAT_COLLECTOR report. This job will collect non-abap statistic data (Distributed
Statistic Records - DSR)

SAP_REORG_ABAP_DUMPS : Internally this job runs RSSNAPDL report. This job cleans up
old abap short dumps

SAP_REORG_BATCH_INPUT : Internally this job runs RSBDCREO report. This job cleans up
old batch input sessions

SAP_REORG_JOBS : Internally this job runs RSBTCDEL report. This job cleans up old
background jobs

SAP_REORG_JOBSTATIC : Internally this job runs RSBPSTDE report. This job cleans up old
data from the run time statistics of the jobs

SAP_REORG_ORPHANED_JOBLOGS : Internally this job runs RSTS0024 report. This job


cleans up orphaned job logs. The logs that cannot be deleted by RSBTCDEL report (i.e
SAP_REORG_JOBS), remains as orphans which will be deleted by this job.

SAP_REORG_SPOOL : This job internally runs RSPO0041 report. This job deletes old spool
data

SAP_REORG_XMILOG : This job internally runs RSXMILOGREORG. This job deletes XMI
logs

SAP_SOAP_RUNTIME_MANAGEMENT : This job internally runs RSWSMANAGEMENT


report. This job does the SOAP runtime monitoring

SAP_REORG_UPDATERECORDS : This job internally runs RSM13002 report and this


deletes old update records.
How to find out long running jobs in SAP ?

Goto SM37 transaction and select the active job status between any 2 given date/time and
list them. In the output, sort the jobs based on duration column in descending order and
identify the jobs that are running for longer duration

All other questions can be answered from the below :

Goto transaction SM37 and list the jobs based on status and time interval.

Select any job for which you want to figure out the details. Double click on the job, which
pops up "display job screen". In that screen, click on job details tab to view

 Job name
 Job class (i.e A, B and C)
 Status of the job
 Exec. Target (server/instance on which job is being run currently)
 Job frequency (hourly, monthly , weekly etc)
 Workprocess that is executing the job
 Client on which job is running
 Release time of the job
 Schedule start of the job

You might also like