Posted: Sun Nov 18, 2007 8:23 pm Post subject: Prevents runnig more than one instance the same time
Simple macro that prevents runnig more than one instance of the same ABAP the same time
Code:
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
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You can download files in this forum
All product names are trademarks of their respective companies. SAPNET.RU websites are in no way affiliated with SAP AG. SAP, SAP R/3, R/3 software, mySAP, ABAP, BAPI, xApps, SAP NetWeaver and any other are registered trademarks of SAP AG. Every effort is made to ensure content integrity. Use information on this site at your own risk.