Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Problem in attaching an MS word document

Hi All,

I have to send a <b>'.Doc'</b> file as attachment.

First I save the contents in a database table by uploading through BSP-upload in the form of <b>xstring</b>.

Now I perform following steps:

1. read them with a 'Select' statement

2. convert them from <b>xstring to stri</b>ng

3. fill the parameter <b>'contents_bin'</b> of the function module: <b>'SO_NEW_DOCUMENT_ATT_SEND_API1'</b>

4. set <b>transf_bin = 'X'</b> and <b>doc_type = 'DOC'</b>.

5. send mail by calling the same FM.

Now, my problem is:

If the uploaded file is '.Txt' , then the receiver gets attachment perfectly.

But if the uploaded data is '.Doc' then the attachment has some coding type text, not the original contents because of some <b>conversion error</b>.

Now my question is:

what <b>'CODDEPAGE</b>' should I use in conversion from Xstring to String so that I may avoid that error.

Currently i am using:

CALL FUNCTION <b>'HR_KR_XSTRING_TO_STRING'</b>

EXPORTING

FROM_CODEPAGE = <b>'8400'</b>

IN_XSTRING = xcontents

IMPORTING

OUT_STRING = contents

.

Can anybody help?

Thanks in advance,

Pragya

Tags:
Former Member
replied

check out this demo program

BCS_EXAMPLE_5

copy this to your name space (y/z).

in this program read the xstring from your ztable and convert it to binary using

data: xl_content type xstring .

DATA: binary_content TYPE solix_tab.

CALL FUNCTION 'SCMS_XSTRING_TO_BINARY'

EXPORTING

buffer = xl_content

TABLES

binary_tab = binary_content.

and pass the binary content to add attachment method.

Regards

Raja

0 View this answer in context
Not what you were looking for? View more on this topic or Ask a question