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: 

how to know the name of the local PC

Former Member
0 Kudos

Hi all,

Is there a way to find out in an ABAP program the name of the local PC from which the user is running this program? (it runs in foreground)

An user can be logged on from several PC's at the same time so we need to know exactly from which PC he's working...

thanks,

Ioana

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi,

Go to SM04 transaction which gives the list of users logged on to SAP & their PC details.

Hope this clarifies your doubt.

Rgds,

8 REPLIES 8

Former Member
0 Kudos

Hi,

Go to SM04 transaction which gives the list of users logged on to SAP & their PC details.

Hope this clarifies your doubt.

Rgds,

0 Kudos

Hi,

The problem is that the user can be logged on from several PC's at the same time. How do I know from which PC he's running my program?

Thanks,

Ioana

0 Kudos

Hi,

In your ABAP Program , you can use the FM TH_USER_INFO to determine that.

Don't forget to reward if it helps...:-)

Regards,

Anand Mandalika.

andreas_mann3
Active Contributor
0 Kudos

Hi Ioana,

look here

Andreas

0 Kudos

Hi,

try this:

  CALL METHOD cl_gui_frontend_services=>get_computer_name
    CHANGING
     computer_name = str.

  CALL METHOD cl_gui_cfw=>flush.

Andreas

0 Kudos

Hi Andreas,

this one is working fine, if I'm connected with the SAPGUI. Do you know, if this is also working with portals? Our users are using Portals in Production, but we don't have them in Development to test this.

Thanks for a hint

Chris

Former Member
0 Kudos

Hi Ioana,

I hope you had a chance to look at my answer to your VB script/Word template question... (I think it may be a cleaner way of solving your problem)

Anyway, to answer this question, try the following:


* Include at the top of your program:
  INCLUDE RSUSRCOM.
  INCLUDE TSKHINCL.

* Direct kernel call to get user data.
  call 'ThUsrInfo' id 'OPCODE' field opcode_list
    id 'TAB' field usr_tabl-*sys*.

* The table usr_tabl-*sys* will be populated with a list of users
* and the terminal they are logged on with.

This is quite a technical solution, and as its a direct kernel call, it may not be very upgrade compatible, but it will provide the data you are looking for.

Cheers,

Brad

SaiKondapaneni
Explorer
0 Kudos

FM-> GUI_GET_DESKTOP_INFO

& type will be one of the following depends upon your requirement.

Computername...........1..

Windows Directory......2..

System Directory.......3..

Temp Directory.........4..

User Name (Desktop)....5..

Platform...............6..

Build Number...........7..

OS Version.............8..

Program Name...........9..

Program Path...........10.

Current Directory......11.

Desktop Directory......12.

thanks

sai