Entering content frame

Procedure documentation Task Overview: Full-Control Job Scheduling Locate the document in its SAP Library structure

To schedule a background job from within a program using the full-control method, you must do the following:

  1. Create the job using function module JOB_OPEN.
  2. JOB_OPEN passes a name to the background system. The system returns the job count, the unique ID number that identifies the job, together with the job name.

  3. Collect the job specifications (report or program to run, start time, and so on).
  4. You can collect the job specifications on your own. Or you can use the following function modules to collect the specifications:

    – BP_START_DATE_EDITOR: Ask the user to specify a start time for the background job.

    – GET_PRINT_PARAMETERS: Ask the user for printing and optical archiving specifications. You can also use GET_PRINT_PARAMETERS to make these specifications yourself, in non-interactive mode.

    GET_PRINT_PARAMETERS is not essential in test programs or in programs that do not produce any printable output (no WRITE keywords). For example, a background job that is to make only a set of database changes need not include a call to GET_PRINT_PARAMETERS.

    However, you should always include a call to GET_PRINT_PARAMETERS in any production program for scheduling jobs that produce output. Otherwise, the R/3 spool system uses defaults for formatting and printing any output generated by a job. The printouts that result may not be what you wish.

  5. Add a job step to the job with the function module JOB_SUBMIT or the ABAP keyword SUBMIT.
  6. Each of the programs that is included in a job forms a separate job step. For each job step, you can make separate specifications for attributes other than the start date and target system for running a job. For example, each job step in a job can have separate printing and authorizations specifications.

    You can add as many job steps to a job as you wish. You can mix job steps that start ABAP and external programs.

    There is only one difference between JOB_SUBMIT and ABAP SUBMIT. With SUBMIT, you can specify selection criteria for an ABAP report dynamically, when the background job is submitted. With JOB_SUBMIT, you can only specify an existing variant for a report.

    You must use SUBMIT, for example, if the user of your program supplies the selection criteria for an ABAP report interactively, at runtime. With JOB_SUBMIT, you could specify only an existing variant for the report.

  7. Close the job and pass it to the background processing system for execution with the function module JOB_CLOSE. You specify job-start attributes and many run-time attributes of a job in JOB_CLOSE.

A job cannot be started until you have "closed" it.

With JOB_CLOSE, you can find out whether a job was only scheduled or was also released to run. If a job was only scheduled, then an administrator must release the job before it can run. If a job was automatically released, then the background processing system can start the job as soon as its specified start time is reached.

A job is not released but is only scheduled if either of the following is true:

If you are scheduling a job that is to be periodically repeated, you can use the BP_CALCULATE_NEXT_JOB_STARTS function module to find the dates upon which the job would be scheduled to run.

Leaving content frame