2008 Dec 11 8:05 PM
I want to make sure that a particular function module or a piece of code cannot be executed by two programs (run by the same user or different users) at the same time. And if two programs attempt to execute that function module or piece of code simultaneously. They are queued so that one get executed only after the other is finished.
2008 Dec 11 8:15 PM
Hi Srikrishna,
You can achieve this by creating events (the ones you will be use/create for workflows). You can create event when your function module starts, which should also check whether event already exists and avoid multiple users launching the function module.
Let me know what is your opinion on this.
Regards
Krishna
2008 Dec 11 8:13 PM
Can you tell us what would you like to achieve by doing so ? Are you updating any database table inside this function ? If yes, then you can lock the table update the database and then unlock the table again.
regards,
Advait
2008 Dec 11 8:15 PM
Hi there to lock a program
When you create a lock object System automatically creates two function module.
1. ENQUEUE_<Lockobject name>. to insert the object in a queue.
2. DEQUEUE_<Lockobject name>. To remove the object is being queued through above FM.
call function 'ENQUEUE_E_TRDIR'
exporting
* MODE_TRDIR = 'X'
name = sy-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.[More info|https://forums.sdn.sap.com/click.jspa?searchID=19841120&messageID=6452619]
2008 Dec 11 8:15 PM
Hi Srikrishna,
You can achieve this by creating events (the ones you will be use/create for workflows). You can create event when your function module starts, which should also check whether event already exists and avoid multiple users launching the function module.
Let me know what is your opinion on this.
Regards
Krishna
| User | Count |
|---|---|
| 4 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |