Background Processing on SAP
Background Processing on SAP
The background jobs can be scheduled in SM36 and can be monitored in SM37. To
define a job, go to SM36, give the job name and now start to add steps by clicking
on Steps button. Steps are the small tasks which run simultaneously in one
background job. The steps can be an ABAP Program, External Command or External
Program. First, we have to enter the User name for every step of background job.
Now if we want to define an ABAP program, give the program name and variant (if
required).
Variants:- There are some selections in program which needs to be done like in the
program RSPO0041, we can select some options like files older than how many days
should be deleted or all the completed requests should be deleted or we can select
any other criteria. These selections can be done by defining variants in the
program. We can create as many variants as we want from the program change mode in
SE38. We can give these defined variants at the time of defining ABAP program as
steps. In other words, we can say that variant is like WHERE clause in the query in
which you can define many conditions for the query like date, status, etc.
Variants are optional for programs.
For external commands, you can select the commands which should have already been
defined in SM49 or SM69. You can give the parameters of commands in the field and
target server also.
And external programs are direct operating system commands which you can use to run
in background. For eg. ps –ef or something similar to that.
After adding the steps, we can use print commands by clicking on Print
Specifications button. Here, we have to give the output device name and number of
copies. We can either generate only spool request or we can generate output
requests also at the same time. Only spool requests are not printed, we can just
see in SP01. Now save the job. The job is now scheduled but not released as the
start time is not defined.
We can define the job start time on the basis of 2 options. Time controlled or
event controlled. In time controlled, we can define any time we want to run the job
and in event based, we can select the event after which the job should start in
background.
Job Start time can be defined from SM36 by clicking on Start Condition Button.
There will be 5 options.
a) Immediate – means to start the job at that time only
b) Date/Time – here we can define the exact time and date. There is one optional
field of No Start After. This field is used when suppose there is some time-
critical job which should be executed in between some time and not after that time
and there was no background work process available at the starting time of job. For
that, we can give the date and time in No Start After field which prevents the job
to run after that specified time.
We can also specify a periodic value for the jobs which needs to run frequently.
The available options are Hourly, Daily, Weekly, Monthly or any other time like
every 2 minutes, every 2 hours and so on. We can also put restrictions like to not
run on sunday or holiday by clicking on Restrictions button. In that case we have
to provide the calendar id in Calendar field.
c) After Job – if some jobs are dependent on other job or needs to get other
jobs completed, we can use this option.
d) After Event – We can give an event, so that when that event is triggered, the
job starts.
e) At Operation Mode – At the time of mode switching, the job is started
automatically.
In SAP, some jobs are necessary to run which is known as Standard Jobs. We can
automatically schedule all the standard jobs by clicking on Standard Jobs button in
SM36. We have to perform this task after new installation of SAP system.
Copy Jobs
Some jobs can be similar to already defined jobs. For that, we can just copy the
already defined job to schedule new job with the similar attributes and steps. To
copy the job, following steps are performed:-
1) Go to SM37
2) Search the job with job name we need to copy
3) From Menu, go to Job->Copy
4) Give the new name and copy
5) The new job will be scheduled but not released
6) Define the start condition and it’s done.
Job Status
1) Scheduled it means we have defined the steps and criteria but not the start
time. We only created the job and defined the steps.
2) Released it means we have defined the steps and start time for the job.
3) Ready it means the execution time has arrived for the job but it is waiting
for the resources to be available.
4) Active the job is running, being executed.
5) Finishedthe job has ended successfully.
6) Cancelled the job has ended with errors.
For starting jobs, there is one job scheduler working in background which decides
which job to start, if the job is dependent on some events or other jobs. For the
background scheduler to run we have to define one profile parameter rdisp/btctime.
The value of this parameter is defined in seconds and default is 60 seconds. It
means that scheduler will check every 60 seconds in the system whether there is any
job to run.
Job Class
There are 3 classes for defining the job:-
1) Class A – High Priority job
2) Class B – Medium Priority Job
3) Class C – Low Priority Job
If we have defined spool in the background and we want to send notifications to
users, we can also do that by clicking on Spool Recipients List button in SM36. The
use of this task is that user can read that spool defined in the background job.