Problem in attaching an MS word document
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>
FROM_CODEPAGE = <b>'8400'</b>
IN_XSTRING = xcontents
OUT_STRING = contents
Can anybody help?
Thanks in advance,
Durairaj Athavan Raja replied
check out this demo program
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'
buffer = xl_content
binary_tab = binary_content.
and pass the binary content to add attachment method.