‎2007 Apr 05 6:20 PM
Hi ,
i have created a z-tcode.if it is running,the other user who tries to run z-tcode
an error message should be raised.i should lock my txn if it is running.
at a time only one user can run the txn
thanks.
‎2007 Apr 05 6:32 PM
Hi,
You can use EXPORT ..IMPORT..
Ex..
DATA: V_VALUE.
INITIALIZATION.
Get the value from the memory
IMPORT V_VALUE
FROM DATABASE INDX(ST) ID 'Z_RUNNING'.
IF SY-SUBRC = 0 AND V_VALUE = 'X'.
MESSAGE E208(00) WITH 'Program already running'.
ENDIF.
Export the value to the memory to lock the record.
V_VALUE = 'X'.
EXPORT V_VALUE TO DATABASE INDX(ST) ID 'Z_RUNNING'.
********************
********************
Do all your processing here...
********************
********************
END-OF-SELECTION.
Export the value to the memory to unlock ..
CLEAR V_VALUE.
EXPORT V_VALUE TO DATABASE INDX(ST) ID 'Z_RUNNING'.
Hope this helps.
Thanks,
Naren
‎2007 Apr 05 6:33 PM
Hi,
I think you can use ENQUEUE and DEQUEUE Function Modules in the program to lock and unlock the respective transaction.
Example: Function Module 'DEQUEUE_ALL' for unlocking.
Hope this helps.
Thanks,
Srinivas
‎2007 Apr 05 6:33 PM
Hi,
This can be done with small development.
- Create a Z table using se11 transaction. This has two field "transaction name" and "userid".
- Whenever you run the transaction, first thing you do is check this table for any entry. If there is already a entry exist with user-id ( let's say user-id XUSR01 ), then you give a error message that "XUSR01" is already executing transaction.
- If there is no entry is this table then add entry in table with "transaction name (ZTCOD)" and "user ID (XUSR01)" and continue the program
- Now let's another user tries to run the transaction ( let's say XUSR02 ), program first reads the table and find the record for XUSR01. So you give the error message "User XUSR01 is executing this transaction".
- And at the end of the transaction, when all the code has been executed, you remove the entry from the table. So not if somebody else now tries to execute the transaction, he can do it.
Let me know if you have any question.
Regards,
RS
‎2007 Apr 05 6:34 PM
Hi
U should create an your own block object in SE11 based on TSTC table.
After creating the object, the system generates the fm to lock and unlock.
Or use the generical fm ENQUEUE_E_TABLE and DEQUEUE_E_TABLE for TSTC table.
Max
‎2007 Apr 05 6:34 PM
‎2007 Jul 26 1:48 PM