Easy Job Scheduling Using BP_JOBVARIANT_SCHEDULE

To schedule a job from within a program using the express method, you need only call the BP_JOBVARIANT_SCHEDULE function module.

The express method has the following characteristics:

  • Simplified job structure: The function module schedules a job that includes only a single job step.
  • The function module uses default values for most job-processing options. You cannot, for example, specify a target printer as part of the call to the function module. Instead, the job step uses the print defaults of the scheduling user.
  • Only ABAP reports can be scheduled. You must use the "full-control" method to start external programs.
  • The range of start-time options is restricted. Event-based scheduling is not supported.

The function module works as follows:

  1. You name the report that is to be scheduled in your call to the function module.
  2. The function module displays a list of variants to the user. The user must select a variant for the report.
  3. You must ensure that the variants required by your users have already been defined.

  4. The user picks either "immediate start" or enters a start date and start time. Optionally, the user can also make the job restart periodically. The job is then scheduled.

Example

You could use the following code to let users schedule report RSTWGZS2 for checking on the status of online documentation:

call function 'BP_JOBVARIANT_SCHEDULE'
exporting
title_name = 'Documentation Check'
" Displayed as title of
" of scheduling screens
job_name = 'DocuCheck' " Name of background
" processing job
prog_name = 'RSTWGZS2' " Name of ABAP
" report that is to be
" run -- used also to
" select variants
exceptions
no_such_report = 01.
" PROG_NAME program
" not found.
call function 'BP_JOBVARIANT_OVERVIEW' " List the jobs that
exporting " have been scheduled
title_name = 'Documentation Check' " Displayed as title
" of overview screen
job_name = 'DokuCheck' " Jobs with this name
" are listed
prog_name = 'RSTWGZS2'
exceptions
no_such_job = 01.

The code would present your users with a sequence of two screens. On the first screen, shown below, the user can select from available variants or add new variants:

This graphic is explained in the accompanying text

On the second screen, the user can pick a start date and time for the job and decide whether the job should be repeated periodically. The function module finishes with a success message when the user schedules the background job.

This graphic is explained in the accompanying text

See also Managing "Easy-Method" Jobs with BP_JOBVARIANT_OVERVIEW for an easy method for letting users manage their background jobs.

No comments:

topics