Posted: Sat Jan 31, 2009 6:48 pm Post subject: Show report in webpage
Code:
REPORT ztest.
TABLES : sscrfields.
INCLUDE <ctldef>.
INCLUDE <icon>.
CONSTANTS: htmlcntl_eventid_on_navigate TYPE i VALUE 1.
CONSTANTS: htmlcntl_eventid_navigate_com TYPE i VALUE 2.
DATA : h_html_ctrl TYPE cntl_handle,
repid TYPE sy-repid,
dynnr TYPE sy-dynnr,
cmd TYPE sy-ucomm,
flag,disp.
DATA : it_exclude LIKE TABLE OF rsexfcode WITH HEADER LINE.
SELECTION-SCREEN : FUNCTION KEY 1,
FUNCTION KEY 2,
FUNCTION KEY 3,
FUNCTION KEY 4,
FUNCTION KEY 5.
SELECTION-SCREEN COMMENT 45(50) comment1.
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN COMMENT 2(28) comment2 FOR FIELD url.
SELECTION-SCREEN POSITION 31.
PARAMETERS : url(1064) LOWER CASE .
SELECTION-SCREEN PUSHBUTTON 79(4) open USER-COMMAND open.
SELECTION-SCREEN END OF LINE.
INITIALIZATION.
comment1 = 'ABAP INTERNET EXPLORER'.
comment2 = 'Enter URL/Filename To Open :'.
open = icon_transfer .
sscrfields-functxt_05 = icon_sap.
sscrfields-functxt_04 = icon_booking_stop.
sscrfields-functxt_03 = icon_refresh.
sscrfields-functxt_02 = icon_arrow_right.
sscrfields-functxt_01 = icon_arrow_left.
repid = sy-repid.
dynnr = '1000'.
it_exclude-fcode = 'ONLI'.
APPEND it_exclude.
it_exclude-fcode = 'INFO'.
APPEND it_exclude.
*Changing GUI status
CALL FUNCTION 'RS_SET_SELSCREEN_STATUS'
EXPORTING
p_status = sy-pfkey
*p_program = repid
TABLES
p_exclude = it_exclude.
CALL FUNCTION 'CONTROL_INIT' .
IF sy-subrc NE 0.
EXIT.
ENDIF.
CALL FUNCTION 'HTMLCNTL_CREATE'
EXPORTING
owner_repid = repid
link_repid = repid
dynnr = dynnr
CHANGING
handle = h_html_ctrl
EXCEPTIONS
control_install_error = 1
create_error = 2
OTHERS = 3.
IF sy-subrc NE 0.
EXIT.
ENDIF.
IF sy-subrc NE 0.
EXIT.
ENDIF.
CALL FUNCTION 'CONTROL_FLUSH'.
AT SELECTION-SCREEN.
cmd = sscrfields-ucomm.
CASE cmd.
WHEN 'OPEN'.
PERFORM load_html_page.
CALL FUNCTION 'CONTROL_FLUSH'.
WHEN 'FC01'. "BACK
CALL FUNCTION 'HTMLCNTL_GO_BACK'
EXPORTING
h_control = h_html_ctrl.
IF sy-subrc NE 0.
EXIT.
ENDIF.
PERFORM get_current_url.
WHEN 'FC02'. "FORWARD
CALL FUNCTION 'HTMLCNTL_GO_FORWARD'
EXPORTING
h_control = h_html_ctrl.
IF sy-subrc NE 0.
EXIT.
ENDIF.
PERFORM get_current_url.
WHEN 'FC03'. "REFRESH
CALL FUNCTION 'HTMLCNTL_DO_REFRESH'
EXPORTING
h_control = h_html_ctrl.
IF sy-subrc NE 0.
EXIT.
ENDIF.
PERFORM get_current_url.
WHEN 'FC04'. "STOP
CALL FUNCTION 'HTMLCNTL_STOP'
EXPORTING
h_control = h_html_ctrl.
IF sy-subrc NE 0.
EXIT.
ENDIF.
WHEN 'FC05'. "GO TO HOME
CALL FUNCTION 'HTMLCNTL_GO_HOME'
EXPORTING
h_control = h_html_ctrl.
IF sy-subrc NE 0.
EXIT.
ENDIF.
PERFORM get_current_url.
CALL FUNCTION 'CONTROL_FLUSH'.
WHEN OTHERS.
CALL FUNCTION 'CONTROL_DISPATCH'
EXPORTING
fcode = cmd.
CALL FUNCTION 'CONTROL_FLUSH'.
ENDCASE.
CLEAR cmd.
CALL FUNCTION 'CONTROL_FLUSH'.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR url.
PERFORM get_file_name.
PERFORM load_html_page.
*&---------------------------------------------------------------------
*& Form get_page_name
*&---------------------------------------------------------------------
* Get Page Name
*----------------------------------------------------------------------
FORM get_file_name.
CALL FUNCTION 'WS_FILENAME_GET'
EXPORTING
* DEF_FILENAME = ' '
def_path = 'C:\ '
mask = ',.,..'
mode = 'o'
title = 'Browse to Open'
IMPORTING
filename = url
* RC =
EXCEPTIONS
inv_winsys = 1
no_batch = 2
selection_cancel = 3
selection_error = 4
OTHERS = 5
.
IF sy-subrc NE 0.
EXIT.
ENDIF.
ENDFORM. " get_page_name
*&---------------------------------------------------------------------
*& Form load_html_page
*&---------------------------------------------------------------------
* TO load the file (URL)
FORM load_html_page.
CALL FUNCTION 'HTMLCNTL_SHOW_URL'
EXPORTING
h_control = h_html_ctrl
url = url.
IF sy-subrc NE 0.
EXIT.
ENDIF.
flag = 'X'.
ENDFORM. " load_html_page
*&---------------------------------------------------------------------
*& Form get_current_url
*---------------------------------------------------------------------
* Get Current URL
*----------------------------------------------------------------------
FORM get_current_url.
CALL FUNCTION 'HTMLCNTL_GET_CURRENT_URL'
EXPORTING
h_control = h_html_ctrl
IMPORTING
url = url.
ENDFORM. " get_current_url
* Callback form for the event 'NavigateComplete'
callback on_control_event.
CALL FUNCTION 'CONTROL_GET_EVENT_PARAM'
EXPORTING
h_control = h_html_ctrl
param_id = 0
CHANGING
return = url.
PERFORM get_current_url.
endcallback.
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You can download files in this forum
All product names are trademarks of their respective companies. SAPNET.RU websites are in no way affiliated with SAP AG. SAP, SAP R/3, R/3 software, mySAP, ABAP, BAPI, xApps, SAP NetWeaver and any other are registered trademarks of SAP AG. Every effort is made to ensure content integrity. Use information on this site at your own risk.