To delete a background job explicitly, use: You can select jobs according to all of the criteria available in the interactive background processing management system: 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.
Sample Program: Deleting a Background Job
* 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. For an example, please see
* Sample Program: Wait for Predecessor Job with JOB_CLOSE.
*
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.
No comments:
Post a Comment