‎2005 Apr 12 11:28 PM
How to prevent users for running same report at same time in back ground or fore ground ? Any one have a sample code???
‎2005 Apr 12 11:40 PM
Hi Vipin,
You can quite simply use the lock object <b>ESRDIRE</b>.
<b>to lock
CALL FUNCTION 'ENQUEUE_ESRDIRE'
EXPORTING
MODE_TRDIR = 'E'
NAME = <i>Your Program name</i>
X_NAME = ' '
_SCOPE = '2'
_WAIT = ' '
_COLLECT = ' '
EXCEPTIONS
FOREIGN_LOCK = 1
SYSTEM_FAILURE = 2
OTHERS = 3
.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.</b>
<b>to unlock use
CALL FUNCTION 'DEQUEUE_ESRDIRE'
EXPORTING
MODE_TRDIR = 'E'
NAME = <i>Your Program name</i>
X_NAME = ' '
_SCOPE = '3'
_SYNCHRON = ' '
_COLLECT = ' '
.</b>
Hope that helps!
Rishi
<i><b>Note: the same lock object is used to lock the program from change, so for testing the code, ensure you are not in change mode for the same program</b></i>
‎2005 Apr 12 11:40 PM
Hi Vipin,
You can quite simply use the lock object <b>ESRDIRE</b>.
<b>to lock
CALL FUNCTION 'ENQUEUE_ESRDIRE'
EXPORTING
MODE_TRDIR = 'E'
NAME = <i>Your Program name</i>
X_NAME = ' '
_SCOPE = '2'
_WAIT = ' '
_COLLECT = ' '
EXCEPTIONS
FOREIGN_LOCK = 1
SYSTEM_FAILURE = 2
OTHERS = 3
.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.</b>
<b>to unlock use
CALL FUNCTION 'DEQUEUE_ESRDIRE'
EXPORTING
MODE_TRDIR = 'E'
NAME = <i>Your Program name</i>
X_NAME = ' '
_SCOPE = '3'
_SYNCHRON = ' '
_COLLECT = ' '
.</b>
Hope that helps!
Rishi
<i><b>Note: the same lock object is used to lock the program from change, so for testing the code, ensure you are not in change mode for the same program</b></i>