Application Development and Automation 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: 
Read only

How can i get user computer hostname?

Former Member
0 Likes
2,313

Experts:

How can i get user computer hostname in ABAP statement ?

Thanks a lot!

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,495

HI

Use class CL_GUI_FRONTEND_SERVICES and method GET_COMPUTER_NAME

GET_IP_ADDRESS

cl_gui_frontend_services=>get_computer_name(
  CHANGING
    computer_name        = computer_name ).
*  EXCEPTIONS
*    cntl_error           = 1
*    error_no_gui         = 2
*    not_supported_by_gui = 3
*    others               = 4
*       ).
 CALL METHOD cl_gui_cfw=>update_view.

Cheerz

Ram

6 REPLIES 6
Read only

Former Member
0 Likes
1,496

HI

Use class CL_GUI_FRONTEND_SERVICES and method GET_COMPUTER_NAME

GET_IP_ADDRESS

cl_gui_frontend_services=>get_computer_name(
  CHANGING
    computer_name        = computer_name ).
*  EXCEPTIONS
*    cntl_error           = 1
*    error_no_gui         = 2
*    not_supported_by_gui = 3
*    others               = 4
*       ).
 CALL METHOD cl_gui_cfw=>update_view.

Cheerz

Ram

Read only

0 Likes
1,495

CALL METHOD CL_GUI_FRONTEND_SERVICES=>GET_COMPUTER_NAME

CHANGING

COMPUTER_NAME = PCNAME.

u201CPCNAMEu201D is not type-compatible with formal parameter "computer_name".

I should how to define PCNAME?

Read only

0 Likes
1,495

Hi Andy,

If you need any further feel free to revert back

data : computer_name type string. " Declare it like this
start-of-selection. 
cl_gui_frontend_services=>get_computer_name(
  CHANGING
    computer_name        = computer_name ). " I Just executed this and working fine on ECC6.0
   EXCEPTIONS
     cntl_error           = 1
     error_no_gui         = 2
     not_supported_by_gui = 3
     others               = 4
       ).
 CALL METHOD cl_gui_cfw=>update_view.

Cheerz

Ram

Read only

0 Likes
1,495

very very thank.

Read only

venkat_o
Active Contributor
0 Likes
1,495

Hi, <li>Just use system variable SY-HOST. Thanks Venkat.O

Read only

shadow
Participant
0 Likes
1,495

Hi,

SY-HOST is the system variable for computer host name.

Thanks & Regards,

SHAIIK.