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

Error while sending .XLS attachment

Former Member
0 Likes
281

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

2 REPLIES 2
Read only

Former Member
0 Likes
264

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

Read only

0 Likes
264

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