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: 

Host user name

enrique_ruiz
Explorer
0 Kudos

Hello, it's posible to know what is the host username connected to SAP?

SM04 has information of the client host address but not of the operating system user.

Thanks

1 ACCEPTED SOLUTION

martin_voros
Active Contributor
0 Kudos

Hi,

have a look at class CL_GUI_FRONTEND_SERVICES. There is a method which returns desktop user name. Obviously, this works only if used is logged on via SAP Gui.

Cheers

11 REPLIES 11

martin_voros
Active Contributor
0 Kudos

Hi,

have a look at class CL_GUI_FRONTEND_SERVICES. There is a method which returns desktop user name. Obviously, this works only if used is logged on via SAP Gui.

Cheers

enrique_ruiz
Explorer
0 Kudos

It's valid only for obtain the host user name of the user who is executing the method. I need to know the host user name for all the sessions opened in my system

0 Kudos

Hi,

you are right. That method works only for user who is executing code. I don't know about any method/function which would give you a list user names for each session.

I can give you a "simple" workaround. You could use SUSR0001 to store current desktop user name for each SAP user name. We can assume that desktop username can't change during GUI session. This user exit is called after dialog user logs on to system. So you can get desktop user name here and store it into DB or shared memory. Then in your report you just read current desktop name from DB or memory. The multiple logons for same user name might complicate it.

BTW what is your real requirement? Why do you need to know desktops user name for each user?

Cheers

0 Kudos

Hi,

Refer to julius statement on Su01 exit.

The SU01 exits are described in SAP Note 367660 (which is currently not released anymore at this moment as the exits are only available up to release 7.00) and are replaced by BADI's

Thanks,

Sri

0 Kudos

This thread is completely unrelated to the one you are linking to (SU01 exits)...

Enrique wants the user name logged onto the host machine of the frontend SAPGui.

@ Enrique: A way of doing this is to use the computer user's name as the principal SNC name and map it to the SAP user ID. Then activate SNC and deactivate the user's password. Works like a charm!

Cheers,

Julius

WolfgangJanzen
Product and Topic Expert
Product and Topic Expert
0 Kudos

>

> This thread is completely unrelated to the one you are linking to (SU01 exits)...

> Enrique wants the user name logged onto the host machine of the frontend SAPGui.

No, actuallly it's not.

One could call the method during the user-exit which is processed directly after a successful SAPGUI logon.

But he would have to persist the retrieved information in his own persistence - and he would have to make sure that he does some "house-keeping" (i.e. deleting the data when the user is logging off respectively when the connection between SAPGUI and ABAP server has dropped - for which no user-exit exists).

Yes, I would also be very keen in getting to know about the background of this requirement.

Sounds like someone is actually striving for a SSO solution. In that case, "SNC" is the keyword (just search for that in this forum and you should find some hits - but ensure to relax the date filter).

0 Kudos

> No, actuallly it's not.

Yes it is.

Sri's "contribution" here is easily confusing because she is posting the wrong information to the wrong thread and then cross-link-farming them as nested reference indexes for the rest of the internet...

The link to the other thread refers to SU01 exits for the naming convention of the ABAP user ID (SU01). Sri then hijacked the other thread with irrelevant information about SUSR0001 (the logon user exit <-- also irrelevant).

It is only in this thread where information about SUSR0001 is relevant, but Sri still managed to mention SAP Note 367660 in it now (also irrelevant) which relates to the other thread and SU01.

So two wrongs don't make a right, even although the exits are in the same package

> Sounds like someone is actually striving for a SSO solution.

That is why I also wanted to know what good could come of this. I have seen something similar once before "in the wild" and it was to ensure that the password was sent for the correct user ID name - incase they happened to have been the same for a different user. They also called it SSO...

Cheers,

Julius

0 Kudos

>

and he would have to make sure that he does some "house-keeping" (i.e. deleting the data when the user is logging off respectively when the connection between SAPGUI and ABAP server has dropped - for which no user-exit exists).

Actually, I think that in this case you don't need to do "house-keeping". You can have a table with latest desktop username for each user. We can assume that username can't change during logon session and user exit is called at start of each session. So you can use standard SM04 functioanlity to get list of current users and just read desktop username for each user from your table. If you want to avoid query to DB you can try to use shared memory. I am not sure how it works for multiple applicaiton servers.

BTW my first guess was that Enrique is trying to catch users who share logon details.

Cheers

0 Kudos

> BTW my first guess was that Enrique is trying to catch users who share logon details.

There is a SAP standard table (usr41_mld) and procedure in the logon program for that, so no need to re-invent anything.

I think that Enrique wants to force people to use their own PC only, and the reason for that might have something to do with not changing the user ID as the logon either fails or if worst comes worse then it is successfull...

Enrique: please enlighten our curiosity?

Former Member
0 Kudos

This message was moderated.

Former Member
0 Kudos

This message was moderated.