SAP Background Job Scheduling
The majority of tasks on an SAP system (R/3) are carried out interactively. For tasks that process large amounts of data and require more system resources, the Computing Center Management System (CCMS) is used. The CCMS runs tasks without user interaction and during off-peak times to reduce the impact on dialog users. The CCMS includes basic functionality for creating, scheduling, and monitoring background jobs on the SAP system. Tasks may be scheduled to run periodically, such as every day or once a week.
In order to help customers achieve true enterprise scheduling, SAP provides an open generic interface called XBP (eXternal interface for Background Processing), which allows a central job management system (external scheduler) to connect to the SAP system and implement added value by scheduling, running, and monitoring jobs from outside the SAP R/3 system. The CCMS may still control certain system control tasks—especially those that are complex and security-critical—as well as background jobs generated by applications such as SAP R/3 archiving or the Workbench.
Limitations of the CCMS
SAP job scheduling through the CCMS may run a combination of ABAP programs, external commands, and external programs. Jobs can be scheduled to run immediately, at a certain date/time, after another job completes, after an event is raised, or periodically.
When creating background jobs directly on the SAP system, a limited selection of start conditions is available and only one can be chosen. They cannot be combined with "and" or "or" logic.
Enterprise schedulers provide more sophisticated solutions to handle "and/or" logic and other modern scheduling requirements such as job monitors, file transfers, SNMP traps, notification, and an audit history. Through interdependence from the SAP system, external schedulers can facilitate enterprise scheduling using connections to non-SAP systems as well as additional SAP systems.
|Pros||Cons||Periodic Values* Allowed?||Additional Parameters|
|Immediate||Used when job does not run at specific times or days.||
|Date/Time||Simple way to run a job on a specific date and time.||
No start after: Prevents a scheduled job from starting if no background process is available between the scheduled time and the “no start after” time.*
|After Job||Lets you run a job in reaction to another SAP job.||
||Start status–dependent: Job runs based on the status of another SAP job.|
|After Event||Lets you run a job in reaction to an SAP event.||
|At Operation Mode||The job will start when the specified operation mode becomes active in the SAP system.||
||Operation modes are defined on the SAP system by the user.|
|Workday/Time||Lets you run a job at a specific time on the Nth workday of the month.||
||Relative to beginning or end of month.|
*Period values: Hourly, Daily, Weekly, Monthly, Every (x months, weeks, days, hours, or minutes)
|Day of Week||Lets you set a
specific day of the
week to run a job.
||Repeats: daily, weekly*
*When you select weekly, the job runs on the week of the month that you specify (first, second, third, fourth, fifth, last).
Run time: Set the time to run.
|Date List||Lets you set specific dates a job should run.||
|Day of Period||Lets you schedule jobs that routinely run on the given days(s) relative to the start or end of a specific period.||
||Type of period: month, quarter, semester, year
Run on day: Number of days you want to count from the beginning or before the end of period.
Run time: Set the time to run.
|Jobs are automatically rescheduled to run in a specific time interval.||
Run every: Enter the interval number (hours or minutes).
|Daily Interval||Lets you run a job with a set number of days between each run.||
||Run every: Set the number of days between run times.
Start run date: Set the date of the first job run.
Run time: Set the time to run.
|Reactive To||Lets you schedule jobs that react to another job, groups of jobs, or events on any system.||
||Jobs can react to any combination of the following:
• Any job status
• Late start
• Overrun or underrun
• Manual event
• File or directory event
• Process event
• SNMP trap
|Lets you schedule a job based on a cron expression.||n/a||Skip if running
Hold on failure
The SAP Job Overview (transaction SM37) provides a basic tool for monitoring and managing the jobs scheduled on the SAP system, and displays the history of jobs that have completed with a status of finished or canceled.
By utilizing the XBP interface, external schedulers have the potential to provide a more comprehensive overview of scheduled, running, and completed jobs located on the SAP system.
How Enterprise Schedulers Work With the SAP CCMS
Each application server within an SAP System has a configurable number of background work processes designated for processing batch jobs. If too many background jobs are released directly in SAP, and if they are not controlled by an external scheduler, their traffic can result in using up work processes meant for scheduled jobs.
Unexpected jobs can only be controlled and automated when an external job scheduler is used. SAP provides APIs to retrieve a list of intercepted jobs, allowing the external scheduler to decide when the jobs will run.
The interception feature must be explicitly activated on the SAP system. When activated, the SAP CCMS compares each job that is about to run against the intercept criteria.
On an SAP system using the XBP 2.0 level for interception, the criteria will include the Client, the Job owner and the Job name of each job. Wildcards may be used, for example, U* for the Job owner will match all users whose account starts with U. Multiple combinations of Client, Job owner, and Job name may be used to create the interception criteria. If a job matches the criteria when the CCMS changes its status to Released, its status is set back to Scheduled (Intercepted on newer SAP systems) and added to a list of newly intercepted jobs. An external scheduler can request this list and determine if and when to release any of the intercepted jobs. Using a system of confirmation, the SAP system only reports each intercepted job once to the external scheduler. Jobs scheduled by an external job scheduler are exempt from interception.
Three useful policies for SAP job interception include:
- No interception required: If there are no users in the SAP systems that can release jobs, and if no SAP applications that create their own jobs are in use, then interception serves no purpose and it does not need to be used.
- Some jobs are intercepted: By carefully filling the criteria table, you can intercept only certain categories of jobs. For example, if you find that your financial end users are casing stoppages by ad-hoc selected jobs, you could put their usernames in the criteria table. Unfortunately the criteria do not easily allow you to match all background jobs started by SAP programs unless they have a job that starts with a specific character string.
- All jobs are intercepted: Usually the most useful policy is to intercept all jobs. When an external scheduler is used to run all batch job scheduling, the volume of jobs started outside of the external scheduler should be low. Every job started outside of the external scheduler has the potential of interfering with the start time of other jobs. To counter this, make sure every job is intercepted so that they will adhere to the preferred schedule. This is also true for background jobs started by the user DDIC.
How to Set Up SAP Integration
Step 1: Installation
Install the external job scheduler on a system away from the SAP system. This takes the load of scheduling and managing enterprise-wide jobs off the SAP system, allowing it to focus on critical business processes.
Step 2: Connecting Your SAP System
For making the connection to the SAP system, ensure a valid SAP user account exists that is able to connect and run SAP jobs. According to SAP, "Partner software that connects to an SAP solution to fetch data or perform a task must log in using a named user license. Platform User Licensing may provide the best option for the users who access SAP exclusively through certified partner solutions."
Step 3: Interception
SAP provides a feature called interception, which was added with BC-XBP 2.0 and is designed with external schedulers in mind. By activating and utilizing job interception, jobs that are scheduled in SAP directly and are not under the control of the external scheduler can be monitored and, if desired, rescheduled for a more opportune time. One recommendation is to have all background jobs intercepted since jobs started by an external scheduler are exempt from being intercepted. By intercepting these unexpected jobs, the external scheduler can decide when to release them, maintaining the resources (work processes) needed to run the scheduled batch jobs.
Step 4: Parent/Child Jobs
When a background job on the SAP system produces child jobs, the CCMS does not know these jobs are generated from one parent job. Jobs dependent on a parent job will still initiate when the parent job completes—even if its child jobs have not completed. The CCMS does not provide a “wait for child jobs” option. This is where an external SAP job scheduler comes in. When parent/child functionality is turned on in the SAP CCMS, an external scheduler can request a list of child jobs produced by a ‘parent’ SAP job and monitor each of those child jobs. The scheduler waits for all child jobs to complete before starting the next process. To view or change the settings for Interception and Parent-Child Functions on the SAP system, use SA38 and run the Program INITXBP2.
Integration at Work
Imagine you have an SAP job that runs on multiple systems and that each system produces a file. Upon completion of each job, the files are transferred to one central UNIX® system. After the files are transferred, a UNIX job processes all the files and creates one new consolidated file. This consolidated file is then transferred to a Windows system where it is processed with other data (created from a separate task) to create a final file. The final file is transferred back to each SAP system and a message is sent to a distribution list notifying that the information has been processed.
By using one centralized enterprise scheduler, each step of the process is started as soon as the required file is available. This ensures that the process completes within the allotted time. If there is a problem at any step, notification is sent to an individual or distribution list to handle the issue.
Enterprise schedulers allow you to set up another job that reacts to the failure, and, depending on the error, could correct the problem and continue the process without any manual intervention.
With SAP-certified integration, Automate Schedule provides an affordable interface for centralized scheduling and management of jobs across multiple systems, including SAP.
Automate Schedule's flexible scheduling options, powerful analysis features, and intuitive, web-based interface make it easy to build an event-driven schedule across SAP and non-SAP systems for coordinated batch processing, cross-system monitoring, and true enterprise automation.