Entering content frame

Procedure documentation Advanced Scheduling 1: Building Chains of Jobs  Locate the document in its SAP Library structure

Goal: Assume that you irregularly have to schedule a chain of jobs, that is, a set of jobs linked by predecessor-successor relationships.

You’d like to consolidate the scheduling of this chain of jobs into a single job that sees to the scheduling of all jobs in the chain. The advantage of this consolidation: you need only to schedule a single job to launch the chain of jobs.

Scheduling a Job Chain.

This graphic is explained in the accompanying text

Implementation: You’d implement this job in three small ABAP reports. These show both:

The first report schedules Job 1 to run immediately. Job 1 does some work and schedules both Job 2 and Job 3. There is no formal predecessor/successor relationship between Jobs 1 and 2. Usually, Job 2 won’t start until Job 1 processing has been completed. But it’s possible for steps in Jobs 1 and 2 to overlap. For example, if "Program_X" in Job 1 is an external program and Job 1 does not wait for Program_X to complete, then "Program_Y" in Job 2 and Program_X in Job 1 could overlap.

Job 1 must schedule both Jobs 2 and 3 because a job cannot schedule its own successor. This is because a predecessor job must have the status Scheduled or Released when a successor job is scheduled. If you want to set up chains of jobs, do so from a single initial report or job, as in this example.

Job 2, in turn, runs to completion and triggers the start of Job 3.. Here, Job 3 is formally linked to Job 2 as its predecessor, using the pred_jobname argument of the JOB_CLOSE function module. The predjob_checkstat argument ensures that Job 3 will start only if Job 2 is successfully completed. For a programming sample, see Sample Program: Wait for Predecessor Job with JOB_CLOSE.

(An alternative to the strategy shown here would be to schedule the jobs in the chain to run periodically. But this is a good solution only if the jobs must run according to a regular schedule. Also, the jobs are not automatically rescheduled if one of them fails.)

Leaving content frame