Skip to Content
Former Member
Jan 21, 2013 at 12:19 PM

Attach excel xlsx file to email using cl_bcs and send to MS Outlook recipient



I've read a lot of previous posts regarding this issue, but none of them could help me out. I'm trying to send an email with an excel .xlsx (4-digit file extension) to an outlook email recipient.

Here is a part of my code:

DATA: document TYPE REF TO cl_document_bcs.

CONCATENATE '&SO_FILENAME=test.xlsx' INTO ls_att_header-line.

APPEND ls_att_header TO attachment_header.

****Add attchment******

CALL METHOD document->add_attachment
i_attachment_type = '' "( I've also tried XLS, BIN and EXT without success )

i_attachment_subject = 'test.xlsx'

i_attachment_size = attachment_size
i_att_content_hex = solix_tab

i_attachment_header = attachment_header.

So when I open the email in SAP using transaction SOST, the attachment get's displayed correctly - but Outlook receives the file as "test.xlsx.EXT". I also found a lot of SAP Notes regarding this but they could not solve my problem. Note 1433744 describes my problem very good, but it is only related to SAP CRM. We are on ECC 6.0 SAPKB70024.

Thanks for your help....