2016 May 18 3:23 PM
Hello,
i get a user list in a report:
CALL FUNCTION 'TH_USER_LIST'
TABLES
list = gi_user_list
EXCEPTIONS
auth_misssing = 1
OTHERS = 2.
So I will get the user sessions which are online on the instance where I start the report. I take also the server list with TH_SERVER_LIST and kill the users with
CALL FUNCTION 'TH_DELETE_USER'
DESTINATION gwa_server-name
EXPORTING
user = g_user
client = g_mand
EXCEPTIONS
authority_error = 1.
But if one user is only logged in an other application server he will not be killed.
Is there a solution where I can get the user list of all application servers and so I can end all the sessions? Or, is there a function module which end all sessions on all application servers?
2016 May 18 3:56 PM
To my knowledge the FM 'TH_USER_LIST' will give you all the users (get the list using the parameter USRLIST and not LIST from the FM) list who are logged into all the application servers (that you can see in SM51).
So, I think you are good with it. Just try and let me know.
-Chandra
2016 May 18 3:56 PM
To my knowledge the FM 'TH_USER_LIST' will give you all the users (get the list using the parameter USRLIST and not LIST from the FM) list who are logged into all the application servers (that you can see in SM51).
So, I think you are good with it. Just try and let me know.
-Chandra
2021 Jan 11 7:21 PM
Hi chandra,
I am facing the same issue.
Not able to logh off the user when there are multiple server present in the system.
I have one internal table that is having logged in user with server name after that I am not able to log all of them. Few are getting logged but few are not.
I am using FM TH_DELETE_USER
Please help.
2016 May 19 10:40 PM
Isn't there some kind of a standard functionality for this that Basis uses? Why do you need a custom report for this?
2021 Jan 11 7:55 PM
This code will do what you want:
METHOD delete_user_session.
DATA:
lt_servers TYPE tt_msxxlist,
lt_uinfo TYPE tt_uinfo,
lt_usrlist TYPE tt_usrlist.
CALL FUNCTION 'TH_SERVER_LIST'
TABLES
list = lt_servers
EXCEPTIONS
no_server_list = 1
OTHERS = 2
##FM_SUBRC_OK.
CALL FUNCTION 'TH_USER_LIST'
TABLES
list = lt_uinfo
usrlist = lt_usrlist
EXCEPTIONS
auth_misssing = 1
OTHERS = 2
##FM_SUBRC_OK.
LOOP AT lt_servers ASSIGNING FIELD-SYMBOL(<ls_server>).
LOOP AT lt_usrlist
ASSIGNING FIELD-SYMBOL(<ls_user>)
WHERE bname EQ iv_bname.
CALL 'ThSndDelUser'
ID 'MANDT' FIELD sy-mandt
ID 'BNAME' FIELD <ls_user>-bname
ID 'SERVER' FIELD <ls_server>-name
ID 'TID' FIELD <ls_user>-tid.
ENDLOOP.
ENDLOOP.
ENDMETHOD.
Complete class is available here: https://github.com/keremkoseoglu/ABAP-Library/blob/master/basis/zcl_bc_sap_system.abap
2021 Jan 13 10:46 AM
Hi kerem,
I tried this but TH_USER_LIST is not giving all the users that are in AL08.
So I can't use this FM.
Is there any other way of doing this?
2021 Jan 13 10:50 AM
priya_ind if you check the code of AL08, you can see how this TCode reads the users. You can mimic that easily.
Code excerpt from SE38 - RSM04000_ALV_NEW:
FORM build_list.
DATA: session_list TYPE ssi_session_list,
server_info TYPE REF TO cl_server_info.
TRY.
CREATE OBJECT server_info.
IF is_system_client = 'X'.
session_list = server_info->get_session_list( with_application_info = with_appl_info ).
ELSE.
session_list = server_info->get_session_list( tenant = sy-mandt with_application_info = with_appl_info ).
ENDIF.
CATCH cx_ssi_no_auth.
MESSAGE e150 WITH TEXT-100.
ENDTRY.
SORT session_list BY tenant user_name.
PERFORM map_session_list USING session_list
CHANGING session_alv_table.
ENDFORM. "build_list
2021 Jan 13 11:22 AM
Hi kerem
I have used FM TH_SYSTEMWIDE_USER_LIST to fetch list of AL08 users which is working fine then I have looped that list and passed the username to fm TH_DELETE_USER to log them off but they are not getting logged off from quality as there are 2 servers but in development there is 1 server so its working completely.
Could you please provide me with the abap code to resolve this.
Thanks in advance!!
2021 Jan 13 11:28 AM
priya_ind did you check my sample code carefully? Did you call TH_SERVER_LIST first, and loop through it?