27
Batch Job Scheduling in SAP by Samik Ghosh Content Batch Job Scheduling in SAP Step by Step Process to schedule Batch Job (With Screenshots) Scheduling Jobs Specifying Job Start Conditions Job Start Management Periodicity: Specifying Automatic Job Repetition Managing Jobs from the Job Overview Jobs and Job Steps Batch job scheduling in SAP Created by: Samik Ghosh Page 1

Background Job Scheduling in SAP

Embed Size (px)

Citation preview

Page 1: Background Job Scheduling in SAP

Batch Job Scheduling in SAP

by

Samik Ghosh

ContentBatch Job Scheduling in SAP

Step by Step Process to schedule Batch Job (With Screenshots)

Scheduling Jobs

Specifying Job Start Conditions

Job Start Management

Periodicity: Specifying Automatic Job Repetition

Managing Jobs from the Job Overview

Jobs and Job Steps

Batch job scheduling in SAP

Created by: Samik Ghosh Page 1

Page 2: Background Job Scheduling in SAP

Batch Job Scheduling in SAP

IntroductionBackground 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 SchedulingTo 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:

Created by: Samik Ghosh Page 2

Page 3: Background Job Scheduling in SAP

Batch Job Scheduling in SAP

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.

Created by: Samik Ghosh Page 3

Page 4: Background Job Scheduling in SAP

Batch Job Scheduling in SAP

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.

Advantages of Background Processing

Background processing system has many advantages.

First, when you run a report in the background, the SAP System is not tied up or blocked. However, if you run the process in the interactive session, the SAP session, in which the process is running, is always blocked for any further inputs. On the other hand, in a non-interactive mode, the R/3 system starts the report in the background. Running the report in this manner has no influence on your interactive work with the R/3 system.

Second, in background processing of the system you can schedule the processes, i.e. a report or external program can run at any scheduled time when R/3 system is active, during the night or other periods of low load on the R/3 system. Automatic periodic repetition of the jobs can be scheduled using background-processing system.

Third, background processing is an efficient way to execute long-running jobs. For interactive sessions, the SAP System has a built-in time limit. Therefore, whenever a report exceeds that specified limit, the R/3 system terminates the processing of the report automatically. This is the only way to run long-running ABAP/4 reports. Mostly ABAP/ 4 reports do not require any scheduling, since such reports are automatically scheduled for execution in the background system.

Processing Scheduling ABAP JobsFor scheduling ABAP job, you need to choose a variant for your report. The report name that will run gets filled in automatically. However, note that this report can be overwritten in case you want to enter different report to be run. Printer specifications can be set for output from the report. In case you do no set the printer options, the system uses the options saved with your user account. For this you have to Select –

Created by: Samik Ghosh Page 4

Page 5: Background Job Scheduling in SAP

Batch Job Scheduling in SAP

System menu bar option->User profile option->User defaults option for displaying these options. Now you can either execute immediately (using Execute immediate) or schedule the job (using Schedule) at some specified date and time. You can also specify your job to be restarted periodically. To access the more complete function choose – Goto option->Define job.

Scheduling Standard JobsFor scheduling standard jobs, first specify a recipient for spool requests generated by your job on the screen. The spool output is automatically mailed to this user or distribution list. Next, choose the time (Start time) at which you have to start the job. Save the start time and return to the first screen. You can confirm the start specifications using the Check function in the Start time option. Start time option allows you to repeat your job automatically. Even if you specify immediate start, no job can be started until it has been released. If the system asks for any additional information you have to enter that information.

For different start time option for background jobs the effects are different. For option Immediate, the effect is that the jobs starts immediately as soon as you save the jobs definitions.

For the date/time the jobs does not start until the date and time are specified.

If the option is "After job" then the jobs starts when another job that you specified has been completed.

And if the option is "After event" then the job starts when the selected events occur. You have to use possible values arrow to choose from the available events.

For the option "At Operation Mode" the job starts when the selected operation mode becomes active. You need to use the possible values arrow to choose an operation mode. Lastly, if you choose "Start on workday" as the Start time option, your job starts on a particular workday. The system displays a screen where you can give your specification. After saving the start time you can return to the job Identification screen.

Specifying a RecipientFor 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.

Specifying ABAP Program to Run in Background

Created by: Samik Ghosh Page 5

Page 6: Background Job Scheduling in SAP

Batch Job Scheduling in SAP

ABAP program or external program can be specified to be run in the background. More than one program can be executed with a single background job. To do it you should add a job step for each program. The Users field will, by default, display your name, indicating that the user (you) is authorized to run this program. In case there is another user authorized for scheduling the job, then the default name is changed and system displays the name of the other user. Now choose ABAP and enter the name of the report. Choose variant from the Variant list. Specify the language you want the report to be in. With Print specifications, you can specify whether you want the report output to be held in the SAP spool system or have it printed as soon as the job has run. For external command, by default, the job step will run under your SAP System authorizations. So your name will appear in the User field. But if the program is running under the authorization of another user, you can change this default option by entering another user name. Then choose External command and enter the predefined SAP name. If required, enter any additional arguments required for the command. The host system on which the command should run and the type of operating system at the host should be specified. You can determine the host name using the host name command on the target host system. You can also specify how the output from the external program should be treated, as well as other runtime options by using Control flags. It is advisable to use default settings for these options. If you are authorized for background processing, you can also choose External programs as a job step option. To run an external program, enter the exact path, program or script name, arguments required by the program, and the name of the host system on which the program is to run. After this, save the job step and return to the job identification screen.

Step by Step Process to schedule Batch Job (With Screenshots)

Transaction codes related to background jobs creation and processing are:-SM35 (Job Overview)SM36 (Job creation)SM37 (Job selection and execution)

Job Scheduling Before any background processing can actually begin, background jobs must be defined and scheduled. The scheduled time for a job runs is one part of the job’s definition. There are several ways to schedule jobs:From Transaction SM36 (Define Background Job)

Created by: Samik Ghosh Page 6

Page 7: Background Job Scheduling in SAP

Batch Job Scheduling in SAP

With the "start program in the background" option of either Transaction SA38 (ABAP: Execute Program) or transaction SE38 (the ABAP editor).Through the background processing system’s own programming interface (Many SAP applications use the internal programming interface to schedule long-running reports for background processing). Through an external interface.

Steps to Schedule Batch JobsScheduling Background JobsSpecifying Job Start ConditionsJob Start ManagementPeriodicity: Specifying Automatic Job RepetitionManaging Jobs from the Job OverviewJobs and Job Steps Explained

Scheduling Background Jobs You can define and schedule background jobs in two ways from the Job Overview:

Directly from Transaction SM36. This is best for users already familiar with background job scheduling.

The Job Scheduling Wizard. This is best for users unfamiliar with SAP background job scheduling. To use the Job Wizard, start from Transaction SM36 and either select Go to → Wizard version or simply use the Job Wizard button.

Created by: Samik Ghosh Page 7

Page 8: Background Job Scheduling in SAP

Batch Job Scheduling in SAP

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.

Created by: Samik Ghosh Page 8

Page 9: Background Job Scheduling in SAP

Batch Job Scheduling in SAP

Set the job’s priority, or “Job Class”:

1. High priority: Class A

2. Medium priority: Class B

3. Low priority: Class CIn the Target server field, indicate whether to use system load

balancing.

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.

1. For the system to use system load balancing to automatically select the most efficient application server to use at the moment, leave this field empty.

Created by: Samik Ghosh Page 9

Page 10: Background Job Scheduling in SAP

Batch Job Scheduling in SAP

2. To use a particular application server to run the job, enter a specific target server.

If spool requests generated by this job are to be sent to some one as email, specify the email address.

Choose the Spool list recipient button.

Define when the job is to start by choosing Start Condition and completing the appropriate selections. If the job is to repeat, or be periodic, check the box at the bottom of this screen.

Define the job’s steps by choosing Step, then specify the ABAP program, external command, or external program to be used for each step.

Created by: Samik Ghosh Page 10

Page 11: Background Job Scheduling in SAP

Batch Job Scheduling in SAP

Save the fully defined job to submit it to the background processing system.

When you need to modify, reschedule, or otherwise manipulate a job after you've scheduled it the first time, you'll manage jobs from the Job Overview.

Created by: Samik Ghosh Page 11

Page 12: Background Job Scheduling in SAP

Batch Job Scheduling in SAP

Release the job so that it can run. No job, even those scheduled for immediate processing, can run without first being released.

Created by: Samik Ghosh Page 12

Page 13: Background Job Scheduling in SAP

Batch Job Scheduling in SAP

After Saving Below message appears.

Specifying Job Start Conditions

When scheduling a background job (either from Transaction SM36, Define Background Job or CCMS ->Jobs-> Definition), you must specify conditions that will trigger the job to start.

Procedure

1. Choose the Start condition button at the top of the Define Background Job screen.

2. Choose the button at the top of the Start Time screen for the type of start condition you want to use (Immediate, Date/Time, After job, After event, or At operation mode) and complete the start time definition in the screen that appears.

Created by: Samik Ghosh Page 13

Page 14: Background Job Scheduling in SAP

Batch Job Scheduling in SAP

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.

No job can be started until it is released, including jobs scheduled to start immediately. Since releasing jobs can be done only by a system administrator from the job management screen (Transaction SM37) or by other users who have been granted the appropriate Authorizations for Background Processing, no unauthorized user can start a job without explicit permission.

Created by: Samik Ghosh Page 14

Page 15: Background Job Scheduling in SAP

Batch Job Scheduling in SAP

Job Start Management Any job can be scheduled to start based on either a certain start time or any of several events in the background processing system. Both types of start condition (see below) have their own SAP job scheduler: one is time-driven and one is event-driven. Both schedulers run in dialog work processes. If they find an eligible job, they trigger the job to run in a background work process. Time-Driven Job Scheduler: This scheduler runs periodically to check for jobs that were scheduled to run based on a certain start time (a particular date, for example). By default, the scheduler runs every 60 seconds on each SAP server that has at least one work process available for background processing. This 60-second interval can be changed in the system profile parameter rdisp/btctime . The time-driven scheduler will also take over the responsibility of starting event-based jobs if such jobs cannot yet be started when the defined start condition occurs (if, for example, no free background work processes are available when the start condition is met). These jobs are managed as jobs whose start time has already arrived and start running as soon as possible. Event-Driven Job Scheduler: This scheduler starts whenever a background processing event is triggered. Background processing events have nothing to do with workflow events and have no system-wide meaning. An example of a background processing event is "Job completed." The scheduler checks for any jobs that have been scheduled to wait for a certain event or for the event argument and starts these jobs once the event occurs. Event-driven jobs are those that have been scheduled with the one of three start conditions: After event, at operation mode or after job. Events can either be triggered within the SAP System or generated externally at the operating-system level. Events are automatically passed by the message server to an active background processing server. In order to respond to external events, the SAP System must be active. An event triggered by an external program will be lost if the SAP System is not running.Start Eligibility: A job is eligible to start when both of the following are true:

• The start condition specified for the job is met. • The job has been released to run.

No job can be run until it has been released, even those scheduled to start immediately. To monitor and control what jobs are submitted to run in background processing, the system can be configured so an administrator can check jobs before releasing them to run. The release requirement can also be turned off on a per-user basis. Trusted users can be given a special authorization (authorization object S_BTCH_JOB (Batch Processing: Operations on Batch Jobs), value RELE)

Created by: Samik Ghosh Page 15

Page 16: Background Job Scheduling in SAP

Batch Job Scheduling in SAP

which will automatically and immediately release any job scheduled by that user.Job Start Conditions:

Job Start Conditions

Explanation

Immediate This job will start as soon as possible, subject to job priority and the availability of background work processes. Users granted the appropriate authorizations for background processing can have their jobs released automatically as soon as they are scheduled, without special attention from a system administrator.

Date/time The job will start at the date and time specified, subject to job priority and the availability of background work processes. You can further define a timeframe in which the job will run by specifying a time later than which a job will not run. One use of this feature is to prevent periodic jobs from running when they should not. For example, a routine clean-up job scheduled to run only at night is delayed. By defining a start-time window, you will keep this job from being started during the day, when dialog users are active and fewer system resources are available.

After Job The job will start on the completion of the specified job. You can specify whether the preceding job must complete successfully or not.Note: Jobs scheduled to start when a preceding job completes cannot be specified as "Periodic jobs".

After Event The job is triggered by the specified event, descriptions of which follow.This start condition lets you define a sequence of individual jobs to model complex activities in your system. For example, a data transfer program that generates a batch-input session can, once the session has been completely generated, use an event to trigger another job that processes the session.

At operation mode The job will start when the specified operation mode becomes active in the SAP System.

Workday/Time (>>) The job will start on the specified day of the month (for example, the third to last day of the month). By specifying the appropriate SAP factory calendar,

Created by: Samik Ghosh Page 16

Page 17: Background Job Scheduling in SAP

Batch Job Scheduling in SAP

your scheduling can accommodate the occurrence of holidays or other non-workdays. You can further specify how the job should be handled if the start day lands on a non-working day. For example, you can have the job started on the workday before or after the actual scheduled date, or allow the job run in anyway, or have the job be skipped on that day entirely.

Verify that the calendar you choose has been correctly defined. If, for example, the calendar ends with the current year and your job is to be started next year, the job will terminate abnormally. If a calendar problem occurs, you can review system’s error messages in the job log of the terminated job.

Periodicity: Specifying Automatic Job Repetition To run your job not only at a particular time, but also to repeat it at regular intervals, you can specify a periodicity, or frequency of repetition. This can be specified in Define Background Job in Transaction SM36 (CCMS → Jobs → Definition).

Start the process of specifying when the job will start by choosing the Start condition button.

Choose the button at the top of the Start Time screen for the type of start condition you want to use (Immediate, Date/Time, After job, After event, or At operation mode) and complete the start time definition.

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).

Choose the “Save” button in the Period values to accept the periodicity and return to the Start Time screen.

When a periodic job’s start time is After event, the system repeats the job every time the relevant event is triggered.

Created by: Samik Ghosh Page 17

Page 18: Background Job Scheduling in SAP

Batch Job Scheduling in SAP

A periodic-job series is not interrupted if one of the jobs terminates abnormally. The background processing alert monitor warns you if any jobs abort, but if the job was not executed at all, there will be no following job.

Start-Time Windows and Job Repetition

If you schedule a job with a start-time window (that is, a range of time rather than a particular time) and want to have the job repeated, the background processing system adjusts the start-time window so that its length remains constant and is relative to the respective start time. If you specify a start-time window of six hours, then each repetition of the job will also have a six-hour start-time window, starting when the job repetition is scheduled. You cannot use the start-time window to limit the time of day during which a job is repeated. Scheduling a

Created by: Samik Ghosh Page 18

Page 19: Background Job Scheduling in SAP

Batch Job Scheduling in SAP

repeatable job to run between 10:00pm and 6:00am does not guarantee that the job will be repeated only within this time period. Rather, the full start-time window will be applied to all of the repetitions of the job according to the rules above. For example, you schedule a job to run between 10:00 this evening and 6:00 tomorrow morning and to be repeated every hour. The job will be triggered to repeat only after it has started the first time. At 10:00, the job starts. At the same time, the system schedules it again for 11:00. The start-time window for the job has been adjusted to 11:00 and 7:00. As the system schedules each repeated job, it adjusts the start-time window to remain the length you specified. The repeat job for 1:00am, for example, will have a start time window of 1:00 to 9:00. To limit the job to the time period between 10:00 and 6:00, you could define a job that schedules separate jobs to run each hour from 10:00 to 6:00. None of the jobs should be periodic. To limit an automatically repeated job to a particular time window, you’ll need to write a program yourself to schedule the jobs. Your program could schedule a separate job for each repetition that falls within the time period.

Managing Jobs from the Job Overview

The Job Overview, or Job Maintenance, screen is the single, central area for completing a wide range of tasks related to monitoring and managing jobs, including defining jobs; scheduling, rescheduling, and copying existing jobs; rescheduling and editing jobs and job steps; repeating a job; debugging an active job; reviewing information about a job; canceling a job's release status; canceling and deleting jobs; comparing the specifications of several jobs; checking the status of jobs; reviewing job logs; and releasing a job so it can run.ProceduresTo display the Job Overview screen, choose CCMS ->Jobs->Maintenance or call Transaction SM37. Before entering the Job Overview screen, the system first displays the Select Background Jobs screen. You'll need to complete this Job Selection screen to define the criteria for the jobs you want to manage. Once you've selected jobs to manage, you can choose from a wide range of management tasks:

To copy a single existing job, choose Job ->Copy. To reschedule or edit job steps or attributes of a single

job, choose Job Change. A job step is an independent unit of work within a background job. Each job step can execute an ABAP or external program. Other variants or authorizations may be used for each job step. The system allows you to display ABAP programs and variants. You can scan a program for syntax errors. You can also display the authorizations for an authorized user of an ABAP job step.

Created by: Samik Ghosh Page 19

Page 20: Background Job Scheduling in SAP

Batch Job Scheduling in SAP

To repeat a single job, choose Job->Repeat scheduling. To debug an active job, choose Job ->Capture: active job. Only

a single selection is allowed. If an active job seems to be running incorrectly (e.g., running for an excessively long time), you can interrupt and analyze it in debugging mode in a background process, and then either release it again or stop it altogether.

You will be able to capture a background job only if you are logged on to the SAP server on which the job is running. To find server information in the Job Overview, select and mark the job, then choose Job->Job details. To review information about a job, choose Job ->Job details. Details displayed can include:

current job status periodicity, or the repetition interval other jobs linked to the current job, either as previous or

subsequent jobs defined job steps spool requests generated by the current job

To cancel a job's "Released" status, select the job or jobs from the Job Overview list and choose Job ->Release -> Scheduled. To cancel a job from running but keep the job definition available, select the job or jobs from the Job Overview list and choose Job ->Cancel active job. To delete a job entirely, select the job or jobs from the Job Overview list and choose Job ->Delete. Jobs with the status of Ready or Running cannot be deleted. To compare the specifications of more than one job, select the jobs from the Job Overview list and choose Job->Compare jobs. To check the status of jobs, select the job or jobs from the Overview Job list and choose Job->Check status. This allows you to either change the job status back to Planned or cancel the job altogether. This is especially useful when a job has malfunctioned. To review job logs, select a job or jobs with the status Completed or Canceled from the Job Overview list and choose Go to ->Job log. To release a job so it can run, select a job from the Job Overview list and choose Go to ->Release.

Created by: Samik Ghosh Page 20

Page 21: Background Job Scheduling in SAP

Batch Job Scheduling in SAP

Jobs and Job Steps

The work unit of the background processing system is the background job, each of which consists of one or more job steps. Jobs and job steps enable you to treat complex tasks as single units. That is, you can schedule several programs needed to complete a particular task as steps within a single job, with the advantage of the job being single logical container for all the steps needed to complete the task. You need to schedule or review only one background job in order to schedule or review any of the individual steps necessary for completing the task. Assume that a particular data transfer with batch input requires that you start two programs, an external program to prepare the batch-input session and an internal program to process the session. Creating a job made up of two steps lets you handle the two programs as a single unit. Scheduling that one job schedules both programs. The results of each program's run can be seen in the job log.Some background processing attributes apply to entire jobs and, therefore, to all job steps within a job. For example, the earliest possible start time for any job steps will be the start time for the job. Frequency of repetition, priority, and other global attributes also apply to the whole job.

Created by: Samik Ghosh Page 21

Page 22: Background Job Scheduling in SAP

Batch Job Scheduling in SAP

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 programOnly 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 + LanguageAn external command or external programThis 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

Created by: Samik Ghosh Page 22

Page 23: Background Job Scheduling in SAP

Batch Job Scheduling in SAP

Job Step LanguageIf your SAP System runs with an Arabic, Cyrillic, or Asian character set, then you may need to change the language specified in the standard background jobs listed above. Languages are assigned to jobs based on job steps. Be sure that the language specified in the job step definition in each of these jobs is set to English (EN). This change is required because not all languages are available with all code pages. If the job’s specified language is not available, the job will not run.

Scheduling Back ground Jobs

Background jobs are scheduled by Basis administrators using transaction SM36.

To run a report in a background, a job needs to be created with a step using the report name and a variant for selection parameters. It is recommended to create a separate variant for each scheduled job to produce results for specific dates (e.g. previous month) or organizational units (e.g. Company codes).

While defining the step, the spool parameters needs to be specified (Step-> Print Specifications->Properties) to secure the output of the report and help authorized users to find the spool request. The following parameters need to be maintained:

Created by: Samik Ghosh Page 23

Page 24: Background Job Scheduling in SAP

Batch Job Scheduling in SAP

a. Time of printing: set to “Send to SAP spooler Only for now”b. Name – abbreviated name to identify the job outputc. Title – free form description for the report output d. Authorization – a value defined by Security in user profiles to

allow those users to access this spool request (authorization object S_SPO_ACT, value SPOAUTH). Only users with matching authorization value in their profiles will be able to see the output.

e. Department – set to appropriate department/functional area name. This field can be used in a search later.

f. Retention period – set to “Do not delete” if the report output needs to be retained for more

Created by: Samik Ghosh Page 24

Page 25: Background Job Scheduling in SAP

Batch Job Scheduling in SAP

than 8 days. Once the archiving/document repository solution is in place the spool requests could be automatically moved to the archive/repository. Storage Mode parameter on the same screen could be used to immediately send the output to archive instead of creating a spool request.

Configuring user access: To access a report output created by a background job, a user

must have at least access to SP01 (Spool requests) transaction without restriction on the user name (however by itself it will not let the user to see all spool requests). To have that access the user must have S_ADMI_FCD authorization object in the profile with SPOR (or SP01) value of S_ADMI_FCD parameter (maintained by Security).

To access a particular job’s output in the spool, the user must have S_SPO_ACT object in the profile with SPOAUTH parameter matching the value used in the Print Specifications of the job.

Levels of access to the spool (display, print once, reprint, download, etc) are controlled by SPOACTION parameter of S_SPO_ACT. The user must have at least BASE access (display).

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 spoolAccess to report’s output: A user that had proper access (see Configuring user access above) can retrieve a job/report output through transaction SP01.

Created by: Samik Ghosh Page 25

Page 26: Background Job Scheduling in SAP

Batch Job Scheduling in SAP

The selection screen can be configured by clicking “Further selection criteria button (e.g. to bring “Spool request name (suffix 2)” field or hide other fields).

The following fields can be used to search for a specific output (Note that Created By must be blank when searching for scheduled job’s outputs)

• Spool request name (suffix 2) – corresponds to a spool name in “Scheduling background jobs” section above). • Date created – to find an output of a job that ran within a certain date range.• Title – corresponds to spool Title in “Scheduling background jobs” section above).• Department - corresponds to spool Department in “Scheduling background jobs” section above). Upon entering selection criteria, the user clicks the Execute button to retrieve the list of matching spool requests.

Created by: Samik Ghosh Page 26

Page 27: Background Job Scheduling in SAP

Batch Job Scheduling in SAP

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.

Created by: Samik Ghosh Page 27