You need to know that your users are using the correct version of the SAP GUI before you upgrade the back-end system. SAP provides a user-exit since at least version 3.1H where you can run your own custom code immediately after users log in. The code and the process below work in 3.1H to 4.6C.
1. Create a custom table to track the additional data during login. I called mine ZUSR41 and added the following fields (data elements in parenthesis):
MANDT (MANDT)
DATUM (XULDATE)
UNAME (XUBNAME)
SEQNR (SEQNR)
UZEIT (XULTIME)
RFCDEST (RFCDEST)
RFCIPADDR (RFCIPADDR)
RFCOPSYS (SYOPSYS)
WS (SYOPSYS)
RFCSAPRL (SYSAPRL)
2. In CMOD create a project and add SAP enhancement SUSR001. In function module EXIT_SAPLSUSF_001 double-click the include program ZXUSRU01 to create it. Insert the following code:
TABLES:
rfcsi, " Structure for RFC_SYSTEM_INFO
zusr41. " Data stored at login
DATA:
lv_hostadr LIKE msxxlist-hostadr,
lv_dec TYPE i.
* Get information about the user's GUI.
CLEAR rfcsi.
CALL FUNCTION 'RFC_SYSTEM_INFO'
DESTINATION 'SAPGUI'
IMPORTING
rfcsi_export = rfcsi
EXCEPTIONS
OTHERS = 1.
* Some versions of SAP GUI don't return the hostname or IP address;
* call TH_USER_INFO to get the missing info.
IF rfcsi-rfcdest IS INITIAL
OR rfcsi-rfcipaddr IS INITIAL.
CLEAR lv_hostadr.
CALL FUNCTION
Requires Free Membership to View
'TH_USER_INFO'
IMPORTING
hostaddr = lv_hostadr
terminal = rfcsi-rfcdest
EXCEPTIONS
OTHERS = 1.
* Convert the IP address from hex form.
lv_dec = lv_hostadr+0(1).
WRITE lv_dec TO rfcsi-rfcipaddr+0(3) LEFT-JUSTIFIED.
rfcsi-rfcipaddr+3(1) = '.'.
lv_dec = lv_hostadr+1(1).
WRITE lv_dec TO rfcsi-rfcipaddr+4(3) LEFT-JUSTIFIED.
rfcsi-rfcipaddr+7(1) = '.'.
lv_dec = lv_hostadr+2(1).
WRITE lv_dec TO rfcsi-rfcipaddr+8(3) LEFT-JUSTIFIED.
rfcsi-rfcipaddr+11(1) = '.'.
lv_dec = lv_hostadr+3(1).
WRITE lv_dec TO rfcsi-rfcipaddr+12(3) LEFT-JUSTIFIED.
CONDENSE rfcsi-rfcipaddr NO-GAPS.
ENDIF.
CLEAR zusr41.
* Get "Windows System" (also Mac, etc.). Some versions of the SAP GUI
* return a misleading operating system name -- call WS_QUERY to get
* additional info.
CALL FUNCTION 'WS_QUERY'
EXPORTING
query = 'WS'
IMPORTING
return = zusr41-ws
EXCEPTIONS
inv_query = 1
no_batch = 2
frontend_error = 3
OTHERS = 4.
* Record date, time, and user in the ZUSR41 work area.
zusr41-datum = sy-datum.
zusr41-uname = sy-uname.
zusr41-uzeit = sy-uzeit.
* Find the last sequence number for this date and user, then increment
* by 1 to ensure a unique key.
SELECT MAX( seqnr )
INTO zusr41-seqnr
FROM zusr41
WHERE datum = zusr41-datum
AND uname = zusr41-uname.
ADD 1 TO zusr41-seqnr.
* Record the login data in the ZUSR41 work area.
MOVE-CORRESPONDING rfcsi TO zusr41.
* Store that login data in the database.
INSERT zusr41.
COMMIT WORK.
3. Back in CMOD activate your project.4. Log in to test!
This was first published in July 2002

Join the conversationComment
Share
Comments
Results
Contribute to the conversation