Skip to Content
author's profile photo Former Member
Former Member

Create HTML from SAP and display it in a container

Hi! forum,

I'd filled an itab with lines of html,

(<HTML> ......)

(<H1> This is a test </H1>)

(...)

I used the function ws_donwload to create a file test.html, now i want to show this html in a container, and then when i'm finished, delete test.html file.

How can i do that? is this efficient? should i use XML instead?

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

1 Answer

  • Best Answer
    Posted on Dec 07, 2005 at 01:46 PM

    hi,

    you can use class I_OI_DOCUMENT_VIEWER

    regards Andreas

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member

      take a look on this example.

      REPORT ZTESTE_ALE .

      tables: rlgrap.

      *----


      *

      • CLASS cl_gui_mine DEFINITION

      *----


      *

      • Definição da Classe CL_GUI_MINE, herdada de CL_GUI_HTML_VIEWER

      *----


      *

      CLASS cl_gui_mine DEFINITION INHERITING FROM cl_gui_html_viewer.

      PUBLIC SECTION.

      DATA: url_prefix TYPE cnht_url_prefix.

      DATA: t_docs TYPE TABLE OF docs.

      METHODS: sel_url_prefix

      IMPORTING url_prefix TYPE cnht_url_prefix OPTIONAL.

      ENDCLASS.

      *----


      *

      • CLASS cl_gui_mine IMPLEMENTATION

      *----


      *

      • Implementação da Classe CL_GUI_MINE

      *----


      *

      CLASS cl_gui_mine IMPLEMENTATION.

      METHOD sel_url_prefix.

      GET PROPERTY OF h_control-obj 'URLPrefixLocal' = me->url_prefix.

      ENDMETHOD.

      ENDCLASS.

      ************************************************************************

      • DEFINIÇÃO DAS TABELAS INTERNAS *************************************

      ************************************************************************

      TYPES:

      BEGIN OF tp_html,

      linha(255) TYPE c,

      END OF tp_html.

      DATA: ti_html TYPE TABLE OF tp_html WITH HEADER LINE .

      • Container para HTM

      DATA: ref_container TYPE REF TO cl_gui_docking_container,

      • HTML viewer

      ref_html TYPE REF TO cl_gui_mine ,

      • Caminho de arquivo HTML

      v_url(255) TYPE c,

      • Caminho URL

      v_filename TYPE rlgrap-filename.

      parameters: p_cami TYPE rlgrap-filename OBLIGATORY .

      ************************************************************************

      • at selection-screen .

      ************************************************************************

      AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_cami.

      PERFORM f_query_filename USING 'c:' 'S'.

      start-of-selection .

      perform f_upload_arquivo .

      call screen 100 .

      *----


      *

      • FORM QUERY_FILENAME *

      *----


      *

      • ........ *

      *----


      *

      FORM f_query_filename USING def_path LIKE rlgrap-filename

      mode TYPE c.

      DATA: global_filemask_mask(20),

      global_filemask_text(20).

      DATA: global_filemask_all(80).

      DATA: fieldln TYPE i .

      DATA: tmp_filename LIKE rlgrap-filename.

      DATA: tmp_mask LIKE global_filemask_all.

      FIELD-SYMBOLS: .

      • Build Filter for Fileselektor

      IF global_filemask_mask IS INITIAL.

      tmp_mask = ',.,..'.

      ELSE.

      tmp_mask = ','.

      WRITE global_filemask_text TO tmp_mask+1.

      WRITE ',' TO tmp_mask+21.

      WRITE global_filemask_mask TO tmp_mask+22.

      WRITE '.' TO tmp_mask+42.

      CONDENSE tmp_mask NO-GAPS.

      ENDIF.

      IF NOT global_filemask_all IS INITIAL.

      tmp_mask = global_filemask_all.

      ENDIF.

      fieldln = STRLEN( def_path ) - 1.

      ASSIGN def_path+fieldln(1) TO .

      ENDIF.

      CALL FUNCTION 'WS_FILENAME_GET'

      EXPORTING

      def_filename = rlgrap-filename

      • def_path = def_path

      • MASK = ',.,..'

      mask = tmp_mask

      mode = mode

      • TITLE = ' '

      IMPORTING

      filename = tmp_filename

      • RC =

      EXCEPTIONS

      inv_winsys = 01

      no_batch = 02

      selection_cancel = 03

      selection_error = 04.

      IF sy-subrc = 0.

      rlgrap-filename = tmp_filename.

      p_cami = tmp_filename .

      ELSE.

      • IF SY-SUBRC = 01. "// Does not work, why ???

      • MESSAGELINE = 'Not supported'.

      • ENDIF.

      ENDIF.

      ENDFORM. "f_query_filename

      *&----


      *

      *& Form f_upload_arquivo

      *&----


      *

      • text

      *----


      *

      • --> p1 text

      • <-- p2 text

      *----


      *

      FORM f_upload_arquivo .

      DATA: vl_caminho TYPE string .

      MOVE p_cami TO vl_caminho .

      CALL FUNCTION 'GUI_UPLOAD'

      EXPORTING

      filename = vl_caminho

      filetype = 'ASC'

      has_field_separator = ' '

      • HEADER_LENGTH = 0

      • READ_BY_LINE = 'X'

      • DAT_MODE = 'X'

      • CODEPAGE = ' '

      • IGNORE_CERR = ABAP_TRUE

      • REPLACEMENT = '#'

      • CHECK_BOM = ' '

      • IMPORTING

      • FILELENGTH =

      • HEADER =

      TABLES

      data_tab = ti_html[]

      EXCEPTIONS

      FILE_OPEN_ERROR = 1

      FILE_READ_ERROR = 2

      NO_BATCH = 3

      GUI_REFUSE_FILETRANSFER = 4

      INVALID_TYPE = 5

      NO_AUTHORITY = 6

      UNKNOWN_ERROR = 7

      BAD_DATA_FORMAT = 8

      HEADER_NOT_ALLOWED = 9

      SEPARATOR_NOT_ALLOWED = 10

      HEADER_TOO_LONG = 11

      UNKNOWN_DP_ERROR = 12

      ACCESS_DENIED = 13

      DP_OUT_OF_MEMORY = 14

      DISK_FULL = 15

      DP_TIMEOUT = 16

      OTHERS = 17

      .

      IF sy-subrc <> 0.

      MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

      WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

      ENDIF.

      endform. " f_upload_arquivo

      *&----


      *

      *& Module STATUS_0100 OUTPUT

      *&----


      *

      • text

      *----


      *

      module STATUS_0100 output.

      SET PF-STATUS '00000100' .

      SET TITLEBAR '100' WITH 'xxxxxxx' .

      endmodule. " STATUS_0100 OUTPUT

      *&----


      *

      *& Module html_exec OUTPUT

      *&----


      *

      • text

      *----


      *

      module html_exec output.

      DATA: wl_repid TYPE sy-repid,

      wl_tabix TYPE sy-tabix,

      wl_template TYPE swww_t_template_name,

      t_merge_table TYPE swww_t_merge_table WITH HEADER LINE,

      wl_prefix TYPE cnht_url_prefix.

      IF ref_container IS INITIAL.

      wl_repid = sy-repid.

      CREATE OBJECT ref_container

      EXPORTING

      side =

      cl_gui_docking_container=>dock_at_left

      extension = 1200

      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.

      MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno

      WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

      ENDIF.

      IF sy-subrc <> 0.

      • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

      • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

      ENDIF.

      CREATE OBJECT ref_html

      EXPORTING

      parent = ref_container.

      IF sy-subrc <> 0.

      • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

      • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

      ENDIF.

      CALL METHOD ref_html->sel_url_prefix.

      wl_prefix = ref_html->url_prefix.

      CONCATENATE wl_prefix

      v_filename

      INTO v_filename.

      wl_template = 'ZTESTE'.

      CLEAR t_merge_table.

      t_merge_table-name = '<!list!>'.

      t_merge_table-command = 'a'.

      t_merge_table-html[] = ti_html[].

      APPEND t_merge_table.

      CALL METHOD ref_html->load_html_document

      EXPORTING

      document_id = wl_template

      • DOCUMENT_TEXTPOOL =

      • DOCUMENT_URL =

      as_compressed_data = ' '

      IMPORTING

      assigned_url = v_filename

      CHANGING

      merge_table = t_merge_table[]

      EXCEPTIONS

      document_not_found = 1

      dp_error_general = 2

      dp_invalid_parameter = 3

      OTHERS = 4.

      IF sy-subrc <> 0.

      • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

      • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

      ENDIF.

      CONCATENATE wl_prefix

      v_filename

      INTO v_filename.

      CALL METHOD ref_html->show_url

      EXPORTING

      url = v_filename.

      IF sy-subrc <> 0.

      • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

      • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

      ENDIF.

      ELSE.

      ENDIF.

      endmodule. " html_exec OUTPUT

      Regards

      Alexandre Nogueira

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.