SAP TH_USER_INFO Function Module for
TH_USER_INFO is a standard th user info SAP function module available within SAP R/3 or S/4 Hana systems, depending on your version and release level. It is used to perform a specific ABAP function and below is the pattern details, showing its interface including any import and export parameters, exceptions etc. there is also a full "cut and paste" ABAP pattern code example, along with implementation ABAP coding, documentation and contribution comments specific to this or related objects.
See here to view full function module documentation and code listing for th user info FM, simply by entering the name TH_USER_INFO into the relevant SAP transaction such as SE37 or SE38.
Function Group: THFB
Program Name: SAPLTHFB
Main Program: SAPLTHFB
Appliation area: S
Release date: 24-Aug-1993
Mode(Normal, Remote etc): Normal Function Module
Update:

Function TH_USER_INFO pattern details
In-order to call this FM within your sap programs, simply using the below ABAP pattern details to trigger the function call...or see the full ABAP code listing at the end of this article. You can simply cut and paste this code into your ABAP progrom as it is, including variable declarations.CALL FUNCTION 'TH_USER_INFO'".
EXPORTING
* CLIENT = "
* USER = "
* CHECK_GUI = 0 "
IMPORTING
HOSTADDR = "IP address of the frontend computer
* GUI_CHECK_FAILED = "
* ADDRSTR = "
RC = "
TERMINAL = "Terminal of the user
ACT_SESSIONS = "
MAX_SESSIONS = "
MY_SESSION = "
MY_INTERNAL_SESSION = "
TASK_STATE = "
UPDATE_REC_EXIST = "
TID = "
IMPORTING Parameters details for TH_USER_INFO
CLIENT -
Data type: SY-MANDTOptional: Yes
Call by Reference: Yes
USER -
Data type: SY-UNAMEOptional: Yes
Call by Reference: Yes
CHECK_GUI -
Data type: SY-INDEXOptional: Yes
Call by Reference: Yes
EXPORTING Parameters details for TH_USER_INFO
HOSTADDR - IP address of the frontend computer
Data type: MSXXLIST-HOSTADROptional: No
Call by Reference: No ( called with pass by value option)
GUI_CHECK_FAILED -
Data type: SY-INDEXOptional: Yes
Call by Reference: No ( called with pass by value option)
ADDRSTR -
Data type: NI_NODEADDROptional: Yes
Call by Reference: No ( called with pass by value option)
RC -
Data type: IOptional: No
Call by Reference: No ( called with pass by value option)
TERMINAL - Terminal of the user
Data type:Optional: No
Call by Reference: No ( called with pass by value option)
ACT_SESSIONS -
Data type: SM04DIC-COUNTEROptional: No
Call by Reference: No ( called with pass by value option)
MAX_SESSIONS -
Data type: SM04DIC-COUNTEROptional: No
Call by Reference: No ( called with pass by value option)
MY_SESSION -
Data type: SM04DIC-COUNTEROptional: No
Call by Reference: No ( called with pass by value option)
MY_INTERNAL_SESSION -
Data type: SM04DIC-COUNTEROptional: No
Call by Reference: No ( called with pass by value option)
TASK_STATE -
Data type: SM04DIC-COUNTEROptional: No
Call by Reference: No ( called with pass by value option)
UPDATE_REC_EXIST -
Data type: THFB_BOOLOptional: No
Call by Reference: No ( called with pass by value option)
TID -
Data type: SY-INDEXOptional: No
Call by Reference: No ( called with pass by value option)
Copy and paste ABAP code example for TH_USER_INFO Function Module
The ABAP code below is a full code listing to execute function module POPUP_TO_CONFIRM including all data declarations. The code uses the original data declarations rather than the latest in-line data DECLARATION SYNTAX but I have included an ABAP code snippet at the end to show how declarations would look using the newer method of declaring data variables on the fly. This will allow you to compare and fully understand the new inline method. Please note some of the newer syntax such as the @DATA is not available until a later 4.70 service pack (SP8), which i why i have stuck to the origianl for this example.| DATA: | ||||
| lv_client | TYPE SY-MANDT, " | |||
| lv_hostaddr | TYPE MSXXLIST-HOSTADR, " | |||
| lv_gui_check_failed | TYPE SY-INDEX, " | |||
| lv_addrstr | TYPE NI_NODEADDR, " | |||
| lv_rc | TYPE I, " | |||
| lv_user | TYPE SY-UNAME, " | |||
| lv_terminal | TYPE SY, " | |||
| lv_check_gui | TYPE SY-INDEX, " 0 | |||
| lv_act_sessions | TYPE SM04DIC-COUNTER, " | |||
| lv_max_sessions | TYPE SM04DIC-COUNTER, " | |||
| lv_my_session | TYPE SM04DIC-COUNTER, " | |||
| lv_my_internal_session | TYPE SM04DIC-COUNTER, " | |||
| lv_task_state | TYPE SM04DIC-COUNTER, " | |||
| lv_update_rec_exist | TYPE THFB_BOOL, " | |||
| lv_tid | TYPE SY-INDEX. " |
|   CALL FUNCTION 'TH_USER_INFO' " |
| EXPORTING | ||
| CLIENT | = lv_client | |
| USER | = lv_user | |
| CHECK_GUI | = lv_check_gui | |
| IMPORTING | ||
| HOSTADDR | = lv_hostaddr | |
| GUI_CHECK_FAILED | = lv_gui_check_failed | |
| ADDRSTR | = lv_addrstr | |
| RC | = lv_rc | |
| TERMINAL | = lv_terminal | |
| ACT_SESSIONS | = lv_act_sessions | |
| MAX_SESSIONS | = lv_max_sessions | |
| MY_SESSION | = lv_my_session | |
| MY_INTERNAL_SESSION | = lv_my_internal_session | |
| TASK_STATE | = lv_task_state | |
| UPDATE_REC_EXIST | = lv_update_rec_exist | |
| TID | = lv_tid | |
| . " TH_USER_INFO | ||
ABAP code using 7.40 inline data declarations to call FM TH_USER_INFO
The below ABAP code uses the newer in-line data declarations. This allows you to see the coding differences/benefits of the later inline syntax. Please note some of the newer syntax below, such as the @DATA is not available until 4.70 EHP 8.| "SELECT single MANDT FROM SY INTO @DATA(ld_client). | ||||
| "SELECT single HOSTADR FROM MSXXLIST INTO @DATA(ld_hostaddr). | ||||
| "SELECT single INDEX FROM SY INTO @DATA(ld_gui_check_failed). | ||||
| "SELECT single UNAME FROM SY INTO @DATA(ld_user). | ||||
| "SELECT single INDEX FROM SY INTO @DATA(ld_check_gui). | ||||
| "SELECT single COUNTER FROM SM04DIC INTO @DATA(ld_act_sessions). | ||||
| "SELECT single COUNTER FROM SM04DIC INTO @DATA(ld_max_sessions). | ||||
| "SELECT single COUNTER FROM SM04DIC INTO @DATA(ld_my_session). | ||||
| "SELECT single COUNTER FROM SM04DIC INTO @DATA(ld_my_internal_session). | ||||
| "SELECT single COUNTER FROM SM04DIC INTO @DATA(ld_task_state). | ||||
| "SELECT single INDEX FROM SY INTO @DATA(ld_tid). | ||||
Search for further information about these or an SAP related objects