Простой пример вывода html на экран.
Экран 0100 содержит Custom Container с именем CONTAINER_0100. GUI-статус STAT_0100 содержит две кнопки: "ОК" и "Отмена".
Экран 0100 содержит Custom Container с именем CONTAINER_0100. GUI-статус STAT_0100 содержит две кнопки: "ОК" и "Отмена".
DATA: gv_url(100), gt_html_data TYPE bcsy_text, go_cont_0100 TYPE REF TO cl_gui_custom_container, go_html_0100 TYPE REF TO cl_gui_html_viewer, gv_okcode TYPE sy-ucomm, gv_dummy. FIELD-SYMBOLS: <gfs_html_data> LIKE LINE OF gt_html_data. REFRESH: gt_html_data. " Head INSERT INITIAL LINE INTO TABLE gt_html_data ASSIGNING <gfs_html_data>. <gfs_html_data>-line = '<html><head><style>body{font-family:ms sans serif,verdana;}</style></head><body>'. " Body INSERT INITIAL LINE INTO TABLE gt_html_data ASSIGNING <gfs_html_data>. <gfs_html_data>-line = '<h1>Hello, World!</h1>'. INSERT INITIAL LINE INTO TABLE gt_html_data ASSIGNING <gfs_html_data>. <gfs_html_data>-line = '</body></html>'. CALL SCREEN 0100 STARTING AT 1 1. *&---------------------------------------------------------------------* *& Module STATUS_0100 OUTPUT *&---------------------------------------------------------------------* * text *----------------------------------------------------------------------* MODULE status_0100 OUTPUT. SET PF-STATUS 'STAT_0100'. SET TITLEBAR 'TITLE_0100'. IF go_cont_0100 IS INITIAL. CREATE OBJECT go_cont_0100 EXPORTING * parent = container_name = 'CONTAINER_0100' * style = * lifetime = lifetime_default * repid = * dynnr = * no_autodef_progid_dynnr = EXCEPTIONS cntl_error = 1 cntl_system_error = 2 create_error = 3 lifetime_error = 4 lifetime_dynpro_dynpro_link = 5 OTHERS = 6. IF go_cont_0100 IS NOT INITIAL. CREATE OBJECT go_html_0100 EXPORTING * shellstyle = parent = go_cont_0100 * lifetime = lifetime_default * saphtmlp = 'X' * uiflag = * name = * saphttp = * query_table_disabled = '' EXCEPTIONS cntl_error = 1 cntl_install_error = 2 dp_install_error = 3 dp_error = 4 OTHERS = 5. ENDIF. ENDIF. IF go_html_0100 IS NOT INITIAL. CALL METHOD go_html_0100->load_data EXPORTING * url = * type = 'text' * subtype = 'html' * size = 0 encoding = 'UTF-8' * charset = * language = IMPORTING assigned_url = gv_url CHANGING data_table = gt_html_data EXCEPTIONS dp_invalid_parameter = 1 dp_error_general = 2 cntl_error = 3 OTHERS = 4. CALL METHOD go_html_0100->show_url EXPORTING url = gv_url * frame = * in_place = ' X' EXCEPTIONS cntl_error = 1 cnht_error_not_allowed = 2 cnht_error_parameter = 3 dp_error_general = 4 OTHERS = 5. ENDIF. ENDMODULE. " STATUS_0100 OUTPUT *&---------------------------------------------------------------------* *& Module USER_COMMAND_0100 INPUT *&---------------------------------------------------------------------* * text *----------------------------------------------------------------------* MODULE user_command_0100 INPUT. CASE gv_okcode. WHEN 'OK' OR 'CANCEL'. LEAVE TO SCREEN 0. WHEN OTHERS. ENDCASE. ENDMODULE. " USER_COMMAND_0100 INPUT
Комментариев нет:
Отправить комментарий