CMOD 出口
SUSR0001
*&---------------------------------------------------------------------* *& 包含 ZXUSRU01 *&---------------------------------------------------------------------* DATA LS_ZUSERLOGINFO TYPE ZUSERLOGINFO. DATA LS_ZUSERLOGINFO_TMP TYPE ZUSERLOGINFO. DATA LT_ZUSERLOGINFO TYPE TABLE OF ZUSERLOGINFO. DATA LT_LIST TYPE TABLE OF MSXXLIST. DATA LS_LIST TYPE MSXXLIST. DATA LV_COUNT TYPE I. DATA LT_LIST2 TYPE TABLE OF UINFO. DATA LS_LIST2 TYPE UINFO. DATA LV_TID TYPE SY-INDEX. SELECT * FROM ZUSERLOGINFO INTO TABLE LT_ZUSERLOGINFO WHERE ENAME = SY-UNAME. IF LT_ZUSERLOGINFO IS NOT INITIAL. SORT LT_ZUSERLOGINFO BY SEQUENCE DESCENDING. CLEAR LS_ZUSERLOGINFO_TMP. READ TABLE LT_ZUSERLOGINFO INTO LS_ZUSERLOGINFO_TMP INDEX 1. LS_ZUSERLOGINFO_TMP-SEQUENCE = LS_ZUSERLOGINFO_TMP-SEQUENCE + 1. ENDIF. CLEAR LS_ZUSERLOGINFO. LS_ZUSERLOGINFO-SEQUENCE = LS_ZUSERLOGINFO_TMP-SEQUENCE. CALL FUNCTION 'TH_USER_INFO' IMPORTING TERMINAL = LS_ZUSERLOGINFO-ZTERM ADDRSTR = LS_ZUSERLOGINFO-IP TID = LV_TID. TRANSLATE LS_ZUSERLOGINFO-ZTERM TO UPPER CASE. LS_ZUSERLOGINFO-ENAME = SY-UNAME. LS_ZUSERLOGINFO-LOGON_DATE = SY-DATUM. LS_ZUSERLOGINFO-LOGON_TIME = SY-UZEIT. SELECT SINGLE SERVER INTO LS_ZUSERLOGINFO-SERVER FROM USR41 WHERE BNAME = SY-UNAME AND TERMID = LV_TID. CALL FUNCTION 'TH_SERVER_LIST' TABLES LIST = LT_LIST EXCEPTIONS NO_SERVER_LIST = 1 OTHERS = 2. IF SY-SUBRC <> 0. * Implement suitable error handling here ENDIF. CLEAR LS_LIST. CLEAR LV_COUNT. DATA LV_SRVNAME TYPE SPFID-APSERVER. LOOP AT LT_LIST INTO LS_LIST. CLEAR LV_SRVNAME. LV_SRVNAME = LS_LIST-NAME. CALL FUNCTION 'TH_REMOTE_USER_LIST' EXPORTING SRVNAME = LV_SRVNAME TABLES LIST = LT_LIST2 EXCEPTIONS ARGUMENT_ERROR = 1 SEND_ERROR = 2 OTHERS = 3. IF SY-SUBRC <> 0. * Implement suitable error handling here ENDIF. CLEAR LS_LIST2. LOOP AT LT_LIST2 INTO LS_LIST2 WHERE TYPE = '4'. LV_COUNT = LV_COUNT + 1. ENDLOOP. ENDLOOP. LS_ZUSERLOGINFO-ONLINE_MAX = LV_COUNT. DATA LV_NAME TYPE STRING. CLEAR LV_NAME. CALL METHOD CL_GUI_FRONTEND_SERVICES=>GET_USER_NAME CHANGING USER_NAME = LV_NAME EXCEPTIONS CNTL_ERROR = 1 ERROR_NO_GUI = 2 NOT_SUPPORTED_BY_GUI = 3 OTHERS = 4. CALL METHOD CL_GUI_CFW=>UPDATE_VIEW. IF SY-SUBRC = 0. LS_ZUSERLOGINFO-ZOSNAME = LV_NAME. ENDIF. "版本 DATA LT_USR_TABL TYPE TABLE OF UINFO. DATA LS_USR_TABL TYPE UINFO. CALL FUNCTION 'THUSRINFO' TABLES USR_TABL = LT_USR_TABL. CLEAR LS_USR_TABL. READ TABLE LT_USR_TABL INTO LS_USR_TABL WITH KEY TID = LV_TID. IF LS_USR_TABL IS NOT INITIAL. LS_ZUSERLOGINFO-GUIVERSION = LS_USR_TABL-GUIVERSION. ENDIF . CALL FUNCTION 'RS_DME_MG_GENERATE_GUID' IMPORTING E_GUID_32 = LS_ZUSERLOGINFO-GUID. MODIFY ZUSERLOGINFO FROM LS_ZUSERLOGINFO.View Code
标签:ZUSERLOGINFO,登录,DATA,用户,LT,LV,ABAP,LS,TYPE From: https://www.cnblogs.com/wangzuoer/p/17918462.html