Sometimes it’s important to ensure, that particular background job is processed only once
and to avoid parallel, concurent starts. There are many ways to implement the appropriate check,
for example using locks or evaluating the list of running jobs.
For the second idea, see a simple coding below.
REPORT zbtc_single.
DATA:
ls_jobsel TYPE btcselect,
lt_joblist TYPE TABLE OF tbtcjob,
ls_joblist TYPE tbtcjob,
lv_nr_of_jobs TYPE i.
ls_jobsel-jobname = sy-cprog.
ls_jobsel-ready = 'X'.
ls_jobsel-running = 'X'.
CALL FUNCTION 'BP_JOB_SELECT'
EXPORTING
jobselect_dialog = 'N'
jobsel_param_in = ls_jobsel
IMPORTING
nr_of_jobs_found = lv_nr_of_jobs
TABLES
jobselect_joblist = lt_joblist
EXCEPTIONS
invalid_dialog_type = 1
jobname_missing = 2
no_jobs_found = 3
selection_canceled = 4
username_missing = 5
OTHERS = 6.
CHECK lv_nr_of_jobs = 1.
* ... further processing
See other related notes on my website: