Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Issue while sending DOCX file as attachments

Former Member
0 Likes
1,141

Hi Experts,

I am using CL_BCS methods for sending attachements in emails in background, everything works fine except for DOCX extensions. It says the file is correpted while opening. I have tried adding the file name to header table as given in OSS note.

CONCATENATE '&SO_FILENAME=' lv_filename into lv_text_line.

append lv_text_line to lt_att_head.

But it just gives the file name with 4 extensions, but the file is still correpted.

Please help. My SAP version is 4.7

Thank you very much in advance,

Farook.

Hi Experts,

I am using CL_BCS methods for sending attachements in emails in background, everything works fine except for DOCX extensions. It says the file is correpted while opening. I have tried adding the file name to header table as given in OSS note.

CONCATENATE '&SO_FILENAME=' lv_filename into lv_text_line.

append lv_text_line to lt_att_head.

But it just gives the file name with 4 extensions, but the file is still correpted.

Please help. My SAP version is 4.7

Thank you very much in advance,

Farook.

2 REPLIES 2
Read only

Former Member
0 Likes
627

Hello Farook,

Please check the link below:

In the above link, some useful link is provided by Christoph Hopf. Also, the creater of the thread solved Word (docx) file corruption issue with the help of SAP note 1459896.

Eventually i have fixed the the corruption of DOCX(MS office 2007) files by referring to SAP note 1459896.

Hope that helps!

Regards,

Saba

Read only

0 Likes
627

For Docs or pdfs or xls

use SCMS_BINARY_TO_XSTRING and SCMS_XSTRING_TO_BINARY

From here - catch the size of the attachment and pass it onto add_attachment method

If you have a docx or xlsx, then pass on the header oss note 1459896

something like

lr_document->add_attachment(

i_attachment_type = lv_objtp "'PDF'

i_attachment_subject = lv_attachment_subject

i_attachment_size = lv_size_char "size from SCMS_XSTRING_TO_BINARY

i_att_content_hex = lt_content_bin

i_attachment_header = lt_att_head

).

Also - may be useful -