Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Get Windows User in ABAP - Webservice

Former Member
0 Kudos

Hi all,

i need the windows user in an ABAP Webservice.

I have found many solutions (e.g. cl_gui_frontend_services->get_user_name or function modules GUI_GET_DESKTOP_INFO, WS_QUERY ....)

But these solutions are only working if you are connected via SAP GUI to the SAP system.

I want to trigger the web service not via SAP GUI.

Is there a possiblility to get the Windows user in ABAP without the need of the SAP GUI?

regards

7 REPLIES 7

athavanraja
Active Contributor
0 Kudos

from which environment you are trying to read the windows user? from a web app?

Former Member
0 Kudos
  • via sapgui --> use your method

  • not via sapgui --> read field 'sy-uname' for sap user name. As far as i remember we didn't make a Windows user for access to a sap webservice. You only need a sap user and password to access the webservice; the calling system sends a request with sap user and password, and not necessarily any Windows involved there either.

Hope this helps,

Rolf

Former Member
0 Kudos

Hi,

there is a security problem because of the different environments windows/sap.

Solution:

On the windows side i have a kerberos token for authentication. (fasade service 1)

On the sap side i use the sy-uname. (fasade service 2)

And the service which uses the fasade services is an email service.

regards

0 Kudos

you can get the windows logged on (network) id from a vbscript/javascript (which uses windows script host) vbscript code would look like below


Dim mynw
set mynw = createobject("WSCRIPT.Network")
dim uid
uid=mynw.UserName

if you let me know from where you are trying to get this, can come up with alternate approach. (from web application? or from some other approach)

0 Kudos

Hi, I have the same problem - getting Windows user name from WebDynpro (ABAP). Have you any idea how to call your piece a code from there?

Thanks,

Adam

Former Member
0 Kudos

Issue: I need to determine a windows user in my WebDynpro (ABAP ) application. I do it on a following way:

Instead of calling my WebDynpro application directly I call my own BSP getuser, the link to the my WebDynpro will be transferred as page attribute <wd_url> (auto).

Important: the WebDynpro link has to be percent-encoded, e.g. the link:

[https://...../sap/bc/webdynpro/sap/z_my_webdynpro?sap-client=500&sap-language=E]

should look like as:

[http://https%3A%2F%2F.....%2Fsap%2Fbc%2Fwebdynpro%2Fsap%2Fz_my_webdynpro%3Fsap-client%3D500%26sap-language%3DE]

Example:

Call BSP

[http://.../sap/bc/bsp/sap/zcallwd/getuser.htm?wd_url=<wd_link_percent_encoded>]

BSP Flow Logic:

<form name="form1" action="<%= wd_url%>" method="POST">
<input type="hidden" name="user" type="text" value="<%= user%>">
</form>

< script language="vbScript">
Dim uname
Set ows = CreateObject("WSCRIPT.Network")
uname = ows.UserName
document.form1.user.value = uname
</script>

< script language="javascript">
document.form1.submit();
</script>

As you can see, the user will be transferred to the WebDynpro call via POST method here - as part of the data body and will not be visible in the WebDynpro URL. Instead of POST you can use GET, too, the parameter &lt;user&gt; will be visible in WebDynpro URL then.

I know itu2019s a little bit complicated, but it function very well.

Regards,

Adam

0 Kudos

Hello Adam,

could you please help me  about this solution ?

I want to get windows user id ?

I DEVELOPED WDA.

.

Please help me BSP application step by step , to call WDA.