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

system's Physical Address

Former Member
0 Likes
2,670

Hi,

If you go to command prompt, type IPCONFIG/all then you will get the physical address. Is it possible to know the same from SAP. Is there any FM or Class to get the same.

I got the IP Address using the class

CALL METHOD cl_gui_frontend_services=>get_ip_address

Thanks and Regards,

Prakash.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
2,191

Hello Prakash,

Use this Fm /SDF/SYSTEM_INFO.

If useful reward.

Vasanth

Hi,

If you go to command prompt, type IPCONFIG/all then you will get the physical address. Is it possible to know the same from SAP. Is there any FM or Class to get the same.

I got the IP Address using the class

CALL METHOD cl_gui_frontend_services=>get_ip_address

Thanks and Regards,

Prakash.

12 REPLIES 12
Read only

Former Member
0 Likes
2,192

Hello Prakash,

Use this Fm /SDF/SYSTEM_INFO.

If useful reward.

Vasanth

Read only

0 Likes
2,191

Sorry vasanth it's not working:

It will look like

Physical Address. . . . . . . . . : 00-14-C2-0F-6E-2E

Regards,

Prakash.

Read only

0 Likes
2,191

Any idea on this.....

Read only

0 Likes
2,191

Hi Mr.Ramu,

May be try to execute local shell script with WS_EXECUTE.

or

try this

CALL 'ThUsrInfo' ID

Regards

Vivekanand

Read only

0 Likes
2,191

Check the below code:

REPORT ysample60 .

DATA : o_alvgrid TYPE REF TO cl_gui_frontend_services.

DATA: ip_address TYPE char50.

CALL METHOD cl_gui_frontend_services=>get_ip_address

RECEIVING

ip_address = ip_address

EXCEPTIONS

cntl_error = 1

error_no_gui = 2

not_supported_by_gui = 3

OTHERS = 4.

IF sy-subrc <> 0.

MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno

WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

ENDIF.

IF NOT ip_address IS INITIAL.

write i_address.

ENDIF.

============================================

Also you can try this

FM <b>ARFC_GET_TID</b>will return the IP address of the terminal in hex. Again you have convert HEx to dec format.

Read only

0 Likes
2,191

This FM <b>TERMINAL_ID_GET</b> directly provides IP address. Tested working fine.

Regards

Vivek

Read only

0 Likes
2,191

Vivek,

Thanks for the effort.

But I don't want the IP Addess, I have already got that.

I want the <b>system's Physical address</b>.

Regards,

Prakash.

Read only

0 Likes
2,191

Hi,

This kind of information is highly dependent on the Operating System (I guess it is not the same for IP address ??)

Try creating an external command (say Y_MAC_ADDRESS) in <b>transaction SM69</b> based on this document and on your OS :

http://www-dcn.fnal.gov/DCG-Docs/mac/index.html

Then, run the <b>transaction SM49</b> with the new command.

To do it programmatically, use <b>FM 'SXPG_COMMAND_EXECUTE'</b> with the name of the external command (Y_MAC_ADDRESS) !

Best regards,

Guillaume

Read only

0 Likes
2,191

After some googling.. i found

A physical address is a unique hardware-level address associated with a specific network controller. A device's physical address is also called its Media Access Control (MAC) address. On Ethernet, the physical address is a six-byte hexadecimal number assigned by the Ethernet hardware manufacturer. For example:

0000D801CFF2

I dont think the same can be obtained from SAP. Also try to contact BASIS guys.

Regards

Vivek

Read only

0 Likes
2,191

Guillaume,

Thanks for your input.

Any idea what should be given in

Operating system command and

Parameters for operating system commands

I just tried with Operating system command = ipconfig/all. But is not working.

Regards,

Prakash.

Read only

0 Likes
2,191

Try this code:

If folder c:\temp\ doesnt exist, create or change to a different one.

data: appl type string,
      param type string.

data: gt_ipconfig type table of char255,
      gs_ipconfig type char255.

appl = 'cmd'.
param = '/c ipconfig /all>c:tempipconfig.txt'.

call method cl_gui_frontend_services=>execute
   exporting
*    DOCUMENT               = appl
     application            = appl
     parameter              = param
*    DEFAULT_DIRECTORY      =
*    MAXIMIZED              =
*    MINIMIZED              =
     synchronous            = 'X'
*    OPERATION              = 'OPEN'
  exceptions
    cntl_error             = 1
    error_no_gui           = 2
    bad_parameter          = 3
    file_not_found         = 4
    path_not_found         = 5
    file_extension_unknown = 6
    error_execute_failed   = 7
    synchronous_failed     = 8
    not_supported_by_gui   = 9
    others                 = 10
        .
if sy-subrc <> 0.
  message id sy-msgid type sy-msgty number sy-msgno
             with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
endif.

call function 'GUI_UPLOAD'
  exporting
    filename                = 'c:tempipconfig.txt'
  tables
    data_tab                = gt_ipconfig
  exceptions
    file_open_error         = 1
    file_read_error         = 2
    no_batch                = 3
    gui_refuse_filetransfer = 4
    invalid_type            = 5
    no_authority            = 6
    unknown_error           = 7
    bad_data_format         = 8
    header_not_allowed      = 9
    separator_not_allowed   = 10
    header_too_long         = 11
    unknown_dp_error        = 12
    access_denied           = 13
    dp_out_of_memory        = 14
    disk_full               = 15
    dp_timeout              = 16
    others                  = 17.
if sy-subrc <> 0.
  message id sy-msgid type sy-msgty number sy-msgno
          with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
endif.

loop at gt_ipconfig into gs_ipconfig.
  if gs_ipconfig cs 'Physical Address'.
    write:/ gs_ipconfig.
  endif.
endloop.

Regards

Sridhar

Message was edited by: Sridhar K

Read only

0 Likes
2,191

Thanks Sridhar. Problem is solved.