DATA: L_JOBNAME TYPE BTCJOB.
CONCATENATE '[PP]BACKFLUSH_' P_WERKS '(모듈)' INTO L_JOBNAME.
SELECT COUNT(*)
FROM TBTCO
WHERE JOBNAME = L_JOBNAME
AND STATUS = 'R'.
IF SY-DBCNT > 1.
MESSAGE S001 WITH 'Batch Job이 수행중에 있습니다.'.
P_RETURN = 'X'.
ENDIF.
참고로 STATUS 값은 다음과 같습니다.
A - Cancelled / F - Completed / P - Scheduled / R - Active / S - Released