‎2010 Aug 30 11:38 AM
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
‎2010 Aug 30 12:08 PM
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
‎2010 Aug 30 12:02 PM
‎2010 Aug 30 12:08 PM
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
‎2010 Aug 30 12:59 PM
I cannot believe I forgot <html> .. </html> ... shame on me .
Thank you for help.
Regards
Gabriele