Back to Main Index

*Prevent the program from having more
*the one instance running the same time.
*Create this macro in TRMAC using SM31
*Insert the following single line in the
*program right after the REPORT state-
*ment: ZCHK_MYSELF_RUNNING SY-REPID.

DATA: PRG LIKE INDX-SRTFD. PRG = &1
CALL FUNCTION 'ENQUEUE_ESINDX'
EXPORTING RELID = 'ZZ'
SRTFD = PRG
SRTF2 = 0
EXCEPTIONS FOREIGN_LOCK = 1
SYSTEM_FAILURE = 2
IF SY-SUBRC NE 0
WRITE: 'ERROR:',PRG,'is already running'
EXIT. ENDIF