get physical mac address

*"----------------------------------------------------------------------
*"*"Local interface:
*"  EXPORTING
*"     REFERENCE(MACADDRESS) TYPE  ZTMAC
*"----------------------------------------------------------------------
  DATA: gt_ipconfig TYPE TABLE OF char255,
  gs_ipconfig TYPE char255.

  DATA: wa_mac TYPE zsmac.
  DATA : BEGIN OF itab OCCURS 0,
         source TYPE string,
         END OF itab.
  itab-source = 'ipconfig /all>c:\hello.txt'.
  APPEND itab.
  itab-source = 'del c:\b.bat'.
  APPEND itab.

  CALL FUNCTION 'GUI_DOWNLOAD'
    EXPORTING
      filename         = 'C:\b.bat' "file name
    TABLES
      data_tab         = itab    "inner table
    EXCEPTIONS
      file_write_error = 1
      file_not_found   = 2.

  CALL METHOD cl_gui_frontend_services=>execute
    EXPORTING
      application            = 'c:\b.bat'
      synchronous            = 'WAIT'
    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.
  CALL FUNCTION 'GUI_UPLOAD'
    EXPORTING
      filename                = 'C:\hello.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'.
      wa_mac = gs_ipconfig+44(17).
      APPEND wa_mac TO macaddress.
    ENDIF.
  ENDLOOP.

by saper | 2008/08/19 11:49 | Tip | 트랙백 | 덧글(0)

트랙백 주소 : http://saper.egloos.com/tb/723123
☞ 내 이글루에 이 글과 관련된 글 쓰기 (트랙백 보내기) [도움말]

:         :

:

비공개 덧글

◀ 이전 페이지 다음 페이지 ▶