Quantcast
Channel: SCN: Message List
Viewing all articles
Browse latest Browse all 8868

Re: change data in CL_GUI_HTML_VIEWER

$
0
0

Are you telling me the below doesn't work?

REPORT  zhtml_example.
DATA: ref_cont TYPE REF TO cl_gui_custom_container,
       ref_html TYPE REF TO cl_gui_html_viewer,
         ts_data TYPE TABLE OF char255.
CALL SCREEN 100.
FORM display_html.
   DATA: w_url TYPE char255.

   IF ref_cont IS NOT BOUND.
     APPEND '<html><body>hello world<br />' TO ts_data.
     CREATE OBJECT ref_cont
        EXPORTING
          container_name              = 'CONT'
        EXCEPTIONS
          cntl_error                  = 1
          cntl_system_error           = 2
          create_error                = 3
          lifetime_error              = 4
          lifetime_dynpro_dynpro_link = 5
          OTHERS                      = 6.
     IF sy-subrc <> 0.
     ENDIF.

     CREATE OBJECT ref_html
       EXPORTING
         parent             = ref_cont
       EXCEPTIONS
         cntl_error         = 1
         cntl_install_error = 2
         dp_install_error   = 3
         dp_error           = 4
         OTHERS             = 5.
     IF sy-subrc <> 0.
     ENDIF.
   ELSE.
     APPEND 'hello world<br />' TO ts_data.
   ENDIF.

   CALL METHOD ref_html->load_data
     IMPORTING
       assigned_url         = w_url
     CHANGING
       data_table           = ts_data
     EXCEPTIONS
       dp_invalid_parameter = 1
       dp_error_general     = 2
       cntl_error           = 3
       OTHERS               = 4.
   IF sy-subrc <> 0.
   ENDIF.

   CALL METHOD ref_html->show_url
     EXPORTING
       url                    = w_url
     EXCEPTIONS
       cntl_error             = 1
       cnht_error_not_allowed = 2
       cnht_error_parameter   = 3
       dp_error_general       = 4
       OTHERS                 = 5.
   IF sy-subrc <> 0.
   ENDIF.
   ref_html->set_ui_flag( ref_html->uiflag_no3dborder ).
ENDFORM.
MODULE status_0100 OUTPUT.
   SET PF-STATUS 'S0100'.
   PERFORM display_html.
ENDMODULE.
MODULE user_command_0100 INPUT.
   IF sy-ucomm EQ 'BACK'.
     LEAVE TO SCREEN 0.
   ENDIF.
ENDMODULE.

Additional Information on the code:

1. Create screen 100 and place a custom container named CONT

2. Create two modules. (The status_0100 is in PBO and the other one in PAI)

3. Create a status and set BACK as the function code for back button.

4. Every time you click on the Continue button beside the command box the HTML content will get updated.


Viewing all articles
Browse latest Browse all 8868

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>