2008 Oct 21 10:54 AM
Hi,
i use the fm WWW_ITAB_TO_HTML to send internal table to html ,
the problem is that i dont get the header i now that there is Fm:
WWW_ITAB_TO_HTML_HEADERS that i put there the header , but i saw the documentation of the fm and i have to send every Colman name manually there is a way to do it dynamic ?
Regards
2008 Oct 22 12:19 PM
HI Arona,
thanks for yuor Replay,
my problem is how to add the Header of the colman to HTML,
in your program it move only the body of the table i need the colman name to .
i need it for sending mail with internal table at the end .
Thanks,
Ferry
Hi,
i use the fm WWW_ITAB_TO_HTML to send internal table to html ,
the problem is that i dont get the header i now that there is Fm:
WWW_ITAB_TO_HTML_HEADERS that i put there the header , but i saw the documentation of the fm and i have to send every Colman name manually there is a way to do it dynamic ?
Regards
2008 Oct 21 12:16 PM
2008 Oct 22 9:53 AM
Hi Ferry ,
Take a look the below code that Jose send to me maybe it helps .
Regards
DATA: send_request TYPE REF TO cl_bcs,
document TYPE REF TO cl_document_bcs,
recipient TYPE REF TO cl_cam_address_bcs,
bcs_exception TYPE REF TO cx_bcs,
sent_to_all TYPE os_boolean,
lt_tab TYPE TABLE OF makt,
lt_fields TYPE TABLE OF w3fields,
lt_html TYPE TABLE OF w3html.
PARAMETER mailid TYPE adr6-smtp_addr.
SELECT * FROM makt UP TO 10 ROWS INTO TABLE lt_tab WHERE spras = 'E'.
CALL FUNCTION 'WWW_ITAB_TO_HTML'
TABLES
html = lt_html[]
fields = lt_fields
itable = lt_tab.
TRY.
send_request = cl_bcs=>create_persistent( ).
document = cl_document_bcs=>create_document( i_type = 'HTM'
i_text = lt_html
i_subject = 'Table' ).
send_request->set_document( document ).
recipient = cl_cam_address_bcs=>create_internet_address( mailid ).
send_request->add_recipient( EXPORTING i_recipient = recipient
i_express = 'X' ).
send_request->set_send_immediately( 'X' ).
send_request->send( EXPORTING i_with_error_screen = 'X'
RECEIVING result = sent_to_all ).
COMMIT WORK.
CATCH cx_bcs INTO bcs_exception.
EXIT.
ENDTRY.
2008 Oct 22 12:19 PM
HI Arona,
thanks for yuor Replay,
my problem is how to add the Header of the colman to HTML,
in your program it move only the body of the table i need the colman name to .
i need it for sending mail with internal table at the end .
Thanks,
Ferry
2008 Oct 22 3:49 PM
Hi Ferry,
It appears to me that these Func modules are bit simillar to our
ALV FMs. We have to pass 1) a data table and 2) Either a header table (like our field catalog) or a DDIC structure name.
In our internal table the no of fields is going to be constant( unless u use a dynamic int table ). So we can build the header
manually as we do for field catalog table in ALV.
btw are u using a dynamic internal table??
Cheers,
Jose.
2008 Oct 22 3:58 PM
Hi Josh,
Thanks for Replay!
Yes i want to use dynmic internal table .
Regards
2008 Oct 22 4:54 PM
Hi Ferry,
See the below example...
Here i hav used a dynamic int table ( u can specify any DB table and any two of its fields as parameters )
and used the same code (as in the other thread).
Now first 10 records(only the two specified fields) of the specified DB table is sent as mail.
TYPE-POOLS abap.
PARAMETERS : table TYPE tabname DEFAULT 'MAKT' ,
field1 TYPE fieldname DEFAULT 'MATNR',
field2 TYPE fieldname DEFAULT 'MAKTX',
mailto TYPE adr6-smtp_addr.
DATA : lt_comp_tab TYPE abap_component_tab WITH HEADER LINE,
tab_ref TYPE REF TO data,
line_ref TYPE REF TO data,
line_type TYPE REF TO cl_abap_structdescr,
tab_type TYPE REF TO cl_abap_tabledescr,
data_describer TYPE REF TO cl_abap_datadescr.
DATA: lo_send_request TYPE REF TO cl_bcs,
lo_document TYPE REF TO cl_document_bcs,
lo_recipient TYPE REF TO cl_cam_address_bcs,
lo_exception TYPE REF TO cx_bcs,
lv_sent_to_all TYPE os_boolean,
lt_fields TYPE TABLE OF w3fields WITH HEADER LINE,
lt_header TYPE TABLE OF w3head WITH HEADER LINE,
lt_html TYPE TABLE OF w3html WITH HEADER LINE,
ls_tab_header TYPE w3head.
FIELD-SYMBOLS : <table> TYPE table,
<line> TYPE ANY,
<field> TYPE ANY.
lt_comp_tab-name = field1.
lt_comp_tab-type ?= cl_abap_datadescr=>describe_by_data( field1 ).
APPEND lt_comp_tab.
lt_comp_tab-name = field2.
lt_comp_tab-type ?= cl_abap_datadescr=>describe_by_data( field2 ).
APPEND lt_comp_tab.
line_type ?= cl_abap_structdescr=>create( lt_comp_tab[] ).
tab_type ?= cl_abap_tabledescr=>create( line_type ).
CREATE DATA : tab_ref TYPE HANDLE tab_type,
line_ref TYPE HANDLE line_type.
ASSIGN tab_ref->* TO <table>.
ASSIGN line_ref->* TO <line>.
SELECT * FROM (table) INTO CORRESPONDING FIELDS OF TABLE <table> UP TO 10 ROWS.
MOVE 'Genetated List' TO ls_tab_header-text.
MOVE 'Arial' TO ls_tab_header-font.
MOVE '2' TO ls_tab_header-size.
LOOP AT lt_comp_tab.
MOVE lt_comp_tab-name TO lt_header-text.
SELECT SINGLE reptext FROM dd04t INTO lt_header-text WHERE rollname = lt_header-text
AND ddlanguage = sy-langu.
MOVE : sy-tabix TO lt_header-nr,
'orange' TO lt_header-bg_color.
APPEND lt_header.
ENDLOOP.
CALL FUNCTION 'WWW_ITAB_TO_HTML'
EXPORTING
table_header = ls_tab_header
TABLES
html = lt_html[]
fields = lt_fields[]
row_header = lt_header[]
itable = <table>.
TRY.
lo_send_request = cl_bcs=>create_persistent( ).
lo_document = cl_document_bcs=>create_document( i_type = 'HTM'
i_text = lt_html[]
i_subject = 'Table' ).
lo_send_request->set_document( lo_document ).
lo_recipient = cl_cam_address_bcs=>create_internet_address( mailto ).
lo_send_request->add_recipient( EXPORTING i_recipient = lo_recipient
i_express = 'X' ).
lo_send_request->set_send_immediately( 'X' ).
lv_sent_to_all = lo_send_request->send( 'X' ).
COMMIT WORK.
CATCH cx_bcs INTO lo_exception.
EXIT.
ENDTRY.Cheers,
Jose.
2008 Oct 22 5:09 PM
Hi Josh,
Thanks a lot!!!
Thanks for your patience You Are amazing ,
Plz write the same solution in abap objects so i can close the post .
Thanks again
Best Regards
2008 Oct 22 4:33 PM
Try this way
" get for fields for your itab
i_ref_descr ?= cl_abap_typedescr=>describe_by_data( ITAB ).
i_details[] = i_ref_descr->components[].
data : v_head TYPE w3head.
loop at i_details into wa_details.
select single * from dd04t into wa_dd04t
where rollname = wa_details-name.
if sy-subrc eq 0.
v_head-text = wa_dd04t-SCRTEXT_M.
*-Fill Column Headings
CALL FUNCTION 'WWW_ITAB_TO_HTML_HEADERS'
EXPORTING
field_nr = sy-tabix
text = v_head-text
TABLES
header = t_colhdr.
endif.
endloop.
CALL FUNCTION 'WWW_ITAB_TO_HTML'
EXPORTING
table_header = wa_header
TABLES
html = i_html
fields = i_fields
row_header = i_colhdr
itable = i_output.
a®
| User | Count |
|---|---|
| 3 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |