Im Dynpro über einen HTML Container anzeigen
1. Programm und Dynpro erstellen
2. Screen Painter aufrufen in dem man auf den Button "Layout" klickt
3. In der linken Spalte das Icon " Custom Control" nach rechts ziehen (+ die Grösse einstellen) und beschriften (z.B. P_BILD_05). Dann nicht vergessen zu aktivieren.
5. In der Ablauflogik folgende Einträge im PBO erstellen
PROCESS BEFORE OUTPUT.
MODULE status_9000.
"HTML Container anzeigen
MODULE html_9000.
PROCESS AFTER INPUT.
MODULE user_command_9000.
6. Doppelklick auf "bild_9000" und legen Sie ein PBO Modul an. Folgenden Code einfügen
MODULE html_9000 OUTPUT.
TYPE-POOLS: cndp.
DATA: go_container_html TYPE REF TO cl_gui_custom_container,
go_picture_html TYPE REF TO cl_gui_html_viewer,
lv_url_html TYPE cndp_url,
ls_raw_html_line TYPE c LENGTH 255,
lt_raw_html LIKE STANDARD TABLE OF ls_raw_html_line.
CLEAR: go_picture_html, go_container_html.
IF go_container_html IS INITIAL.
CREATE OBJECT go_container_html
EXPORTING
container_name = 'P_HTML_01' "NAME CUSTOM CONTAINER
repid = 'Z_HTMLDYNPRO' "PROGRAMM NAME
dynnr = '9000' "DYNPRONAME
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 i001(00) WITH 'Fehler mit dem erstellen des HTML-Containers'.
LEAVE LIST-PROCESSING.
ENDIF.
ENDIF.
IF go_picture_html IS INITIAL.
CREATE OBJECT go_picture_html
EXPORTING
parent = go_container_html
EXCEPTIONS
OTHERS = 2.
IF sy-subrc <> 0.
MESSAGE i001(00) WITH 'Fehler mit dem anzeigen des HTML'.
LEAVE LIST-PROCESSING.
ENDIF.
ENDIF.
IF go_picture_html IS NOT INITIAL.
"HTML-Code Für die Dokumentation
"HTML-Beginn
APPEND '<HTML><BODY>' TO lt_raw_html.
"Hintergrund- und Linkfarbe
APPEND '<body bgcolor="#EAF1F6" alink="#FFFFFF">' TO lt_raw_html.
"Damit verhindert man die Scrollbar
APPEND '<body style="font-family:arial;font-size:90%;overflow:hidden">' TO lt_raw_html.
"Text
APPEND '<FONT SIZE="3"><FONT COLOR="#E20074"><strong>Titel</strong></FONT> <br><br>' TO lt_raw_html.
"Text
APPEND '<FONT SIZE="2"><FONT COLOR="#2F2F2F"><strong>Titel Fett</strong></FONT> <br>' TO lt_raw_html.
APPEND '<FONT SIZE="2"><FONT COLOR="#2F2F2F">Text</FONT> <br>' TO lt_raw_html.
APPEND '<FONT SIZE="2"><FONT COLOR="#2F2F2F">Text</FONT> <br><br>' TO lt_raw_html.
APPEND '<FONT SIZE="2"><FONT COLOR="#2F2F2F"><strong>Verwaltung:</strong></FONT> <br>' TO lt_raw_html.
APPEND '<FONT SIZE="2"><FONT COLOR="#2F2F2F">Text, </FONT> <br>' TO lt_raw_html.
APPEND '<FONT SIZE="2"><FONT COLOR="#2F2F2F">Text</FONT> <br><br>' TO lt_raw_html.
APPEND '<FONT SIZE="2"><FONT COLOR="#2F2F2F"><strong>Titel
Fett</strong></FONT> <br>' TO lt_raw_html.
APPEND '<FONT SIZE="2"><FONT COLOR="#2F2F2F">Text </FONT> <br>' TO lt_raw_html.
APPEND '<FONT SIZE="2"><FONT COLOR="#2F2F2F">text</FONT> <br>' TO lt_raw_html.
"Bild
APPEND '<img width="298" src="http://u.jimdo.com/www73/o/s6dfcd8d0602a4389/img/i7a2fca8d0ccd6bce/1287234800/std/image.jpg" height="72" />' TO raw_html.
"HTML-Ende
APPEND '</BODY></HTML>' TO lt_raw_html.
"Link
APPEND '<a href="http://regotz.jimdo.com/">REGOTZ</a><br><br><br>' TO raw_html.
"Google-Suche
APPEND '<form method="get" action="http://www.google.ch/search">' TO raw_html.
APPEND '<input type="text" name="q" size="31" maxlength="255" value="" />' TO raw_html.
APPEND '<input type="submit" value="Google Suche" />' TO raw_html.
APPEND '</form>' TO raw_html.
CALL METHOD go_picture_html->load_data
EXPORTING
url = lv_url_html
IMPORTING
assigned_url = lv_url_html
CHANGING
data_table = lt_raw_html
EXCEPTIONS
OTHERS = 1.
IF sy-subrc = 0.
"Rahmen weglassen
CALL METHOD go_picture_html->set_ui_flag
EXPORTING
uiflag = cl_gui_html_viewer=>uiflag_no3dborder.
"HTML-File anzeigen
CALL METHOD go_picture_html->show_data
EXPORTING
url = lv_url_html.
ELSE.
MESSAGE i001(00) WITH 'Fehler mit dem Laden des HTML'.
LEAVE LIST-PROCESSING.
ENDIF.
ENDIF.
ENDMODULE.