Skip to Content
0
Jan 22, 2014 at 07:57 AM

problem in WWW_ITAB_TO_HTML

916 Views

hi,

I have created a report and it display fine but when I send mail using

WWW_ITAB_TO_HTML

I have got more column than simple alv display...

below is the mailing code part

ORM SEND_MAIL .



LOOP AT lt_fcat INTO ls_fcat.

wa_header-text = ls_fcat-seltext_m.



CALL FUNCTION 'WWW_ITAB_TO_HTML_HEADERS' "#EC FB_OLDED

EXPORTING

field_nr = sy-tabix

text = wa_header-text

size = '3'

fgcolor = 'WHITE'

bgcolor = 'MAROON'

font = 'CALIBRI'

TABLES

header = i_header.



CALL FUNCTION 'WWW_ITAB_TO_HTML_LAYOUT' "#EC FB_OLDED

EXPORTING

field_nr = sy-tabix

size = '2'

fgcolor = 'BLACK'

bgcolor = 'WHITE'

font = 'CALIBRI'

TABLES

fields = i_fields.



ENDLOOP.





CALL FUNCTION 'ISP_GET_MONTH_NAME' "#EC FB_OLDED

EXPORTING

DATE = lv_beg

LANGUAGE = sy-langu

* MONTH_NUMBER = '00'

IMPORTING

* LANGU_BACK =

* LONGTEXT =

SHORTTEXT = lv_month

EXCEPTIONS

CALENDAR_ID = 1

DATE_ERROR = 2

NOT_FOUND = 3

WRONG_INPUT = 4

OTHERS = 5

.

IF SY-SUBRC eq 0.



CONCATENATE 'Billing Invoice detail of'(025) lv_month '/' lv_beg(4) INTO lv_header SEPARATED BY space.

wa_header-text = lv_header.

wa_header-size = '2'.

wa_header-font = 'CALIBRI'.



ENDIF.











CALL FUNCTION 'WWW_ITAB_TO_HTML' "#EC FB_OLDED

EXPORTING

* TABLE_ATTRIBUTES = 'BORDER=1'

table_header = wa_header

* ALL_FIELDS = 'X'

TABLES

html = i_html[]

fields = i_fields[]

row_header = i_header[]

itable = lt_final.



TRY .



g_send_request = cl_bcs=>create_persistent( ).



g_document = cl_document_bcs=>create_document(

i_type = 'RAW'

* i_text = i_content[] " Body for Mail

i_subject = 'Billing Document details'(022) ).



DESCRIBE TABLE i_html LINES g_lines.

g_size = g_lines * 2 * 255.



CALL METHOD g_document->add_attachment

EXPORTING

i_attachment_type = 'HTM'

i_attachment_subject = 'Billing Document details'(022)

i_attachment_size = g_size

i_att_content_text = i_html[].



g_send_request->set_document( g_document ).



*lv_mail = s_mail-low.



*WHILE lv_mail le s_mail-high.

LOOP AT s_mail.

lv_mail = s_mail-low.

g_recipient = cl_cam_address_bcs=>create_internet_address( lv_mail ).



g_send_request->add_recipient(

EXPORTING

i_recipient = g_recipient

i_express = 'X' ).

ENDLOOP.

*ENDWHILE.

g_send_request->set_send_immediately( 'X' ).



* g_send_request->send(

* EXPORTING

* i_with_error_screen = 'X'

* RECEIVING

* result = g_sent_to_all ).



*g_recipient = cl_cam_address_bcs=>create_internet_address( ''(024) ).

*

* g_send_request->add_recipient(

* EXPORTING

* i_recipient = g_recipient

* i_copy = 'X'

* i_express = 'X' ).



g_send_request->set_send_immediately( 'X' ).



g_send_request->send(

EXPORTING

i_with_error_screen = 'X'

RECEIVING

result = g_sent_to_all ).



COMMIT WORK.



CATCH cx_bcs INTO g_cx_bcs.



WRITE:/ g_cx_bcs->error_type.



ENDTRY.







ENDFORM. " SEND_MAIL

thanks,

payel