<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Add external javascript in html view in cl_gui_custom_container in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/add-external-javascript-in-html-view-in-cl-gui-custom-container/m-p/13599848#M2026457</link>
    <description>&lt;LI-CODE lang="abap"&gt;    cl_html-&amp;gt;load_data(
      EXPORTING
        url        = 'script.js'
        type       = 'text'
        subtype    = 'js'
        size       = lv_len
      CHANGING
        data_table = lt_script
    ).&lt;/LI-CODE&gt;&lt;P&gt;In the end is was pass to var the lenght o of size and this resolve my problem,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 08 Feb 2024 18:47:47 GMT</pubDate>
    <dc:creator>caio_dh_consultig</dc:creator>
    <dc:date>2024-02-08T18:47:47Z</dc:date>
    <item>
      <title>Add external javascript in html view in cl_gui_custom_container</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/add-external-javascript-in-html-view-in-cl-gui-custom-container/m-p/13598532#M2026419</link>
      <description>&lt;P&gt;hi everyone,&lt;/P&gt;&lt;P&gt;i have a question, how i make a report with html in SAP adding external&amp;nbsp;javascript files in a html?, i loaded data using a method in this report,&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="abap"&gt;REPORT z_load_html.

CLASS make_html DEFINITION.
  PUBLIC SECTION.
    METHODS init.

  PRIVATE SECTION.
    TYPES: typ_file_line(1022) TYPE x,
           typ_file_tab        TYPE STANDARD TABLE OF typ_file_line.

    DATA: cl_html       TYPE REF TO cl_gui_html_viewer.

    METHODS:
      convet_xstring_to_filetab
        IMPORTING lv_xstring TYPE xstring
        EXPORTING lt_filetab TYPE typ_file_tab.
ENDCLASS.

CLASS make_html IMPLEMENTATION.
  METHOD init.
    DATA: lv_html    TYPE string,
          lv_script  TYPE string,
          lv_x_html  TYPE xstring,
          lv_xscript TYPE xstring,
          lt_html    TYPE typ_file_tab,
          lt_script  TYPE typ_file_tab.

    DATA: cl_container TYPE REF TO cl_gui_custom_container.

    " Print Alert
    lv_script =
      'd2luZG93LmFsZXJ0KCdzY3JpcHQgd29yayEnKTs='.

    " simple HTML
    CONCATENATE
      'PCFET0NUWVBFIGh0bWw+PGh0bWwgbGFuZz0iZW4iPjxoZWFkPj'
      'xtZXRhIGNoYXJzZXQ9IlVURi04Ij48bWV0YSBuYW1lPSJ2aWV3'
      'cG9ydCIgY29udGVudD0id2lkdGg9ZGV2aWNlLXdpZHRoLCBpbm'
      'l0aWFsLXNjYWxlPTEuMCI+PHRpdGxlPkRvY3VtZW50PC90aXRs'
      'ZT48L2hlYWQ+PHNjcmlwdCBzcmM9InNjcmlwdC5qcyI+PC9zY3'
      'JpcHQ+PGJvZHk+PGRpdj48L2Rpdj48L2JvZHk+PC9odG1sPg=='
    INTO lv_html.

    " Convert B64 to XSTRING
    cl_http_utility=&amp;gt;if_http_utility~decode_x_base64(
      EXPORTING
        encoded = lv_html
      RECEIVING
        decoded = lv_x_html
    ).

    cl_http_utility=&amp;gt;if_http_utility~decode_x_base64(
      EXPORTING
        encoded = lv_script
      RECEIVING
        decoded = lv_xscript
    ).

    " Mont HTML view and Files
    convet_xstring_to_filetab(
      EXPORTING lv_xstring = lv_x_html
      IMPORTING lt_filetab = lt_html
    ).

    convet_xstring_to_filetab(
      EXPORTING lv_xstring = lv_xscript
      IMPORTING lt_filetab = lt_script
    ).

    " init HTML view
    CREATE OBJECT cl_container
      EXPORTING
        container_name = 'HTML_CONTAINER'.

    CREATE OBJECT cl_html
      EXPORTING
        parent = cl_container.

    cl_html-&amp;gt;LOAD_DATA(
      EXPORTING
        url        = 'index.html'
        type       = 'text'
        subtype    = 'html'
      CHANGING
        data_table = lt_html
    ).
    cl_html-&amp;gt;LOAD_DATA(
      EXPORTING
        url        = 'script.js'
        type       = 'text'
        subtype    = 'js'
      CHANGING
        data_table = lt_script
    ).

    cl_html-&amp;gt;show_daTA(  url = 'index.html' ).

    call SCREEN 9000.

  ENDMETHOD.

  METHOD convet_xstring_to_filetab.


    DATA: lv_len TYPE i,

          lv_j   TYPE i.

    lv_len = xstrlen( lv_xstring ).

    lv_j  = 0.

    CLEAR lt_filetab.

    WHILE lv_j &amp;lt; lv_len.
      IF lv_j + 1022 &amp;lt; lv_len.
        APPEND lv_xstring+lv_j(1022) TO lt_filetab.
      ELSE .
        APPEND lv_xstring+lv_j TO lt_filetab.
      ENDIF.

      ADD 1022 TO lv_j.
    ENDWHILE.
  ENDMETHOD.                    "convet_xstring_to_fileTab

ENDCLASS.

INITIALIZATION.
  DATA cl_class TYPE REF TO make_html.

  CREATE OBJECT cl_class.
  cl_class-&amp;gt;init( ).&lt;/LI-CODE&gt;&lt;P&gt;on IE11 the result open perfectly.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="caio_dh_consultig_0-1707328369585.png" style="width: 400px;"&gt;&lt;img src="https://community.sap.com/t5/image/serverpage/image-id/62376iB48D3BCDC3687010/image-size/medium?v=v2&amp;amp;px=400" role="button" title="caio_dh_consultig_0-1707328369585.png" alt="caio_dh_consultig_0-1707328369585.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;however, i don't display alert in EDGE browser controller there are strange charateres in javascript text of include and edge don't read script, someone help-me in this problem?&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="caio_dh_consultig_1-1707328805903.png" style="width: 400px;"&gt;&lt;img src="https://community.sap.com/t5/image/serverpage/image-id/62379iBE41581D35906A81/image-size/medium?v=v2&amp;amp;px=400" role="button" title="caio_dh_consultig_1-1707328805903.png" alt="caio_dh_consultig_1-1707328805903.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 07 Feb 2024 18:05:55 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/add-external-javascript-in-html-view-in-cl-gui-custom-container/m-p/13598532#M2026419</guid>
      <dc:creator>caio_dh_consultig</dc:creator>
      <dc:date>2024-02-07T18:05:55Z</dc:date>
    </item>
    <item>
      <title>Re: Add external javascript in html view in cl_gui_custom_container</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/add-external-javascript-in-html-view-in-cl-gui-custom-container/m-p/13599841#M2026456</link>
      <description>&lt;P&gt;i found the problem the xstring table is bigger of the lenght of xstring, there are '0' to complete line table, and this create a Null in text.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="caio_dh_consultig_0-1707416999606.png" style="width: 400px;"&gt;&lt;img src="https://community.sap.com/t5/image/serverpage/image-id/62954iF8684044B4212B0F/image-size/medium?v=v2&amp;amp;px=400" role="button" title="caio_dh_consultig_0-1707416999606.png" alt="caio_dh_consultig_0-1707416999606.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 08 Feb 2024 18:30:14 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/add-external-javascript-in-html-view-in-cl-gui-custom-container/m-p/13599841#M2026456</guid>
      <dc:creator>caio_dh_consultig</dc:creator>
      <dc:date>2024-02-08T18:30:14Z</dc:date>
    </item>
    <item>
      <title>Re: Add external javascript in html view in cl_gui_custom_container</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/add-external-javascript-in-html-view-in-cl-gui-custom-container/m-p/13599848#M2026457</link>
      <description>&lt;LI-CODE lang="abap"&gt;    cl_html-&amp;gt;load_data(
      EXPORTING
        url        = 'script.js'
        type       = 'text'
        subtype    = 'js'
        size       = lv_len
      CHANGING
        data_table = lt_script
    ).&lt;/LI-CODE&gt;&lt;P&gt;In the end is was pass to var the lenght o of size and this resolve my problem,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 08 Feb 2024 18:47:47 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/add-external-javascript-in-html-view-in-cl-gui-custom-container/m-p/13599848#M2026457</guid>
      <dc:creator>caio_dh_consultig</dc:creator>
      <dc:date>2024-02-08T18:47:47Z</dc:date>
    </item>
  </channel>
</rss>

