cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

I need to send an invoice in both Excel and CSV formats via email.

0 Likes
602

Dear experts,

The current code snippet is sending e mail in xls format. Now the requirement is I need to send email in both Excel and CSV formats.

code:

"merging header and item rows
IF lv_header IS NOT INITIAL AND lv_item IS NOT INITIAL .
CONCATENATE lv_header cl_abap_char_utilities=>newline lv_item INTO lv_excel.
ENDIF.

"converting to binary
TRY.
cl_bcs_convert=>string_to_solix(
EXPORTING
iv_string = lv_excel
iv_codepage = '4103' "suitable for MS Excel, leave empty
iv_add_bom = 'X' "for other doc types
IMPORTING
et_solix = lt_binary_content ).
CATCH cx_bcs.
MESSAGE e005.
ENDTRY.

"add attchement
CALL METHOD lo_document->add_attachment
EXPORTING
i_attachment_type = 'xls'
i_attachment_subject = lv_subject
i_att_content_text = lt_cont_text
i_att_content_hex = lt_binary_content.

* add document to send request
CALL METHOD lo_send_request->set_document( lo_document ).

Please guide me how to do this or if you have any sample code for help.

Thank you.

Accepted Solutions (0)

Answers (0)