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: 

Report HTML

Former Member
0 Kudos

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

3 REPLIES 3

athavanraja
Active Contributor
0 Kudos

check out sample programs

SAPHTML_EVENTS_DEMO

RSDEMO_HTML_VIEWER

why my code is not working?

do you have this template stored in SMW0

'ZRH_CURR_TEMP'

what is not working? explain this to us

Regards

Raja

0 Kudos

I think this template is exactly the problem, I don't Know what is this "template", thank you for told me the transaction to create this template. You helpme a lot....

But, what is this template exactly? I have to put the HTML code there? It's new for me... I'm serarching it in the internet.

Thanks a lot.

att,

Alexandre Nogueira.

0 Kudos

<b><!list!></b> in your post make me guess that its a kind of report list. create the template in SMW0 by copying the stadard one <b>WEBREPORTING_REPORT</b> which you can find in the same transaction.

This technic is generally used in webenabling R/3 reports using WebRFC model of ITS programming.

If you could tell us what you are trying to achieve by your program , may be can come up with a proper solution.

If you find the answers helpful, reward them by clicking the radiobutton and once it is completely answered you can mark it as answered.

Regards

Raja

Message was edited by: Durairaj Athavan Raja