cancel
Showing results for 
Search instead for 
Did you mean: 

cl_gui_frontend_services is return null

Former Member
0 Kudos

Hi ALL.

call method cl_gui_frontend_services=>get_user_name

changing

user_name = win_username

exceptions

cntl_error = 2

error_no_gui = 3

not_supported_by_gui = 4

others = 5.

call method cl_gui_cfw=>flush.

When i run the function . win_username return is null.

Thanks!

james

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

Hi,

Use the Function module below to fetch the login user.

HR_GET_EMPLOYEES_FROM_USER

Also refer the below thread where I gave detailed answer

Edited by: suman kumar chinnam on Jul 27, 2009 2:14 PM

Former Member
0 Kudos

Hi all,

thanks for your reply.

call method cl_gui_frontend_services=>get_user_name

changing

user_name = win_username

exceptions

cntl_error = 2

error_no_gui = 3

not_supported_by_gui = 4

others = 5.

call method cl_gui_cfw=>flush.

If i run it direct then can get user_name, but if i run it in backgroud then return is null.

the selection is same.

james

thomas_jung
Developer Advocate
Developer Advocate
0 Kudos

In background you have the same problem as WDA - no connection to SAPGUI. This Class is specific to the SAPGUI and only functions via its connection to the SAPGUI.

Former Member
0 Kudos

Hi thomas,

our sap system is ecc6.0. how to solution this issue?

Thanks!

james

Former Member
0 Kudos

Hi James,

If it is a user name that you want, You can make use of the system field sy-uname to get the current user.

Regards,

Rajesh

Former Member
0 Kudos

please to view the detail and reply.

thomas_jung
Developer Advocate
Developer Advocate
0 Kudos

What exactly are you trying to do? Do you really need the desktop client user id or will the SAP or Portal user ID work? You simply can't use the CL_GUI_* classes in Web Dynpro ABAP. Best you could do is to call a BSP application first that contain the necessary ActiveX calls to get the windows user id. You can then pass the information via URL parameter as you navigate from the BSP application to the WDA.

Former Member
0 Kudos

Hi Thomas,

I write a program to cath the windows id. the program is run very night, as complany policy, company want to get the windows ID. so i run the report every night.

Thanks

james

thomas_jung
Developer Advocate
Developer Advocate
0 Kudos

If you are talking about a batch job, then what exactly does this have to do with Web Dynpro ABAP? Just because something is company policy doesn't mean it is possible. In fact it doesn't really make sense. When you run in a batch job you only have a connection to the user the job runs under. Why would you need to the know the windows user ID? None of this makes any sense.

Former Member
0 Kudos

Hi thomas,

The boss want to get windows user id,my task is to get windows user id. my problem is only to get windows user id in backgroud.

Thanks!

james

thomas_jung
Developer Advocate
Developer Advocate
0 Kudos

Get the windows user id for whom? Just for the current logged in user? Even if CL_GUI_FRONTEND_SERVICES worked in the background or in WDA - that's all it would give you. Are you trying to get the Windows User for all SAP accounts? If so it wouldn't make sense to use CL_GUI_FRONTEND_SERVICES to do that. It just sees via the OS on the desktop who is currently logged in. If that is the case then it sounds something like you should do with the LDAP connector and lookup via a central direcotry (like perhaps Microsoft Active Directory).

Former Member
0 Kudos

Hi Thomas,

I want to monitor the user that change production order.if user change production order will get user windows ID by user exit , we change production order by rfc(VB program), may be the users with the same SAP uer id. so i want to get windows

user id.

THAKS!

JAMES

Former Member
0 Kudos

Hi

Same issue is raised in the following thread please look into it.

I think there is no direct chance from WebDynpro Abap side

Thanks

Tulasi

uday_gubbala2
Active Contributor
0 Kudos

Hi James,

The cl_gui_frontend_services=>get_user_name is SAP GUI specific and you cannot use this from your broswer. Try go through these threads where the same issue has been discussed even earlier:

[Fetching login details from portal and passing to web dynpro.How its done?|;

[windows user name in webdynpro abap|;

[WD Abap - get system (windows) user|;

Regards,

Uday