‎2012 Jan 03 8:03 AM
Hello All
I have one custom T code.
When I run this, I get some records in ALV and some buttons to do some functions.
I dont want to allow 2 users to make above functions in the same time.
So I want to catch, which user already running this T code.
Please help on this.
Regards
Ram
‎2012 Jan 03 8:10 AM
Hi,
You could use Function Module: 'TH_LONG_USR_INFO' to check which users are currently using your transaction.
Best Regards,
Martin
‎2012 Jan 03 8:06 AM
Check SM04 it will have entry of the use running the tocde.
use the following command
DATA: BEGIN OF USR_TABL OCCURS 10.
INCLUDE STRUCTURE USRINFO.
DATA: END OF USR_TABL.
call 'ThUsrInfo' id 'OPCODE' field opcode_list
id 'TABUSR' field usr_tabl-*sys* .USR_TABL will have the details
Nabheet
Edited by: nabheetmadan09 on Jan 3, 2012 1:37 PM
‎2012 Jan 03 8:10 AM
Hi,
You could use Function Module: 'TH_LONG_USR_INFO' to check which users are currently using your transaction.
Best Regards,
Martin
‎2012 Jan 03 9:06 AM
I think this FM 'TH_LONG_USR_INFO' gived based on User name.
But I want to catch User name based on T code.
Is there any way to catch User name based on T code?
Please help on this?
Thanks
Ram
‎2012 Jan 03 9:09 AM
Hi,
If you parse '*' as user name you will get an internal table of all current sessions. You should be able to loop at this table based on transaction code.
Regards,
Martin
‎2012 Jan 03 9:12 AM
try to use below mentioned command
DATA: BEGIN OF USR_TABL OCCURS 10.
INCLUDE STRUCTURE USRINFO.
DATA: END OF USR_TABL.
call 'ThUsrInfo' id 'OPCODE' field opcode_list
id 'TABUSR' field usr_tabl-*sys* .
‎2012 Jan 03 8:29 AM
Before that please explain
I dont want to allow 2 users to make above functions in the same time
What functions ??
What if the function is available through standard transactions ??
Kesav
‎2012 Jan 03 9:12 AM
Rama,
you know what!! use Import export... easy way to capture..
user one .
clicks a button, export a FLAG to a memory id.
user two
clicks the same button, check(import) the FLAG from memory. if the flag is set that means some one is using it..
after user one is done with his work
clear the memory id.
now user two can use it as flag is free,
now set the flag for user two
‎2012 Jan 03 9:26 AM
@Soumyaprakash - Import/Export wouldn't work in this case.
@Ram
When I run this, I get some records in ALV and some buttons to do some functions.
I dont want to allow 2 users to make above functions in the same time.
So I want to catch, which user already running this T code.
Do you want to make this specific to the function or the record chosen on the ALV against which the function is to be performed?
Provide more details on the function that you want to perform on clicking the button etc.
Regards,
Chen
‎2012 Jan 03 9:41 AM
Chen ..
correct.. its a different call sequence. .import export wont work. i dint read it i guess..
1. go for a lock object. in this case you need to create lock object, activate lock object FMs and use them. or
2. create a SET/GET parameter for yourself and use that..
when button is clicked,
get PARAMETER ID 'ZSOMU' FIELD lv.
IF lv NE 'X'.
lv = 'X'.
set PARAMETER ID 'ZSOMU' FIELD lv.
"continue processing
"and at the end assign a blank value back to the parameter
else.
message 'Already processing ' type 'E'.
ENDIF.Edited by: Soumyaprakash Mishra on Jan 3, 2012 3:45 PM
‎2012 Jan 03 9:40 AM
Hi Ram,
Instead of this approach, you may create your own lock object and use this object to lock when someone uses any function in your program. Then, you can check the lock when users try to run the same function. It will be easier to manage and monitor.
Abdulbasit.