Skip to Content
0
May 30, 2012 at 04:25 PM

Email attachment name from BCS

289 Views

I hope this is a simple question, but it's baffling to me.

I am using BCS to attach an Excel file to an email using this snippet of code:

l_ref_bcs = cl_bcs=>create_persistent( ).

l_ref_document = cl_document_bcs=>create_document(

i_type = 'RAW'

i_text = email_text

i_subject = subject ).

CONCATENATE subject '.xlsx' INTO lv_file_name.

CONCATENATE '&SO_FILENAME=' lv_file_name INTO lv_text_line.

APPEND lv_text_line TO lt_att_head.

CALL METHOD l_ref_document->add_attachment

EXPORTING

i_attachment_type = 'BIN'

i_attachment_size = lv_filesize

i_attachment_subject = subject

i_att_content_hex = lt_file_tab

i_attachment_header = lt_att_head.



When this code is executed in our Dev and QA systems, the name of the file attached to the email message is filename.xlsx. However, when run in our production environment, the file name becomes filename.BIN and can not be opened with Excel directly from the email message.



I'm supposing that there is some config I might be missing in production. Does anyone have an idea why this would be happening? It's almost as if my code to add the file name parameter to the attachment header table is being ignored.



Thank you.