Show TOC

Function documentationSelecting and Deleting a Job

 

To delete a background job explicitly, use:

  • BP_JOB_SELECT to obtain the jobname and job number of the job that you wish to delete.

    You can select jobs according to all of the criteria available in the interactive background processing management system:

    • Job Name: Using a well-planned naming convention for your jobs will help you to select them precisely.

    • Job Number

    • Name of the user who scheduled a job

    • Specifications for the start-time window/no start time scheduled

    • Start dependent upon predecessor jobs

    • Start dependent upon an event and event argument

    • Job status (preliminary, scheduled, ready, running, finished, aborted).

  • BP_JOB_DELETE to delete the job. The job log is deleted as well, if the job has already been run.

    Note Note

    A job cannot delete itself. Also, a job that is currently running cannot be deleted. However, you can have it deleted automatically if it is completed successfully. See the DELANFREP parameter of JOB_OPEN.

    End of the note.

Example

Deleting a Background Job

Syntax Syntax

  1. * Data declarations: BP_JOB_SELECT 
    * 
    DATA JSELECT LIKE BTCSELECT. 
    
    DATA SEL_JOBLIST LIKE TBTCJOB OCCURS 100 WITH HEADER LINE. 
    
    * Sample selection criteria 
    * 
    JSELECT-JOBNAME = 'Name of job'. 
    JSELECT-USERNAME = SY-UNAME. 
    
    CALL FUNCTION 'BP_JOB_SELECT' 
    EXPORTING 
    JOBSELECT_DIALOG = BTC_NO 
    JOBSEL_PARAM_IN = JSELECT 
    IMPORTING 
    JOBSEL_PARAM_OUT = JSELECT 
    TABLES 
    JOBSELECT_JOBLIST = SEL_JOBLIST 
    EXCEPTIONS NO_JOBS_FOUND = 1 
    SELECTION_CANCELED = 2 
    OTHERS = 99. 
    * 
    * In this example, the program loops over the internal table 
    * SEL_JOBLIST and deletes each of the jobs that was selected. 
    * 
    * Alternative: Have the user select the job to be deleted 
    * with BP_JOBLIST_PROCESSOR.* 
    LOOP AT SEL_JOBLIST. 
    CALL FUNCTION 'BP_JOB_DELETE' 
    EXPORTING 
    FORCEDMODE = 'X' 
    JOBNAME = SEL_JOBLIST-JOBNAME 
    JOBCOUNT = SEL_JOBLIST-JOBCOUNT 
    EXCEPTIONS 
    OTHERS = 99. 
    ENDLOOP. * 
    * 
    * FORCEDMODE deletes the job header even if other portions of the 
    * job cannot be deleted from the TemSe facility, where they are 
    * held. 
    
    * FORCEDMODE can be used without fear of causing problems in the 
    * System. Any TemSe problem that affects background jobs can be 
    * resolved directly in the TemSe system and does not require the 
    * job header.
End of the code.