2008 Apr 04 11:47 AM
Hi Gurus,
I have an issue here related to a report where at a given instance of time, only one instance of it has to be running. that means, if a program is executed once and is still processing, then no other user should be able to execute the program at that time, or even it should not work if the same user tries to execute the same program in a differnet session.
Plz suggest me a solution how to acheive it..
Hi Gurus,
I have an issue here related to a report where at a given instance of time, only one instance of it has to be running. that means, if a program is executed once and is still processing, then no other user should be able to execute the program at that time, or even it should not work if the same user tries to execute the same program in a differnet session.
Plz suggest me a solution how to acheive it..
2008 Apr 04 11:51 AM
2008 Apr 04 12:06 PM
Hi Brown,
I guess the Lock objects concept works with the tables..
How do i achieve it for a report..
2008 Apr 04 12:12 PM
Hi,
u just use set parameter and get parameter functions to solve this issue.
get the value from sap memory(get parameter) and check it if it is 'X' issue some message.if it is space make it to 'X' and write ur code.while coming out of the program set the value as space again.
rgds,
bharat.
2008 Apr 04 12:21 PM
Hi Bharat,
I think the Parameter ids are available only upto a user level.. not user independent.. we need it here all over in the client..
I mean to say tat.. If a user sets the parameter id in his login.. that does not apply for other users..
2008 Apr 04 12:25 PM
Hi,
for example you can create an own small database table and create a record in it when the report is started and delete it when it ends. If another user (or even the same) you can check if there is an entry in the table and reject the report from running....
Hope that helped a little bit...
2008 Apr 04 12:38 PM
Hi Stephan
Thanks for the suggestion. but I have already tried it that way but the main problem i am facing here is that If the porgram is terminating abruptly due to some reason.. The field in the table is remaining there not getting updated to inital value..
and it even restricts the normal execution of the program, when it is run again.. I hope u understand the practical problem here..
2008 Apr 04 1:43 PM
2008 Apr 04 9:18 PM
Hello,
i' ve got a solution to your problem. This solution is explained by Rich Heilman in an other thread "[|]".
Here a copy of the interesting post of this thread :
You can put a lock on the program inside the program, so that when it is run it puts a lock entry in SM12, then anyone trying to run it will get a message saying that the program is locked. USe the TRDIR lock object.
code
report zrich_0001 .
data: repid type sy-repid.
repid = sy-repid
call function 'ENQUEUE_E_TRDIR'
EXPORTING
MODE_TRDIR = 'X'*
NAME = repid
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.
[/code]
Welcome to SDN
Regards,
Rich Heilman
Cordialement,
Chaouki.
| User | Count |
|---|---|
| 4 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |