05-15-2006 7:39 AM
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
05-15-2006 9:02 AM
Hi Raja,
when I convert into binary and try to send then the receiver is not able to even open the document.
it gives an error:
Document or path is not valid!
Can you help me what I am missing here.
Thanks and Regards,
pragya
05-15-2006 8:20 AM
05-15-2006 8:32 AM
Hi Naresh,
Thanks for your response.
I have seen the thread mentioned by you. But that is also having the same query unanswered that how to attach preformatted word documnet.
I am facing the same problem as I am unable to carry out proper conversion from xstring to string.
I have tried some 'Codepage' values like : 8400, 1160, 4100, 4103 etc. But no one os working.
Hope I have described my problem clearly.
regards,
pragya
05-15-2006 8:36 AM
you dont need to convert xstring to string. you should convert xstring to binary
use the following code for the same.
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.
now you can pass the binary_content to your email FM
Looks like you are on WAS, in such a case use CL_BCS class for email. they are much easier to handle and very flexible.
let me know if you need help with CL_BCS
Regards
Raja
05-15-2006 8:40 AM
05-15-2006 9:02 AM
Hi Raja,
when I convert into binary and try to send then the receiver is not able to even open the document.
it gives an error:
Document or path is not valid!
Can you help me what I am missing here.
Thanks and Regards,
pragya
05-15-2006 9:26 AM
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