Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Printing HTML on ABAP Report

Former Member
0 Kudos

Hello!

I retrieve the html from a BSP application to an internal table type SOLI_TAB. After i try to load the data using:


  CALL METHOD HTML_CONTROL->LOAD_DATA
    EXPORTING
      TYPE                 = 'text'
      SUBTYPE              = 'html'
*      SIZE                 = 0
*      ENCODING             =
*      CHARSET              =
*      LANGUAGE             =
    IMPORTING
      ASSIGNED_URL         = doc_url
    CHANGING
      DATA_TABLE           =  IT_HMTL
    EXCEPTIONS
      DP_INVALID_PARAMETER = 1
      DP_ERROR_GENERAL     = 2
      CNTL_ERROR           = 3
      others               = 4.
          .
  IF sy-subrc EQ 0.

    CALL METHOD html_control->show_url
      EXPORTING
        url = doc_url.
ENDIF.

The problem is that the html viewer is showing me the html source and not the page as it is shown on a browser.

What am I doing wrong?

Regards,

Pedro Barbosa

1 ACCEPTED SOLUTION

Former Member
0 Kudos

1. use http_client->response->get_cdata( ).

to get the response data in string format instead of xstring format.

2. use FM CONVERT_STRING_TO_TABLE to covert the string to table of type W3HTML

3. use method

data: l_doc_url(255) type c.

call method html_control->load_data

exporting

type = 'text'

subtype = 'html'

importing

assigned_url = l_doc_url

changing

data_table = html_table.

call method html_control->show_data

exporting

url = l_doc_url.

to load the html content and show it in cl_gui_html_viewer

2 REPLIES 2

Former Member
0 Kudos

1. use http_client->response->get_cdata( ).

to get the response data in string format instead of xstring format.

2. use FM CONVERT_STRING_TO_TABLE to covert the string to table of type W3HTML

3. use method

data: l_doc_url(255) type c.

call method html_control->load_data

exporting

type = 'text'

subtype = 'html'

importing

assigned_url = l_doc_url

changing

data_table = html_table.

call method html_control->show_data

exporting

url = l_doc_url.

to load the html content and show it in cl_gui_html_viewer

0 Kudos

Hi!

Tanks Seshu. The problem is now solved.

Using FM CONVERT_STRING_TO_TABLE to convert the HTML string to a w3html table instead of SOLI_TAB solved the issue.

Regards,

Pedro Barbosa