Code: Alles auswählen.
CALL FUNCTION 'GET_JOB_RUNTIME_INFO'
IMPORTING
jobcount = ls_this_job-jobcount
jobname = ls_this_job-jobname
EXCEPTIONS
no_runtime_info = 1
OTHERS = 2.
IF sy-subrc = 0.
SELECT 'X'
FROM tbtco
WHERE status = 'R' " Running
AND jobname = @ls_this_job-jobname
AND jobcount <> @ls_this_job-jobcount
INTO @DATA(lv_other_job_still_running) UP TO 1 ROWS.
ENDSELECT.
IF lv_other_job_still_running = 'X'.
me->suicide( '2' ).
ENDIF.
ENDIF.
Folgende Benutzer bedankten sich beim Autor black_adept für den Beitrag:
DeathAndPain
Folgende Benutzer bedankten sich beim Autor a-dead-trousers für den Beitrag:
DeathAndPain
Code: Alles auswählen.
METHOD check_running.
DATA:
lv_prog TYPE indx-srtfd,
lv_relid TYPE indx-relid VALUE 'EP',
lv_srtf2 TYPE indx-srtf2 VALUE '0'.
lv_prog = iv_report.
rv_running = abap_false.
CALL FUNCTION 'ENQUEUE_ESINDX'
EXPORTING
relid = lv_relid
srtfd = lv_prog
srtf2 = lv_srtf2
EXCEPTIONS
foreign_lock = 1
system_failure = 2.
IF sy-subrc NE 0.
rv_running = abap_true.
ENDIF.
ENDMETHOD.
Code: Alles auswählen.
METHOD DEQUEUE.
DATA:
lv_prog TYPE indx-srtfd,
lv_relid TYPE indx-relid VALUE 'EP',
lv_srtf2 TYPE indx-srtf2 VALUE '0'.
lv_prog = iv_report.
CALL FUNCTION 'DEQUEUE_ESINDX'
EXPORTING
relid = lv_relid
srtfd = lv_prog
srtf2 = lv_srtf2.
ENDMETHOD.
Code: Alles auswählen.
SELECT SINGLE COUNT(*) FROM TBTCO
JOIN TBTCP ON TBTCP~JOBNAME = TBTCO~JOBNAME
AND TBTCP~JOBCOUNT = TBTCO~JOBCOUNT
WHERE STRTDATE = SY-DATUM " Index TBTCO~8 nutzen: Nur Jobs, die heute gestartet wurden
AND TBTCP~STATUS = 'R'
AND TBTCP~PROGNAME = SY-REPID.
Code: Alles auswählen.
SELECT SINGLE COUNT(*) FROM TBTCP
WHERE PROGNAME = SY-REPID " Index TBTCP~1 nutzen: Nur Jobs mit diesem Programm im Step
AND STATUS = 'R'.
Code: Alles auswählen.
CALL FUNCTION 'GET_JOB_RUNTIME_INFO'
IMPORTING
JOBCOUNT = CURRENT_JOB-JOBCOUNT
JOBNAME = CURRENT_JOB-JOBNAME
EXCEPTIONS
NO_RUNTIME_INFO = 1
OTHERS = 2.
SELECT SINGLE COUNT(*) FROM TBTCO
JOIN TBTCP ON TBTCP~JOBNAME = TBTCO~JOBNAME
AND TBTCP~JOBCOUNT = TBTCO~JOBCOUNT
WHERE TBTCO~STATUS = 'R' " Index TBTCO~7 nutzen: Nur laufende Jobs
AND TBTCP~PROGNAME = SY-REPID
AND ( TBTCP~JOBNAME <> CURRENT_JOB-JOBNAME
OR TBTCP~JOBCOUNT <> CURRENT_JOB-JOBCOUNT )
Code: Alles auswählen.
jobname = @ls_this_job-jobname