on 04-03-2008 10:06 AM
Hello
i have a Webdynpro application and must read out the windows user.
There a function-module named GUI_GET_DESKTOP_INFO.
With this function-module i get the windows-user.
Problem is that the function-module is obsolete and you should user the class CL_GUI_FRONTEND_SERVICES.
Here you have the method get_user_name.
But it doesn't work.
How can i read out the windows user?
It can be in the webdynpro application or coded in a function-module
Thanks for your help
H Denis,
We should use cl_gui_frontend_services=>get_user_name in combination with cl_gui_cfw=>update_view method.
Try this out, you must get the user value in variable l_user.
CALL METHOD cl_gui_frontend_services=>get_user_name
CHANGING
user_name = l_user
EXCEPTIONS
cntl_error = 1
error_no_gui = 2
not_supported_by_gui = 3
others = 4
.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ELSE.
CALL METHOD cl_gui_cfw=>update_view
EXCEPTIONS
cntl_system_error = 1
cntl_error = 2
OTHERS = 3.
ENDIF.
Hope this helps,
Sravan Varagani
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Dennis,
You can use it in your web dynpro application aswell. But handle the exceptions in WDA way and not as R/3.
Try the below in your WD component.
CALL METHOD cl_gui_frontend_services=>get_user_name
CHANGING
user_name = l_user
EXCEPTIONS
cntl_error = 1
error_no_gui = 2
not_supported_by_gui = 3
others = 4.
CALL METHOD cl_gui_cfw=>update_view
EXCEPTIONS
cntl_system_error = 1
cntl_error = 2
OTHERS
Regards,
Sravan Varagani
ok i tried it in wd but it doesn't work
l_user is empty and the methode returns 1
and cl_gui_cfw=>update_view returns 0
what's the problem?
in a function-module i get the dump:
Usage of local result variables in a control/automatic-request
what is here the problem?
Edited by: Denis Müller on Apr 3, 2008 12:23 PM
Hi Denis
Try this
FUNCTION yvsk_get_user_name.
*"----------------------------------------------------------------------
*"*"Local Interface:
*" EXPORTING
*" REFERENCE(E_USER_NAME) TYPE STRING
*"----------------------------------------------------------------------
CALL METHOD cl_gui_frontend_services=>get_user_name
CHANGING
user_name = e_user_name
EXCEPTIONS
cntl_error = 1
error_no_gui = 2
not_supported_by_gui = 3
OTHERS = 4.
CALL METHOD cl_gui_cfw=>update_view
EXCEPTIONS
cntl_system_error = 1
cntl_error = 2
OTHERS = 3.
ENDFUNCTION.
This works for me perfectly when executed from SE37.
Regards,
Sravan Varagani
User | Count |
---|---|
90 | |
10 | |
10 | |
10 | |
7 | |
7 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.