Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Terminal id(TID) for loging user

Former Member
0 Kudos

Hi All,

How to get the terminal id for loging user ? I want to use FM 'THUSRINFO' which gives details of all login user but if a same user has multiple session from same host then how to know the TID of any specific session?

Regards,

Anuj

1 ACCEPTED SOLUTION

kesavadas_thekkillath
Active Contributor
0 Kudos

Have a look at TERMINAL_ID_GET, it gives an exception for multiple terminal id. Just have a look into the code. It will take you to table USR41.

4 REPLIES 4

Former Member
0 Kudos

Why not do a where used list of this FM and see how SAP uses it??

Rob

kesavadas_thekkillath
Active Contributor
0 Kudos

Have a look at TERMINAL_ID_GET, it gives an exception for multiple terminal id. Just have a look into the code. It will take you to table USR41.

Former Member
0 Kudos

Thanks keshav,

table usr41 only maintained terminal id for user which is login through sapgui.In my case i want to track the terminal id of those users which has been logged through erp connecter .

kernal CALL 'ThUsrInfo' is maintaing logs for all users with respective tid but how to track those erp connector users is a question ?

Regards,

Anuj jain

0 Kudos

This seems to work for me, had the same problem with multiple logins from same client terminal:

constants: opcode_list type x value 2.
   data: begin of ls_usr_tabl.
           include structure uinfo.
   data: end of ls_usr_tabl.
   data: lt_usr_tabl like table of ls_usr_tabl.
   data l_session_id type thfb_session_id.
   data lt_tech_info type standard table of techinfo.
   data ls_tech_info like line of lt_tech_info.

call 'ThUsrInfo' id 'OPCODE' field opcode_list
     id 'TAB' field lt_usr_tabl.


call function 'TH_GET_SESSION_ID'
       importing
         session_id = l_session_id.


loop at lt_usr_tabl into ls_usr_tabl where bname = sy-uname and type = 4.
     clear lt_tech_info.
       call function 'TH_SHOW_USR_DETAILS'
         exporting
           term_id                       = ls_usr_tabl-tid
         tables
           tech_info                     = lt_tech_info
         exceptions
           others                        = 10.
       if sy-subrc <> 0.
         continue.
       endif.
       read table lt_tech_info into ls_tech_info with key field = 'session_id'.
       if ls_tech_info-value ne l_session_id.
         continue.
       else.
         no_modes = ls_usr_tabl-extmodi.

       exit.

      endif.
endloop.