Collect SAPGUI patch numbers

Learn how to collect SAPGUI patch numbers and other logon information like hostname, userid, O/S, IP address and put it in a custom table.

We collect SAPGUI patch numbers and other logon information like hostname, userid, O/S, IP address and put it in a custom table. This allows us to easily see what computers need to be patched. We also highlight duplicates which alerts us to users that are trying to share userids. We have an R/3 4.6C system but it should work for other 4.* systems.


We have done this by activating the user exit SUSR0001 (Tcode CMOD-> Utilities -> SAP Enhancements -> F8 Execute). The primary keys we have are:- MANDT USER_ID COMPUTER_NAME ZFILL1 is a data element with the following definition: Elementary type Domain CHAR01 Data type CHAR Length 1 Decimal pl. 0

The table zlogoninfo was created with the following fields:-

MANDT    MANDT  CLNT 3
USER_ID    XUBNAME CHAR 12
COMPUTER_NAME  RFCDEST CHAR 32
USER_OS   SYOPSYS CHAR 10
IP_ADDR RFC   IPADDR  CHAR 15
GUI    SYKERNRL CHAR 4
GUI_PATCH   CHAR30  CHAR 30
DUP_FLG   ZFILL1  CHAR 1
LAST_LOGON_DT   XULDATE DATS 8
LAST_LOGON_TM   XULTIME  TIMS 6

Our user exit has the following code:- 

*----------------------------------------------------------------------*
*   INCLUDE ZXUSRU01                                                   *
*----------------------------------------------------------------------*

* Definitions
* Table to hold user logon information
Tables: Zlogoninfo.

Data Begin of Logon_Dta.
        Include structure Zlogoninfo.
Data End of Logon_Dta.

Data: RFC_Data        like RFCSI,
      Duplicate_Flag  Type c,
      Patch_Level     like CNTLSTRINF-VERSION.

* Pick up Logon information
CALL FUNCTION 'RFC_SYSTEM_INFO' DESTINATION 'SAPGUI'
 IMPORTING
   RFCSI_EXPORT             = RFC_Data.

* Pick up the GUI patch level
CALL FUNCTION 'GUI_GET_FILE_INFO'
     EXPORTING
          FNAME        = 'SAPGUI.EXE'
     IMPORTING
          FILE_VERSION = Patch_Level.

* GUI Patch Level not found
IF SY-SUBRC <> 0.
  Move 'Not Found' to zlogoninfo-Gui_Patch.
ENDIF.

* Check if user has already signed on.
Select Single * from zlogoninfo where user_id  = Sy-Uname
                And              Computer_name = RFC_Data-RFCDest.

* If no record found... add new record otherwise change record If sy-subrc <> 0.
  Logon_Dta-User_Id       = Sy-Uname.
  Logon_Dta-Computer_Name = RFC_Data-RFCDest.
  Logon_Dta-User_OS       = RFC_Data-RFCopSys.
  Logon_Dta-IP_Addr       = RFC_Data-RFCIPAddr.
  Logon_Dta-GUI           = RFC_Data-RFCKERNRL.
  Logon_Dta-GUI_Patch     = Patch_Level.
  Logon_Dta-Dup_Flg       = ' '.
  Logon_Dta-Last_Logon_DT = Sy-Datum.
  Logon_Dta-Last_Logon_TM = Sy-Uzeit.
* Check if user ID exists in the table.  If it does update the flag
  Clear Duplicate_Flag.
  Select Single * from zlogoninfo where user_id  = Sy-Uname.
  If sy-subrc = 0.
    Duplicate_Flag = 'X'.
  EndIF.
* Check if Computer name xists in the table.  If it does update the flag
  Select Single * from zlogoninfo
                  where Computer_Name = RFC_Data-RFCDest.
  If sy-subrc = 0.
    Duplicate_Flag = 'X'.
  EndIF.
  Logon_Dta-Dup_Flg  = Duplicate_Flag.
  Insert into Zlogoninfo values Logon_Dta.
  If sy-subrc <> 0.
  EndIF.
Else.
  Zlogoninfo-User_OS       = RFC_Data-RFCopSys.
  Zlogoninfo-IP_Addr       = RFC_Data-RFCIPAddr.
  Zlogoninfo-GUI           = RFC_Data-RFCKERNRL.
  Zlogoninfo-GUI_Patch     = Patch_Level.
  Zlogoninfo-Last_Logon_DT = Sy-Datum.
  Zlogoninfo-Last_Logon_TM = Sy-Uzeit.
  Update Zlogoninfo.
EndIF.
This was first published in January 2005

Dig deeper on SAP Basis administration and NetWeaver administration

Pro+

Features

Enjoy the benefits of Pro+ membership, learn more and join.

0 comments

Oldest 

Forgot Password?

No problem! Submit your e-mail address below. We'll send you an email containing your password.

Your password has been sent to:

-ADS BY GOOGLE

SearchManufacturingERP

SearchOracle

SearchDataManagement

SearchAWS

SearchBusinessAnalytics

SearchCRM

SearchContentManagement

SearchFinancialApplications

Close