ZCHK_MYSELF_RUNNING  000      *Prevent the program from having more   
ZCHK_MYSELF_RUNNING  001      *the one instance running the same time.
ZCHK_MYSELF_RUNNING  002      *Create this macro in TRMAC using SM31  
ZCHK_MYSELF_RUNNING  003      *Insert the following single line in the
ZCHK_MYSELF_RUNNING  004      *program right after the REPORT state-  
ZCHK_MYSELF_RUNNING  005      *ment:   ZCHK_MYSELF_RUNNING SY-REPID.  
ZCHK_MYSELF_RUNNING  010      DATA: PRG LIKE INDX-SRTFD. PRG = &1     
ZCHK_MYSELF_RUNNING  011      CALL FUNCTION 'ENQUEUE_ESINDX'         *
ZCHK_MYSELF_RUNNING  012           EXPORTING RELID = 'ZZ'            *
ZCHK_MYSELF_RUNNING  013                SRTFD = PRG                  *
ZCHK_MYSELF_RUNNING  014                SRTF2 = 0                    *
ZCHK_MYSELF_RUNNING  015           EXCEPTIONS FOREIGN_LOCK = 1       *
ZCHK_MYSELF_RUNNING  016                SYSTEM_FAILURE = 2            
ZCHK_MYSELF_RUNNING  017      IF SY-SUBRC NE 0                        
ZCHK_MYSELF_RUNNING  018      WRITE: 'ERROR:',PRG,'is already running'
ZCHK_MYSELF_RUNNING  019      EXIT. ENDIF