‎2008 Nov 25 12:50 PM
Hi ,
How do we programatically logoff a user? Any FM's?
Thanks,
krishna.
‎2008 Nov 25 4:34 PM
hi use this ..
CALL 'SYST_LOGOFF'.
this will definitely work . i tested well .
‎2008 Nov 25 1:00 PM
Hello,
This is the FM: TH_DELETE_USER.
Do not use it in development systems for playing around ;-).
Hope it helps.
Cheers,
Jayant
‎2008 Nov 25 1:03 PM
does this just logoff a user or deletes the user?
I am just looking @ logoff and not deletion.
Could you calrify pls?
Thanks,
Krishna.
‎2008 Nov 25 1:06 PM
This will only logoff the user. Will not delete it.
Thanks,
Jayant
‎2008 Nov 25 1:08 PM
‎2008 Nov 25 1:09 PM
‎2008 Nov 25 1:10 PM
not that i hates some one......... its bussiness requirment guys!
You have an answer you are most welcome!
‎2008 Nov 25 1:15 PM
Hello,
Below code can help you,
"&----
*
"& Report Ztest *
*"& *
"&----
*
"& *
"& *
"&----
*
report Ztest.
data: opcode type x value 2.
data: begin of usr_tabl occurs 10.
include structure uinfo.
data: end of usr_tabl.
data temp_text like sm04dic-popupmsg.
data: begin of fields occurs 10.
include structure help_value.
data: end of fields.
data: begin of valuetab occurs 10,
line(80),
end of valuetab.
data: tmpuname like sy-uname.
"&Selection Screen ****************************************************
"&Kick Off User/s
selection-screen begin of block b1 with frame title text-001.
"&User Name
select-options: uname for sy-uname obligatory.
"&Client
parameters: client like t000-mandt default sy-mandt obligatory.
selection-screen skip.
"& Time To Kick User Off Until
parameters: time like sy-uzeit default sy-uzeit obligatory,
"&Interval Between Logoffs
interval(2) type n default 1 obligatory,
"& Warn User Before Kicking Off?
warn as checkbox.
selection-screen end of block b1.
"& At Selection Screen *************************************************
at selection-screen on value-request for uname-low.
perform f4_help_check_uname using uname-low.
"& Start of Selection **************************************************
start-of-selection.
do.
refresh usr_tabl.
"& Get the list of logged on users
call 'ThUsrInfo' id 'OPCODE' field opcode
id 'TAB' field usr_tabl-sys.
loop at usr_tabl where bname in uname.
"& If user/s must be warned
if not warn is initial.
concatenate 'You will be logged off from client'
client
'in 10 seconds.' into temp_text separated by space.
call function 'TH_POPUP'
exporting
client = client
user = usr_tabl-bname
message = temp_text
exceptions
user_not_found = 1
others = 2.
"& Wait 10 seconds after warning user/s
wait up to 10 seconds.
endif.
"& Kick off user/s
call function 'TH_DELETE_USER'
exporting
user = usr_tabl-bname
client = client
exceptions
authority_error = 1
others = 2.
endloop.
"&Once the specified time is reached, stop logging user/s off.
if sy-uzeit >= time.
exit.
endif.
"& Wait the specified time before logging off user/s again.
wait up to interval seconds.
enddo.
"& Forms ***************************************************************
"&
"& Form F4_HELP_CHECK_UNAME
"&----
*
"& This is to show only logged on users when F4 is pressed on
"& user name.
"&----
*
"& -->P_UNAME_LOW text
"&----
*
form f4_help_check_uname using p_uname.
clear fields.
refresh fields.
clear valuetab.
refresh valuetab.
clear usr_tabl.
refresh usr_tabl.
"&Fill the structure table
fields-tabname = 'ZTSTSTRC'.
fields-fieldname = 'NAME'.
fields-selectflag = 'X'.
append fields.
clear fields.
fields-tabname = 'ZTSTSTRC'.
fields-fieldname = 'CLIENT'.
append fields.
clear fields.
"& Get the list of logged on users
call 'ThUsrInfo' id 'OPCODE' field opcode
id 'TAB' field usr_tabl-sys.
delete usr_tabl where bname = sy-uname and mandt = sy-mandt.
delete usr_tabl where bname is initial.
sort usr_tabl by mandt bname.
delete adjacent duplicates from usr_tabl comparing bname mandt.
"& Fill the value table
loop at usr_tabl.
valuetab-line = usr_tabl-bname.
append valuetab.
valuetab-line = usr_tabl-mandt.
append valuetab.
endloop.
"& Call the help value screen
call function 'HELP_VALUES_GET_WITH_TABLE'
exporting
title_in_values_list = ''
titel = 'Online Users'
importing
select_value = tmpuname
tables
fields = fields
valuetab = valuetab.
p_uname = tmpuname.
"&Change the client number to correspond with what user name the
"& user selects.
clear client.
read table usr_tabl with key bname = tmpuname.
client = usr_tabl-mandt.
endform. " f4_help_check_uname
Hope this solved your bussiness requirement.
Thanks,
Jayant
‎2008 Nov 25 3:35 PM
nope this doesnt work. I have used this in userexit SUSR0001 ( which called whenever user logs in ).
Do we have any system calls which we can use?
Thanks,
Krishna.
‎2008 Nov 25 3:36 PM
Can't you just lock the user instead of kicking him out as soon as he logs on?
Thomas
‎2008 Nov 25 4:34 PM
hi use this ..
CALL 'SYST_LOGOFF'.
this will definitely work . i tested well .
‎2008 Nov 25 4:38 PM