You are on page 1of 13

BACK GROUNG SCHEDULING

- Vijay Kumar Nuthalapati


→ Background processing allows users to work non-interactively (i.e. off-line).
→ Instead of executing an ABAP program and waiting for an answer, a user can create a
background job to execute the ABAP program at a particular time.
→ Background jobs are typically used for the following tasks:
• To process large amounts of data (i.e. a daily movement of data to a data warehouse).
• To execute periodic jobs without human intervention (i.e. system clean-up jobs).
• To run programs during non-work hours to decrease the system load and improve
performance
→ A job is a sequential sequence of steps that can be scheduled, i.e. the automatic initiation of
programs in SAP as opposed to executing the programs manually.
→ There are three key components required to define a job:
• the program to be run
• the program’s variant (a variant is saved set of value assignments for a selection screen)
• Time / Date that the job is to be run
→ A job can have multiple steps. A step is a program for background processing with the variants.
→ Once the job has been defined, the job can be released either immediately or to the specified
date/time in the future.
→ Once a job has been released, it is executed by a background work process within the R/3 Basis
System. The results of the job can then be viewed in the job overview facility (SM37).
→ To define a background job, go to transaction code SM36.
→ To create a background job, the following information must be provided:
• Job name - freely definable up to 32 characters in length.
• ABAP Program - the name of the ABAP program to be started along with its
associated variant.
• Start date.
→ Existing jobs can be extended by adding additional steps.
→ In a distributed environment, it is possible to specify a target host for processing. The
target host is the SAP instance where the job will be executed.
→ It is also possible to schedule background jobs to run after the execution of another Job
or after the completion of a system Event.
→ To edit a background job, go to transaction code SM37.
→ To check the status of a job, go to Job Overview (SM37).
→ A job can have any one of the following status:
• Scheduled: The job has been created but still has not been assigned a Start Date and Time.
A scheduled job will never execute unless it is assigned a start date or released.
• Released: The job is released to run at the time or condition specified in the start options,
but the run time has not occurred yet.
• Ready: The start date and time has arrived and the job is waiting to be executed and
waiting or a background work process to free up.
• Active: The job is being executed.
• Finished: The job has ended successfully.
• Canceled: The job has ended with errors.
→ The job log can be displayed from within the job overview.
→ The job log contains all messages that are displayed with the ABAP language
command MESSAGE... (only the types I, S, A, and X is permitted, since E
and W requires user entry to an online screen, as well as system-internal messages.
→ The display is language-dependent.
→ Generated lists (ABAP language command WRITE) are automatically stored in
the a spool file. The spool file can be viewed and printed with job overview
(SM37) or via the output controller (SP01).
→ One list can be output for each job step unless the ABAP program uses special
statements.
→ Printing can be specified during scheduling or it can be initiated manually via
either the job overview of the output controller.
→ There are authorization objects which are listed above for batch processing.
→ The individual functions are protected by the object S_BTCH_JOB during job
processing, and during job creation by the object S_BTCH_NAM.
→ It is possible to dynamically generate a batch job from within an ABAP
program.
→ The ABAP program opens the job, inserts the job steps, and closes the job.
Function modules are available to facilitate creating a job
with an ABAP program. These function modules are called up
in the sequence listed above.
→ The JOB_OPEN function module opens a background job. The ABAP
program passes a job name to JOB_OPEN, and JOB_OPEN returns a job
number to the ABAP program.
→ To add a job step, use the function module JOB_SUBMIT.
To do this, the following parameters are required:
• the job name
• the job number (passed to the program from the JOB_OPEN function module)
• the report name
• a variant (if required) as well as a batch user ID for the authorization checks.
→ Instead of the function module JOB_SUBMIT, the SUBMIT statement can also
be used in the format
SUBMIT <report> USER <user> VIA JOB <jobname> NUMBER <jobnumber>.
→ The function module JOB_CLOSE closes a background job.
→ The function requires the following parameters:
• job name and the job number to do this (mandatory).
• If the start date and time were not specified in the JOB_OPEN, it is possible to make
these specifications for JOB_CLOSE (optional).
• In addition, the function module JOB_CLOSE allows a specification for the
immediate start (STRTIMMED = 'X').
• A parameter JOB_WAS_RELEASED returns a value of ‘X’ the job was released.

You might also like