Prevent program from having
more than one instance running at the same time
REPORT ZPROGRAM.
*******************************************************************************
* Prevent the program from having more than 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 statement: ZCHK_MYSELF_RUNNING SY-REPID.
*******************************************************************************
define my_macro.
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.
end-of-definition.
my_macro 'ZPROGRAM'.
Get help for your ABAP problems
Do you have
a ABAP Question?
SAP Books
SAP Certification,
Functional, Basis Administration and ABAP Programming Reference Books
More ABAP Tips
Best regards,
SAP Basis, ABAP Programming and Other IMG Stuff
http://www.erpgreat.com
All the site contents are Copyright © www.erpgreat.com
and the content authors. All rights reserved.
All product names are trademarks of their respective
companies. The site www.erpgreat.com is in no way affiliated with
SAP AG.
Every effort is made to ensure the content integrity.
Information used on this site is at your own risk.
The content on this site may not be reproduced
or redistributed without the express written permission of
www.erpgreat.com or the content authors.
|