02-20-2009 10:26 AM
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
02-20-2009 10:35 AM
02-20-2009 11:11 AM
HI VINOD,
How to implement this class,plz mention syntax.
Thks
Shailesh
02-20-2009 11:28 AM
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
02-21-2009 11:11 AM
02-20-2009 10:35 AM