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

Attachment using function module SO_DOCUMENT_SEND_API1

Former Member
0 Likes
1,399

I am using the function module "SO_DOCUMENT_SEND_API1" to send a mail with a pdf attachment. My e-mail contains some text also.

The problem is along with the PDF I am also getting a TXT file as an attachment, which contains the same text data as the e-mail content. How can I delete the TXT attachment?

Anju

8 REPLIES 8
Read only

Former Member
0 Likes
1,090

Ca you please post what you are passing to the FM?

Sumit

Read only

0 Likes
1,090

CALL FUNCTION 'SO_DOCUMENT_SEND_API1'

EXPORTING

document_data = w_doc_data

sender_address = w_sender

sender_address_type = w_sender_add_type

TABLES

packing_list = it_packing_list_mail

contents_bin = it_attachment

contents_txt = it_mess_body_mail

receivers = it_receivers_mail

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

.

IF sy-subrc <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

DESCRIBE TABLE it_mess_body_mail LINES w_cnt.

w_doc_data-doc_size = ( w_cnt - 1 ) * 255 +

STRLEN( it_mess_body_mail ).

w_mtitle = text1222.

w_doc_data-obj_langu = sy-langu.

w_doc_data-obj_name = 'SAPRPT'.

w_doc_data-obj_descr = w_mtitle.

w_doc_data-sensitivty = 'F'.

CLEAR it_packing_list_mail.

it_packing_list_mail-transf_bin = space.

it_packing_list_mail-head_start = 1.

it_packing_list_mail-head_num = 0.

it_packing_list_mail-body_start = 1.

DESCRIBE TABLE it_mess_body_mail LINES it_packing_list_mail-body_num.

it_packing_list_mail-doc_type = 'RAW'.

APPEND it_packing_list_mail.

DESCRIBE TABLE it_attachment LINES it_packing_list_mail-body_num.

it_packing_list_mail-transf_bin = 'X'.

it_packing_list_mail-head_start = 1.

it_packing_list_mail-head_num = 1.

it_packing_list_mail-body_start = 1.

it_packing_list_mail-doc_type = 'XLS'.

it_packing_list_mail-obj_name = 'ATTACHMENT'.

it_packing_list_mail-obj_descr = 'Attached Document'.

it_packing_list_mail-doc_size = it_packing_list_mail-body_num * 255.

APPEND it_packing_list_mail.

Thanks,

Anju

Read only

0 Likes
1,090
it_packing_list_mail-doc_type = 'RAW'.
APPEND it_packing_list_mail.

it_packing_list_mail-doc_type = 'XLS'.
it_packing_list_mail-obj_name = 'ATTACHMENT'.
it_packing_list_mail-obj_descr = 'Attached Document'.
it_packing_list_mail-doc_size = it_packing_list_mail-body_num * 255.
APPEND it_packing_list_mail.

it seems you are adding two files in "it_packing_list" table.

Remove the RAW attachment.

Regards,

Sumit.

Read only

0 Likes
1,090

it seems you are adding two files in "it_packing_list" table.

Remove the RAW attachment.

No, that's not true.

Check: http://wiki.sdn.sap.com/wiki/display/Snippets/Sendingmailwith+attachment

Edited by: Rob Postema on Sep 6, 2010 3:22 PM

Read only

0 Likes
1,090

Hi Rob, thanks for the rectrification, apologies for my reply.

The RAW format is specified for the document content.

Regards,

Sumit

Read only

Former Member
0 Likes
1,090

Hello,

May be you can see security settings of the mail box?

I have a test case:

if you are using outlook for mail access and receiving mail from non outlook then it contains extra text file with the recipient address in the same mail.

Thanks.

Read only

Former Member
0 Likes
1,090

.

Edited by: kk.adhvaryu on Sep 13, 2010 2:56 PM

Read only

Former Member
0 Likes
1,090

complete