2008 Sep 01 7:53 PM
Hi guys,
My customer requires that a certain program is to be executed only one execution at a time (i.e. no two or more instances of the same program running on the same client ) does anyone know how to do that?
Hi guys,
My customer requires that a certain program is to be executed only one execution at a time (i.e. no two or more instances of the same program running on the same client ) does anyone know how to do that?
2008 Sep 01 8:04 PM
Hello,
You can use the lock concept [Lock and Unlock Program|https://wiki.sdn.sap.com/wiki/x/1m4].
Another way is to create a table with a flag record that defined if the program is currently running or not (set the flag when the program starts, unset it when finishes).
Regards.
2008 Sep 01 8:16 PM
Another way is to check upfront that the program is being started by a specific transaction code (otherwise exit) and then lock the transaction if the user is authorized (but already in the transaction...). When the user leaves the transaction, it should again be unlocked.
You can check the authority and lock status of the transaction upfront in the program using FM AUTHORITY_CHECK_TCODE.
There are even some standard transactions which work in this way, from which you can get some sample coding and the correct functions to use...
Cheers,
Julius
2008 Sep 02 1:06 AM
Thank you for your replies. Actually i don't want to link the program to a transaction, and I don't want to lock the edition but the execution of the program, it's true that i could override the use of the edit lock field and use it as an "execution lock" but that wouldn't be the cleanest approach, would it? so do you have other suggestions
2008 Sep 02 7:17 AM
Hi,
Use bellow given program. It may helpfule to you.
thanks
DATA : lv_zeit TYPE programs-zeit,
lv_prog TYPE programs-prog_name.
lv_zeit = im_subdir.
lv_prog = im_repid.
CALL FUNCTION 'ENQUEUE_ET_PROGS'
EXPORTING
MODE_PROGRAMS = 'E'
DATUM =
zeit = lv_zeit
prog_name = lv_prog
PID =
X_DATUM = ' '
X_ZEIT = ' '
X_PROG_NAME = ' '
X_PID = ' '
_SCOPE = '2'
_WAIT = ' '
_COLLECT = ' '
EXCEPTIONS
foreign_lock = 1
system_failure = 2
OTHERS = 3.
2008 Sep 03 3:31 PM
Hi Vijetha,
The function module works fine, but there is a little change in the requirement, my customer wants a popup message containing the login of the user who is currently executing it, do you know how to do that?
2010 Feb 04 3:23 PM
Hello,
You need to use (after the call):
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
One error message appears directly. In my case I changed the message's type to 'Information' (replace SY-MSGTY with 'I').
I hope it's useful.
Miquel.
| User | Count |
|---|---|
| 3 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |