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: 

Get IP Address and Report Running Date and time

Former Member
0 Kudos

Hi All,

What should be the code for fetching IP Address and report running date and time of user's

machine who run the report.

Thks

Shailesh

5 REPLIES 5

Former Member
0 Kudos

hi use,

class CL_GUI_FRONTEND_SERVICES and method GET_IP_ADDRESS

0 Kudos

HI VINOD,

How to implement this class,plz mention syntax.

Thks

Shailesh

0 Kudos

Hello,

Here is the syntax for the getting the IP address:


DATA:
BEGIN OF st_file,
  datum TYPE sy-datum, "Current Date
  time  TYPE sy-uzeit, "Time
  ipadr TYPE string,   "IP Adress
END OF st_file.

DATA:
v_ipaddr TYPE string.

DATA:
  l_wa_indx    TYPE indx.

* Get the serial number for the file from DB table INDX
IMPORT st_file = st_file
FROM DATABASE indx(xy)
TO l_wa_indx
CLIENT sy-mandt ID 'SDN'.

IF st_file IS NOT INITIAL.
  WRITE:
  / 'Previous Run Date:', 20 st_file-datum,
  / 'Previous Run Time:', 20 st_file-time,
  / 'User IP:', 20 st_file-ipadr.

  CLEAR: st_file.

  PERFORM f_export_run_details
  CHANGING st_file.
ELSE.
  PERFORM f_export_run_details
  CHANGING st_file.
ENDIF.
*&---------------------------------------------------------------------*
*&      Form  f_export_run_details
*&---------------------------------------------------------------------*
*       Transfer Prog. Run details to Memory ID
*----------------------------------------------------------------------*
FORM f_export_run_details
CHANGING fp_st_file STRUCTURE st_file.

  fp_st_file-datum = sy-datum.
  fp_st_file-time = sy-uzeit.

  CALL METHOD cl_gui_frontend_services=>get_ip_address
    RECEIVING
      ip_address           = v_ipaddr
    EXCEPTIONS
      cntl_error           = 1
      error_no_gui         = 2
      not_supported_by_gui = 3
      OTHERS               = 4.
  IF sy-subrc = 0.
    fp_st_file-ipadr = v_ipaddr.
  ENDIF.

* Export the date & serial number to DB
  EXPORT st_file = fp_st_file
  TO DATABASE indx(xy)
  FROM l_wa_indx
  CLIENT sy-mandt ID 'SDN'.

ENDFORM.                    " f_export_run_details

BR,

Suhas

Edited by: Suhas Saha on Feb 20, 2009 2:47 PM

0 Kudos

Dear Suhas,

Thnks.

Regds

Shailesh

Former Member
0 Kudos

Look in the table USR41

Pushpraj