‎2007 Mar 19 1:22 PM
Hello,
I'm trynig to send an email with an .XML attachment. I use FM SO_NEW_DOCUMENT_ATT_SEND_API1 to do it. When I use this code:
DESCRIBE TABLE lt_objbin LINES l_records.
lt_objpack-transf_bin = 'X'.
lt_objpack-head_start = 1.
lt_objpack-head_num = 1.
lt_objpack-body_start = 1.
lt_objpack-body_num = l_records.
lt_objpack-obj_name = ls_doc_chng-obj_name.
lt_objpack-obj_descr = ls_doc_chng-obj_name.
lt_objpack-doc_type = 'XLS'.
lt_objpack-doc_size = l_records * 255.
APPEND lt_objpack.
CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
EXPORTING
document_data = ls_doc_chng
TABLES
packing_list = lt_objpack
object_header = lt_objhead
contents_bin = lt_objbin
contents_txt = lt_objtxt
receivers = lt_reclist
EXCEPTIONS
too_many_receivers = 1
document_not_sent = 2
document_type_not_exist = 3
operation_no_authorization = 4
parameter_error = 5
x_error = 6
enqueue_error = 7
OTHERS = 8.
I get such an error: "Message cannot be processed as it cannot be converted".
When I change lt_objpack-doc_type to 'RAW' everything is OK, but I get attachment that has 'TXT' extension. If I change it manually to ".xls" Excel opens the file without any problems. I looked at <a href="http://www.sapdevelopment.co.uk/reporting/email/attach_xls.htm">http://www.sapdevelopment.co.uk/reporting/email/attach_xls.htm</a>
and it seems like there is nothing wrong with my program.
Can anyone help?
Thanks in advance,
Rafal
‎2007 Mar 19 1:33 PM
hi
try this:
DESCRIBE TABLE lt_objbin LINES l_records.
lt_objpack-transf_bin = 'X'.
lt_objpack-head_start = 1.
lt_objpack-head_num = 1.
lt_objpack-body_start = 1.
lt_objpack-body_num = l_records.
lt_objpack-obj_name = ls_doc_chng-obj_name.
<b>lt_objpack-obj_descr = 'Test.XLS'.</b>
lt_objpack-doc_type = 'XLS'.
lt_objpack-doc_size = l_records * 255.
APPEND lt_objpack.
regards,
madhu
‎2007 Mar 19 2:12 PM
I've tried, but it didn't help.
Maybe there is a way to change an extension of a file without changing doc_type ?
Regards,
Rafal