• SAP Html viewer


      1 *&---------------------------------------------------------------------*
      2 *& Report  RSDEMO_HTML_VIEWER                                          *
      3 *&                                                                     *
      4 *&---------------------------------------------------------------------*
      5 *&                                                                     *
      6 *&                                                                     *
      7 *&---------------------------------------------------------------------*
      8 
      9 REPORT  rsdemo_html_viewer            .
     10 DATA container TYPE REF TO cl_gui_custom_container.
     11 DATA html_viewer TYPE REF TO cl_gui_html_viewer.
     12 
     13 DATA ok_code TYPE sy-ucomm.
     14 DATA init.
     15 DATA  save_ok TYPE sy-ucomm.
     16 DATA  url(255) VALUE 'HTTP://WWW.SAP-AG.DE'.
     17 DATA frame(255).
     18 DATA  align TYPE i.
     19 DATA  document_id(255) VALUE 'HTMLCNTL_TESTEVNT_HOME'.
     20 DATA  document_textpool TYPE sy-repid.
     21 DATA document_url(255).
     22 DATA assigned_url(255).
     23 DATA merge_table TYPE swww_t_merge_table.
     24 DATA  object_id(255) VALUE 'HTMLCNTL_TESTHTM2_SAPLOGO'.
     25 DATA object_url(255) VALUE 'SAPLOGO.GIF'.
     26 DATA  type(4) VALUE 'text'.
     27 DATA subtype(4) VALUE 'html'.
     28 DATA size TYPE i.
     29 DATA data_table TYPE c OCCURS 0.
     30 
     31 SET SCREEN 100.
     32 *&---------------------------------------------------------------------*
     33 *&      Module  STATUS_0100  OUTPUT
     34 *&---------------------------------------------------------------------*
     35 *       text
     36 *----------------------------------------------------------------------*
     37 MODULE status_0100 OUTPUT.
     38   SET PF-STATUS 'STATUS'.
     39   IF init is initial.
     40     CREATE OBJECT container
     41             EXPORTING container_name = 'CUSTOM'.
     42     CREATE OBJECT html_viewer
     43             EXPORTING  parent              = container
     44             EXCEPTIONS cntl_error         = 1
     45                        cntl_install_error = 2
     46                        dp_install_error   = 3
     47                        dp_error           = 4.
     48     IF sy-subrc ne 0.
     49 * Fehlerbehandlung
     50     ENDIF.
     51     CALL METHOD cl_gui_cfw=>flush
     52          EXCEPTIONS cntl_system_error = 1
     53                     cntl_error        = 2.
     54     IF sy-subrc ne 0.
     55 * Fehlerbehandlung
     56     ENDIF.
     57     init = 'X'.
     58   ENDIF.
     59 ENDMODULE.                             " STATUS_0100  OUTPUT
     60 *&---------------------------------------------------------------------*
     61 *&      Module  USER_COMMAND_0100  INPUT
     62 *&---------------------------------------------------------------------*
     63 *       text
     64 *----------------------------------------------------------------------*
     65 MODULE user_command_0100 INPUT.
     66   save_ok = ok_code.
     67   CLEAR ok_code.
     68   CASE save_ok.
     69     WHEN 'SHOW_URL'.
     70       CALL METHOD html_viewer->show_url
     71                 EXPORTING url   = url
     72                           frame = frame
     73                 EXCEPTIONS cntl_error = 1.
     74     WHEN 'STOP'.
     75       CALL METHOD html_viewer->stop
     76                 EXCEPTIONS cntl_error = 1.
     77     WHEN 'GO_BACK'.
     78       CALL METHOD html_viewer->go_back
     79                 EXCEPTIONS cntl_error = 1.
     80     WHEN 'GO_FORWARD'.
     81       CALL METHOD html_viewer->go_forward
     82                 EXCEPTIONS cntl_error = 1.
     83     WHEN 'GO_HOME'.
     84       CALL METHOD html_viewer->go_home
     85                 EXCEPTIONS cntl_error = 1.
     86     WHEN 'DO_REFRESH'.
     87       CALL METHOD html_viewer->do_refresh
     88                 EXCEPTIONS cntl_error = 1.
     89     WHEN 'GET_CURRENT_URL'.
     90       CALL METHOD html_viewer->get_current_url
     91                 IMPORTING url = url
     92                 EXCEPTIONS cntl_error = 1.
     93       call method cl_gui_cfw=>flush
     94                 exceptions cntl_error = 1
     95                            cntl_system_error = 2.
     96     WHEN 'LOAD_DATABASE'.
     97       CALL METHOD html_viewer->load_html_document
     98            EXPORTING document_id       = 'HTMLCNTL_TESTHTM2_FRAME1'
     99 *                    document_textpool = document_textpool
    100                      document_url      = 'HTMLFrame1.htm'
    101 *          IMPORTING assigned_url      = assigned_url
    102 *          CHANGING  merge_table       = merge_table
    103            EXCEPTIONS document_not_found   = 1
    104                       dp_error_general     = 2
    105                       dp_invalid_parameter = 3.
    106       CALL METHOD html_viewer->load_html_document
    107            EXPORTING document_id       = 'HTMLCNTL_TESTEVNT_HOME'
    108 *                    document_textpool = document_textpool
    109                      document_url      = 'HTMLFrame2.htm'
    110 *          IMPORTING assigned_url      = assigned_url
    111 *          CHANGING  merge_table       = merge_table
    112            EXCEPTIONS document_not_found   = 1
    113                       dp_error_general     = 2
    114                       dp_invalid_parameter = 3.
    115       CALL METHOD html_viewer->load_html_document
    116            EXPORTING document_id       = 'HTMLCNTL_TESTHTM2_FRAMESET'
    117 *                    document_textpool = document_textpool
    118 *                    document_url      = document_url
    119            IMPORTING assigned_url      = assigned_url
    120 *          CHANGING  merge_table       = merge_table
    121            EXCEPTIONS document_not_found   = 1
    122                       dp_error_general     = 2
    123                       dp_invalid_parameter = 3.
    124       CALL METHOD html_viewer->load_mime_object
    125          EXPORTING
    126               object_id  = 'HTMLCNTL_TESTHTM2_SAPLOGO'
    127               object_url = 'SAPLOGO.GIF'
    128 *           IMPORTING assigned_url = assigned_url
    129                 EXCEPTIONS object_not_found     = 1
    130                            dp_error_general     = 2
    131                            dp_invalid_parameter = 3.
    132       CALL METHOD html_viewer->load_mime_object
    133            EXPORTING
    134                 object_id  = 'HTMLCNTL_TESTHTM2_SAP_AG'
    135                 object_url = 'SAP_AG.GIF'
    136 *           IMPORTING assigned_url = assigned_url
    137                 EXCEPTIONS object_not_found     = 1
    138                            dp_error_general     = 2
    139                            dp_invalid_parameter = 3.
    140       CALL METHOD html_viewer->load_mime_object
    141            EXPORTING
    142                 object_id  = 'HTMLCNTL_TESTHTM2_BACKGROUND'
    143                 object_url = 'HOME_BACKGROUND.GIF'
    144 *           IMPORTING assigned_url = assigned_url
    145                 EXCEPTIONS object_not_found     = 1
    146                            dp_error_general     = 2
    147                            dp_invalid_parameter = 3.
    148 
    149       CALL METHOD html_viewer->show_data
    150            EXPORTING url   = assigned_url
    151 *                    frame = frame
    152            EXCEPTIONS cntl_error = 1.
    153 
    154   ENDCASE.
    155 ENDMODULE.                             " USER_COMMAND_0100  INPUT
    156 *&---------------------------------------------------------------------*
    157 *&      Module  EXIT  INPUT
    158 *&---------------------------------------------------------------------*
    159 *       text
    160 *----------------------------------------------------------------------*
    161 MODULE exit INPUT.
    162   CALL METHOD html_viewer->free.
    163   CALL METHOD container->free.
    164   FREE html_viewer.
    165   FREE container.
    166   LEAVE PROGRAM.
    167 ENDMODULE.                             " EXIT  INPUT
  • 相关阅读:
    lc第319场周赛第三题逐层排序二叉树所需的最少操作数目
    实现自动delete?
    什么是死锁?怎么排查死锁?怎么避免死锁?
    为什么视频流一般都用UDP
    Leetcode 537. 复数乘法(网友思路,自愧不如)
    MFC中使用sqlite3操作数据库 创建、插入、查询、修改、删除数据
    C++ std::set<>是什么 怎么用 遍历
    qt qtextedit 限制富文本复制 限制字符
    set容器判断是否插入成功
    C++ 循环for 引用 for(string & : )
  • 原文地址:https://www.cnblogs.com/JackeyLove/p/13650176.html
Copyright © 2020-2023  润新知