2005 Feb 16 7:11 AM
Hi All,
Is there FM/Method to get the user's system domain name?
There are some function modules and front-end call methods to get username,terminal name..etc but haven't come across one which gives the domain name.
Any feedback will be helpfull..
Cheers,
Nameeth
2005 Feb 16 8:03 AM
Hi Nameeth,
you could use
call function 'WS_QUERY'
exporting
environment = 'USERDOMAIN'
query = 'EN'
importing
return = _return_variable.
Yeah, it's an obsolete FM, and I've tried it just in Windows NT, but it may still work !!!
Please let us know if it was OK. BR,
Alvaro
Hi All,
Is there FM/Method to get the user's system domain name?
There are some function modules and front-end call methods to get username,terminal name..etc but haven't come across one which gives the domain name.
Any feedback will be helpfull..
Cheers,
Nameeth
2005 Feb 16 7:55 AM
Is it plain SAP or with HTPP(s)? If it's the latter you can always retrive the ip addresse (~remote_addr)
See http://help.sap.com/saphelp_erp2004/helpdata/en/c1/7f56d32e243141a1595268bfcf351a/frameset.htm
Have also a look at
2005 Feb 16 8:03 AM
Hi Nameeth,
you could use
call function 'WS_QUERY'
exporting
environment = 'USERDOMAIN'
query = 'EN'
importing
return = _return_variable.
Yeah, it's an obsolete FM, and I've tried it just in Windows NT, but it may still work !!!
Please let us know if it was OK. BR,
Alvaro
2005 Feb 16 8:28 AM
Hi Nameeth / Alvaro,
You wouldn't find this <i>obsolete</i>.
data front_end type ref to CL_GUI_FRONTEND_SERVICES.
data user_domain type string.
start-of-selection.
create object front_end.
CALL METHOD cl_gui_frontend_services=>environment_get_variable
EXPORTING
variable = 'USERDOMAIN'
CHANGING
value = user_domain
EXCEPTIONS
others = 4.
IF sy-subrc <> 0.
* Error Handling
ENDIF.
CALL METHOD CL_GUI_CFW=>FLUSH.Regards,
Anand Mandalika.
2005 Mar 22 1:11 PM
don't forget to reward points if you feel that your question is answered
2005 Mar 22 3:44 PM
Hi
The method Anand mentioned is the best. However you can also use the function module <b>'TH_USER_INFO'</b> as far as I remember.
*--Serdar <a href="https://www.sdn.sap.com:443http://www.sdn.sap.comhttp://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.sdn.businesscard.sdnbusinesscard?u=qbk%2bsag%2bjiw%3d">[ BC ]</a>
2005 Feb 16 8:06 AM
nameeth,
if you need the hostname of the server you're logged on to, the variable SY-HOST should give you what you need.
but if you need the hostname of the user logged on, take a look at program RSUSR000 (tcode AL08) - you should be able to extract the information you need with the code inside. but basically you get all the systems/instances for the server you're logged on, and determine the users on each server. from there it shouldn't be hard to read off the hostname of the user's login name.
<b>[edit]</b> ... and the code above should give you what you need too. heheh. not only did i not read your question correctly, but by the time i got to post, someone had something more correct posted already. 😃 <b>[/edit]</b>
hope this helps anyway,
ryan.
Message was edited by: Ryan Kristoffer Tan
Message was edited by: Ryan Kristoffer Tan
| User | Count |
|---|---|
| 6 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |