Show TOC

Background documentationBackground Processing Function Modules

 

The following function modules for background processing are available. Do not use other function modules that belong to the background processing system; these are reserved for internal use.

  • JOB_OPEN: Create a background job

    Use JOB_OPEN to create a background job. The function module returns the unique ID number which, together with the job name, is required for identifying the job.

    Once you have "opened" a job, you can add job steps to it with JOB_SUBMIT and submit the job for processing with JOB_CLOSE.

    For more information, please see the online documentation in the function module facility (transaction SE37) or Sample Program: Creating a Job with JOB_OPEN.

  • JOB_SUBMIT, ABAP SUBMIT: Add a Job Step to a Job

    Use JOB_SUBMIT to add a job step to a background job that you have opened with JOB_OPEN.

    A job step is an independent unit of work in a job, the execution of an ABAP or external program. Each job step can have its own authorizations user and printer/optical archiving specifications.

    Related function modules include:

    • JOB_OPEN: Create a background job.

    • JOB_CLOSE: Submit a background job to the background processing system for execution.

      For more information, see the online documentation in the function module facility (transaction SE37) or Scheduling a Job: Full-Control Method.

    • JOB_CLOSE: Pass a Job to the Background Processing

      Use JOB_CLOSE to pass a background job to the background processing system to be run. Once you have "closed" a job, you can no longer add job steps to it or change job/job step specifications.

      The funciton module returns an indicator that shows whether the job was automatically released or not. A job is automatically released to run only if the user who scheduled the job has RELE release authorization for the authorization object Operations on background jobs.

      A job step is an independent unit of work in a job, the execution of an ABAP or external program. Each job step can have its own authorizations user and printer/optical archiving specifications.

      Related function modules include:

      • JOB_OPEN: Create a background job.

      • JOB_SUBMIT: Add a Job Step to a Job

    For more information, see the online documentation in the function module facility (transaction SE37) or Scheduling a Job: Full-Control Method.

  • BP_JOBVARIANT_SCHEDULE and BP_JOBVARIANT_OVERVIEW

    These two function modules offer an "easy-method" or "express-method" for scheduling and then managing background processing jobs.

    • BP_JOBVARIANT_SCHEDULE:

      Schedule a job for execution.

      This function module greatly simplifies scheduling a job. You need only name an ABAP report. The function module presents screens to your user to allow them to 1) specify the variant to use; and 2) pick a single or repetitive start time for the job.

    • BP_JOBVARIANT_OVERVIEW:

      Manage jobs.

      This function module offers a simplified management interface to jobs. A user can delete inactive jobs and display job logs and spool output from completed jobs.

    For more information, see the online documentation in the function module facility (transaction SE37) or Scheduling and Managing a Job: Easy Method.

  • BP_CALCULATE_NEXT_JOB_STARTS: Determine Start Dates and Times for a Periodic Job

    Use this function module to calculate the dates and times upon which a periodic job would be started. You can specify the period of time for the analysis.

    For more information, please see the online documentation in the function module facility (transaction SE37) or Calculating Start Dates for Periodic Jobs.

  • BP_CHECK_EVENTID: Check that an Event Exists

    Use transaction SM62 to check if the event name that you specified is already defined in the SAP system. The return value 0 is displayed to show that the event is already defined in the SAP system.

    For more information, see the online documentation in the function module facility (transaction SE37).

  • RAISE method: Trigger Event from an ABAP Program

    The RAISE method belongs to class CL_BATCH_EVENT and triggers events in the background processing system. You can use it to trigger events from ABAP programs. Triggering an event instructs the background processing system to start all background jobs that were scheduled to wait for the event.

    You can trigger an event with or without an event argument.

    When using the RAISE method, you can specify a target server on which the event is to be raised.

    For more information, see Triggering Events from ABAP Programs.

    Use the SAPEVT program to trigger an event from a program, script, or batch file that runs outside the SAP system.

    For more information, see the online documentation in the function module facility (transaction SE37) or Working with Events.

  • BP_JOB_COPY: Copy a Background Job

    Copies a background job. The copy of the job contains all job steps and associated attributes, such as user authorization and print and archiving specifications. However, the copy does not have any start time specifications. You must enter this information yourself.

    There are two different modes available to you for this function module:

    • Interactive (DIALOG = BTC_YES): The user must specify the job name and confirm or canel the copy process. Default names specified with TARGET_JOBNAME are ignored.

    • Not-interactive (DIALOG = BTC_NO): The job is copied without user interaction. You must specify a new job name with TARGET_JOBNAME.

    For more information, see the online documentation in the function module facility (transaction SE37).

  • BP_JOB_DELETE: Delete a Background Processing Job

    Delete a background job and its log (if the job has already run).

    Deletion is unconditional, except that active jobs cannot be deleted and a job cannot delete itself. Aborted jobs, however, are deleted.

    If it is important that aborted jobs and their logs are kept, then you may wish to specify automatic deletion with the parameter of DELANFREP. This parameter causes automatic deletion only of jobs that have been successfully completed.

    For more information, please see the online documentation in the function module facility (transaction SE37) or Selecting and Deleting a Job.

  • BP_JOB_GET_PREDECESSORS: List Predecessor-Jobs of a Job

    Lists the immediate predecessor job of a job. Predecessor jobs are those that must be completed (optionally, successfully completed) before the affected job can be started.

    The function module returns only the immediate predecessor job, the job upon whose completion this job can start. The function module does not determine whether the predecessor job itself has a predecessor.

    For more information, see the online documentation in the function module facility (transaction SE37).

  • BP_JOB_GET_SUCESSORS:

    Lists the successor jobs of a job. Successor jobs are those that are eligible to start only after this job has been completed (optionally, completed successfully).

    The function module may return more than one successor if successor jobs themselves have successors.

    For more information, see the online documentation in the function module facility (transaction SE37).

  • BP_JOB_MAINTENANCE: Job Management Functions

    Starts the background processing job management function (transaction SM37). Users must be authorized for such actions as releasing jobs or accessing jobs other than their own.

    For more information, please see the online documentation in the function module facility (transaction SE37) or Managing Jobs: Generating Job Lists.

  • BP_JOB_SELECT: Read Jobs from Database

    You can use this function module to determine the jobs (records in the format TBTCJOB) that correspond to the selection criteria that you have specified.

    You can use BP_JOB_SELECT to collect a set of jobs that you wish to process further. You can, for example, select jobs that correspond to a certain naming convention, and check their status with the field TBTCJOB-STATUS.

    For a sample program containing BP_JOB_SELECT, please see the online documentation in the function module facility (transaction SE37) Selecting and Deleting a Job.

  • BP_FIND_JOBS_WITH_PROGRAM: Read Jobs that Run a Specific Program from Database

    You can use this function module as you would BP_JOB_SELECT to generate a list of jobs that can be displayed and manipulated with BP_JOBLIST_PROCESSOR. This function module selects jobs by the program that you specify. You could, for example, select the jobs that contain the program that a user has just scheduled.

    For more information, see the online documentation in the function module facility (transaction SE37). For a programming example, see Displaying Job Status: SHOW_JOBSTATE.

  • BP_JOBLIST_PROCESSOR: Allow User to Work with List of Jobs

    You can use the function module BP_JOBLIST_PROCESSOR to display a list of jobs for the users of your program. The jobs are displayed in the "job overview" list format used by the job maintenance facility of the background processing system.

    The list of jobs must be provided to BP_JOBLIST_PROCESSOR in an internal table generated with BP_JOB_SELECT.

    You can display the list of jobs in three modes:

    • Display mode: The user can view job attributes and such job products as spool requests and job logs. He or she cannot, however, change jobs or perform such operations as releasing a job to run.

    • Edit mode: The user can perform all maintenance operations for which he or she is authorized.

    • Select mode: The user is requested to select a job from the list. When the selection is made, the list is closed and the TBTCJOB structure of the selected job is returned to your program.

    Authorizations

    The authorization tests for background processing are in effect for processing of job lists. These authorizations are described in the User and Authorizations Guide and in Customizing.

    For more information, see the online documentation in the function module facility (transaction SE37).

  • SHOW_JOBSTATE: Check Status of a Job

    SHOW_JOBSTATE Returns one of the six possible statuses for a job that is identified by its name and job number.

    Example Example

    For a programming example, see Displaying Job Status: SHOW_JOBSTATE.

    End of the example.
  • FUNCBP_JOBLOG_READ: Read a Job Log for Processing

    Read the contents of a job processing log into an internal table for further processing. You could, for example, combine the logs of related jobs into a single log.

    For sample code, please see the online documentation in the function module facility (transaction SE37) or Copying a Job Log into an Internal Table.

  • BP_JOBLOG_SHOW: Displaying a Job Log

    A job log contains messages from the background processing system on the processing of a job, together with any error messages from the ABAP programs executed in the job and/or output from external programs.

    Display sample code For sample code, please see the online documentation in the function module facility (transaction SE37) Displaying Job Logs.

  • BP_START_DATE_EDITOR: Display/Request Start Specifications

    Use this function module to let users specify the start time for a job themselves. The function module displays the standard scheduling screens for background processing jobs to users.

    For more information, please see the online documentation in the function module facility (transaction SE37) or Getting Job-Start Specifications from Users.

  • BP_JOB_READ: Retrieve Job Specifications

    Use this function module to read the job header table (TBTCO, specifications such as the start time that apply globally to a job) and the job step table (TBTCSTEP, a record for each step in a job, including such information as the program to run, spool request generated, and so on).

    You will need the job name and job number to read these tables.

    What the function module returns is controlled by the import parameter JOB_READ_OPCODE. This parameter can take on the following values (defined in LBTCHDEF)

    • BTC_READ_JOBHEAD_ONLY:

      Read only the job header data (TBTCO)

    • BTC_READ_ALL_JOBDATA:

      Read all job data (TBTCO, TBTCSTEP).

  • SHOW_JOBSTATE: Display Job Status

    Use this function module to return the status of a job in the background processing system. The statuses are those that you can display in the management transaction for background processing (transaction SM37).

    Example Example

    For a programming example, see Displaying Job Status: SHOW_JOBSTATE.

    End of the example.
  • Parallel-Processing Function Modules

    In combination with the keywords ABAP CALL FUNCTION STARTING NEW TASK IN DESTINATION GROUP, WAIT, and RECEIVE it is possible to use three functio modules to implement parallel processing in programs that are executed interactively or in the background processing system.

    For a list of these function modules and more information on their use, see Implementing Parallel Processing.