Application Development and Automation 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: 
Read only

html viewer

Former Member
0 Likes
1,731

Hi all

I am trying to understand how this object works. I believe that this is a way to write my own html page and see it in a dynpro.

This is the code I wrote:

" declaration of object
DATA html_viewer TYPE REF TO cl_gui_html_viewer.
" container
DATA g_custom_container TYPE REF TO cl_gui_custom_container.
" url of doc created
DATA l_doc_url(255) TYPE c.
" dynamic HTML creation structs
DATA data_table TYPE STANDARD TABLE OF char255.
DATA wa_table LIKE LINE OF data_table.

" test
wa_table = '<h1>This is a test</h1>'.
INSERT wa_table INTO TABLE data_table.

" create container
CREATE OBJECT g_custom_container
  EXPORTING
    container_name = 'CONTAINER'.
" create html viewer
CREATE OBJECT html_viewer
  EXPORTING
    parent     = g_custom_container.
" load data on server
CALL METHOD html_viewer->load_data
  EXPORTING
    type                 = 'text'
    subtype              = 'html'
  IMPORTING
    assigned_url         = l_doc_url
  CHANGING
    data_table           = data_table
  EXCEPTIONS
    dp_invalid_parameter = 1
    dp_error_general     = 2.
" show loaded data in html control
CALL METHOD html_viewer->show_data
  EXPORTING
    url = l_doc_url.

" call main screen
CALL SCREEN 10.

All works, but html is not interpreted: the result is that I see in the html control '<h.1>Test</h.1>' (Added dot to not see written as header here in the post) and not 'Test' written as header (that would be <h1>Test</h1>). Am i missing something or do I misunderstood the use of this object?

regards

Gabriele

Edited by: Gabriele Montori on Aug 30, 2010 12:38 PM

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,130

Hello,

your problem is witjh the HTML. You need to insert the <html> tag. try this:


" test
wa_table = '<html>'.
Append wa_table TO data_table.
wa_table = '<h1>This is a test</h1>'.
append wa_table TO data_table.
wa_table = '</html>'.
Append wa_table TO data_table.

Regards,

pedro

3 REPLIES 3
Read only

anup_deshmukh4
Active Contributor
0 Likes
1,130

hey...you can go through...below program.

SAPHTML_DEMO1

Read only

Former Member
0 Likes
1,131

Hello,

your problem is witjh the HTML. You need to insert the <html> tag. try this:


" test
wa_table = '<html>'.
Append wa_table TO data_table.
wa_table = '<h1>This is a test</h1>'.
append wa_table TO data_table.
wa_table = '</html>'.
Append wa_table TO data_table.

Regards,

pedro

Read only

0 Likes
1,130

I cannot believe I forgot <html> .. </html> ... shame on me .

Thank you for help.

Regards

Gabriele