Beruflich Dokumente
Kultur Dokumente
by
Samik Ghosh
Content
Batch Job Scheduling in SAP
Introduction
Background jobs are definitions of programs, printing specification, and
interactively can be run automatically by the SAP background
processing system. Any program that you can start interactively can be
run automatically by the SAP system in the Background jobs. In
background processing the system automatically runs the specified
program or report at a specified and schedule time without the
intervention of the user; even if you can monitor the background job
and display results.
Whenever you log on to the SAP System to perform any task, the R/3
System starts responding. SAP System can be operated in both
interactive mode as well as non-interactive mode. In the non-interactive
mode you can schedule execution of programs and reports that you
need to run without further intervention by you. This mode of working is
named Background Processing.
Sophisticate support for the background processing is provided by the
SAP System. One can execute both internal and external programs of
the SAP system. You can perform variety of jobs like choosing a variety
of methods for scheduling and managing the jobs offer by the SAP
System. For ease of access of scheduling and management, within a
single background processing job one can execute similar related
programs as "job steps;" this allows the single background job to
become more complex and have multiple steps.
The system has a number of sophisticated tools for managing jobs and
diagnosing problems that occur during the runtime, including a graphic
monitor and a powerful and easy-to-use job programming interface for
developing your own background-processing applications. The system
also provides job scheduling wizard automates basic background job
definition.
Background Scheduling
To have an idea about the background scheduling let us take an
example of a long report. Suppose we execute this report in interactive
mode, it takes several minutes and during time the SAP System is
blocked for any further input. As a result, you will not be able to interact
with SAP sessions anymore.
However, when you run the report non-interactively, you can interact
with the SAP sessions while processing the report in the background. For
executing jobs in non-interactive mode, schedule the job for background
processing. SAP system does not require user’s intervention and can
proceed with the job even without you. It executes the report and prints
the output using printer or output controller. While scheduling a job in
background process, three parameters should be specified. These
parameters are:
Definition of programs
Its start time
The printing specification for getting the prints as required
After this, you can check whether your job was executed successfully
and display a log of any system messages.
Scheduling background processing is a two-step process:
Scheduling the program
Releasing the job
This needs to have a special authorization for releasing and scheduling
the job. Generally, the system administrator, who organizes and
monitors background processing, supervises the release of these jobs.
Many users are also authorized to schedule background processing of
reports. You cannot schedule a job unless and until you have a release
authorization. If a user is authorized and has specified a start date or
selected "start immediately," he or she can release the job.
Authorized users can change start time. A program can be scheduled as
a separate job or you can append it to an existing job, which has not yet
been processed. Background process can be run while doing some other
online work. However, this can adversely affect online operation and
should be avoided. For example, if you run a program that locks the
database, the work of online users will be hampered or stopped. Often,
long-running reports are scheduled automatically or semi-automatically
for background processing.
First Step
Initiate the job scheduling function. Standard job scheduling must be
used in case of scheduling of an external command or external program
as a background job and ABAP job scheduling function can be used to
schedule ABAP programs. For starting a standard job scheduling
function choose the following:
Administration menu bar option->CCMS option->Jobs option->Definition
option.
For starting ABAP job scheduling function, navigate to ABAP Editor and
choose Program menu bar option->Execute option->Background option.
Second Step
Now define a job. Using the Job Wizard you can define your job. From
the Application toolbar, choose the wizard button. After this, the initial
screen of the SAP Job Wizard appears. The Job Wizard is available only
from the standard job scheduling function.
Third Step
Now, you have to save the job. When it displays the message "Job
saved" it means the job has been successfully scheduled. We know that
a job must be released before it is scheduled. Only authorized users can
release the job, otherwise your system administrator will release your
job.
Fourth Step
This is the last step of scheduling. In this step you have to check the
status of your job. For this you need to choose System menu bar option-
>Own jobs option.
Specifying a Recipient
For specifying a recipient, select Spool lists recipient option and Execute
Enter button from the initial screen. A dialog box gets displayed. In the
Recipient field, enter a user's SAP office mail name, a SAP office
distribution list, a SAP user ID, or an external e-mail address. If desired,
activate the mailing options. The recipient receives all spool requests
generated by the job. If you want to save the recipient, choose Copy.
Steps:
Call Transaction SM36 or choose CCMS → Jobs → Definition→Assign a
job name. Decide on a name for the job you are defining and enter
it in the Job Name field.
Server name
Name of an SAP instance at which a background job should be run. The name has the
following format: <host name>_<SAP System name>_<SAP System number>, where host
name is the name of the server computer on which the instance is running, as specified in the
system profile parameter SAPLOCALHOST.
The name of each instance is specified in the system profile parameter rdisp/myname.
Example: hs0123_C11_55
In programming: As the table field EXECSERVER, shows the target instance selected by the
user for running a job. As the table field REAXSERVER, shows the SAP instance at which a job
was actually run.
Define the job’s steps by choosing Step, then specify the ABAP
program, external command, or external program to be used for
each step.
Release the job so that it can run. No job, even those scheduled for
immediate processing, can run without first being released.
Procedure
3. For the job to repeat, check the Periodic job box at the bottom of
the Start Time screen and choose the Period values button below
it to define the frequency of repetition (hourly, daily, weekly,
monthly, or another specific time-related period). Then choose
the Save button in the Period values screen to accept the
periodicity and return to the Start Time screen.
4. Once you’ve completed specifying the job start conditions,
choose the Save button at the bottom of the Start Time screen to
return to the Define Background Job screen.
To ensure that you can flexibly run individual programs, you can set
important attributes individually for each job step, too. Each job step
can:
have its own spool, or output, specifications
run under the authorizations of a separate user
use a different language
have its own runtime options (for programs external to the SAP
System), such as handling of error output and synchronicity
In general, job steps run sequentially and synchronously in the order
they're entered in a job: the first step starts, runs, and is completed,
then the second step starts, and so on. The only exception is when you
schedule an external program to run asynchronously. In this case, the
background processing system starts the next job step without waiting
for a return code from the external program. If the external program
runs long enough, then the start of the next job step may overlap it.
Job steps run partially independently of each other’s status. That is, the
abnormal termination of one job step does not roll back the work of a
previously completed job step if this previous step was executing a
commit. If any job step fails, however, then the entire job fails. No
further job steps are carried out, and the job's status changes to
Canceled.
There are two types of job steps:
An executable ABAP program
Only type 1, or executable, ABAP programs can be used as job steps.
Module pools and function groups, which are collections of ABAP
modules, are not allowed. The specifications required for an ABAP job
step are:
ABAP program + Variant + Print and archiving parameters + Language
An external command or external program
This type of job step allows you to run programs outside the SAP
System. External commands are predefined, authorization-protected
commands for end users. External programs are unrestricted, directly
entered commands reserved for system administrators.
The type of external command and external program is unrestricted,
meaning that you can use either compiled programs or scripts. Such
programs can be run on any computer that can be reached from the
SAP System. Parameter passing to non-SAP programs is completely
unrestricted except by the predefinition mechanism for external
commands.
Output of non-SAP programs, particularly error messages, is included
in the job's log file.
Specifications required for an external command or programs are:
External command + Type of operating system + (Parameters) +
Target host system
External program + Parameters + Target host system
On-line reports:
Exactly the same configuration can be maintained for any output
produced from R/3. If a user clicks “Parameters” button on a SAP
Printer selection dialog, it allows specifying all the parameters as
described in “Scheduling background jobs” section. Thus any output
created by an online report can be saved and accessed by any user
authorized to access that spool
Access to report’s output:
A user that had proper access (see Configuring user access
above) can retrieve a job/report output through transaction SP01.
From the spool list the user can use several function such as
view the content of a spool request, print the spool request,
view attributed of the spool request, etc. (some functions may
need special authorization,
• Click the Print button to print the spool request with
the default attributes (usually defined with the job
definition). It will print it on a printer that was specified
when a job was created.
• Click the “Print with changed attributed” button to
print the spool request with the different attributes (e.g.
changing the printer name).
• Click the “Display contents” button to preview the
spool request contents. A Print and Download
functions are available from the preview mode.