‎2004 Sep 09 2:15 PM
Hi!
I need to get the local User information from the client workstation - who is signed on at the client. Is there an ABAP-function available which reads the local user-id.
Thanks for your help!
Thomas
‎2004 Sep 09 2:42 PM
You can try
TH_USER_LIST
It returns a table of the user currently logged into the client.
Also
DATA: RETURN TYPE TABLE OF BAPIRET2,
user_data TYPE BAPIADDR3.
CALL FUNCTION 'BAPI_USER_GET_DETAIL'
EXPORTING
USERNAME = SY-UNAME
IMPORTING
ADDRESS = user_data
TABLES
RETURN = return.
‎2004 Sep 09 2:42 PM
Hi Thomas,
CL_GUI_FRONTEND_SERVICES->GET_USER_NAME
Grx Andreas
‎2004 Sep 09 4:05 PM
Hi Andreas!
I tried the Method GET_USER_NAME --> without a result. sy-subrc = 0 but the returnvalue doesn't contain the login-user.
Any Idea ??
Thomas
‎2004 Sep 09 7:31 PM
Typically the user that is login is kept in the value SY-UNAME in ABAP and BSP at least it is the right value.
‎2004 Sep 09 9:09 PM
Hi Thomas,
Are you looking for user id that login into SAP or user id that login into your PC?
‎2004 Sep 10 6:00 AM
I'm looking for the user ID logged in into my PC. No SAP-User !!
Thomas
‎2004 Sep 10 8:36 AM
Hi Thomas,
sorry for my first reply:
I've not tested the method before posting -
the method works but without result...
here's another solution - that works <b>with</b> result
CALL FUNCTION 'GUI_GET_DESKTOP_INFO'
EXPORTING
TYPE = 5
CHANGING
RETURN = name.
Grx Andreas
‎2004 Sep 10 8:45 AM
Did you flush after the call to get_user_name? You have to call cl_gui_cfw=>flush( ) after most calls to the frontend services class. The following code sample might help explain:
REPORT yes_tjung_flush_test .
DATA: username TYPE string.
CALL METHOD cl_gui_frontend_services=>get_user_name
CHANGING
user_name = username
EXCEPTIONS
cntl_error = 1
error_no_gui = 2
not_supported_by_gui = 3
OTHERS = 4.
IF sy-subrc <> 0.
ENDIF.
WRITE: / 'Test1', username.
cl_gui_cfw=>flush( ).
WRITE: / 'Test2', username.