Hi,
I'm trying to make a report in HTML format in the R/3 system, I've done it already in another company, but there was a report like this there, I just copied e modified to my HTML code.
I do it this way:
- I import all the html code into a internal table, and I work with it my program as the following code.
If someone knows another way to make a report in HTML, or why my code is not working...
Thanks.
I declare a class INHERITING FROM cl_gui_html_viewer:
*----
*
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.
SO, I import the HTML code into a IT, and implement the following code, I think what is wrong is the template, I don't Know what is this template:
*&----
*
*& 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 = 1000
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 = 'ZRH_CURR_TEMP'.
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