Send CSV via mail. Data tab is not compatible?

Hey, I'm creating a csv-file from an internal table. Afterwards I want to send it via an email. In the "add_attachment" method I get an error that the converted table doesn't fit to "i_att_Content_text". I also tried i_att_Content_hex" with the same error.

How can I send a CSV-File via mail without these errors?

DATA: lt_converted_tab TYPE truxs_t_text_data.
 gr_document = cl_document_bcs=>create_document(
 i_type = 'RAW'
 i_text = gv_text
 i_length = '12'
 i_subject = 'CSV-Datei Useranlagereport' ).

 gr_document->add_attachment(
 EXPORTING
 i_attachment_type = 'csv'
 i_attachment_subject = 'CSV-Datei'
 i_att_content_text = lt_converted_tab
 ).

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • Jan 20, 2017 at 12:23 PM

    I would recommend to convert your CSV data to binary. And attach as binary attachment:

    i_att_content_hex + do not forget provide i_attachment_size

    You can use some of the cl_bcs_convert methods :-) Do not forget about codepage when converting to binary.

    Add comment
    10|10000 characters needed characters exceeded

  • Jan 20, 2017 at 12:10 PM

    Ok think I solved it.

    The table needed is a sol_tab. But for the convertion I need the truxs_t_text_data. So i created two tables, one of each type.

    Then I converted the data in table1 and added their content to table2 which I'm going to send.

    Worked fine in the first test.

    Add comment
    10|10000 characters needed characters exceeded

Skip to Content