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

Emailing Two Attachments

Former Member
0 Likes
819

Is it possible to email a user 2 attachments using SO_NEW_DOCUMENT_ATT_SEND_API1 ?

I have generated a PDF from a spool list, so that is my first attachment. The second attachment, I am reading in a PDF file from the file server. I would like to send both of these attachments at the same time, rather than sending two separate emails.

Is this even possible?

Thanks for your help.

John

1 ACCEPTED SOLUTION
Read only

Manohar2u
Active Contributor
0 Likes
517

Refer to this link.

<a href="/people/sravya.talanki2/blog/2006/01/12/xi-triggering-e-mails-with-multiple-attachments--problems:///people/sravya.talanki2/blog/2006/01/12/xi-triggering-e-mails-with-multiple-attachments--problems

Regds

Manohar

4 REPLIES 4
Read only

Manohar2u
Active Contributor
0 Likes
518

Refer to this link.

<a href="/people/sravya.talanki2/blog/2006/01/12/xi-triggering-e-mails-with-multiple-attachments--problems:///people/sravya.talanki2/blog/2006/01/12/xi-triggering-e-mails-with-multiple-attachments--problems

Regds

Manohar

Read only

Former Member
0 Likes
517

Hi John,

Have a Look at tbis thread

Hope this helps,

Regards,

Santosh

Read only

Former Member
0 Likes
517

hi john,

check this code...

data: objpack like sopcklsti1 occurs 2 with header line.

data: objhead like solisti1 occurs 1 with header line.

data: objbin like solisti1 occurs 10 with header line.

data: objtxt like solisti1 occurs 10 with header line.

data: reclist like somlreci1 occurs 5 with header line.

data: doc_chng like sodocchgi1.

data: tab_lines like sy-tabix.

  • Creation of the document to be sent

  • File Name

doc_chng-obj_name = 'SENDFILE'.

  • Mail Subject

doc_chng-obj_descr = 'Send test Mail'.

  • Mail Contents

objtxt = 'HELLO'.

append objtxt.

objtxt = 'THIS IS THE FIRST TEST MAIL'.

append objtxt.

objtxt = 'have a good day'.

append objtxt.

describe table objtxt lines tab_lines.

read table objtxt index tab_lines.

**attachment

objbin-line = 'this is the first document'.

append objbin.

doc_chng-doc_size = ( tab_lines - 1 ) * 255 + strlen( objtxt ).

clear objpack-transf_bin.

*OBJPACK-TRANSF_BIN = 'X'.

objpack-head_start = 1.

objpack-head_num = 0.

objpack-body_start = 1.

objpack-body_num = tab_lines.

*OBJPACK-BODY_NUM = 1.

objpack-doc_type = 'RAW'.

objpack-obj_name = 'Mail'.

objpack-obj_descr = 'First Mail'.

objpack-doc_size = 1 * 255.

append objpack.

  • Creation of the entry for the compressed document

*CLEAR OBJPACK-TRANSF_BIN.

objpack-transf_bin = 'X'.

objpack-head_start = 1.

objpack-head_num = 0.

objpack-body_start = 1.

*OBJPACK-BODY_NUM = TAB_LINES.

objpack-body_num = 1.

objpack-doc_type = 'RAW'.

objpack-obj_name = 'ATTACHMENT'.

objpack-obj_descr = 'Attached Document'.

objpack-doc_size = 1 * 255.

append objpack.

**Creation of the document attachment

    • (Assume that the data in OBJBIN is in BMP format)

*CLEAR OBJPACK-TRANSF_BIN.

objbin = ' \O/ '. append objbin.

objbin = ' | '. append objbin.

objbin = ' / \ '. append objbin.

describe table objbin lines tab_lines.

objhead = 'Ram149_jpg.jpg'.

append objhead.

    • Creation of the entry for the compressed attachment

objpack-transf_bin = 'X'.

objpack-head_start = 1.

objpack-head_num = 1.

objpack-body_start = 1.

objpack-body_num = tab_lines.

objpack-doc_type = 'JPG'.

objpack-obj_name = 'PICTURE'.

objpack-obj_descr = 'Picture'.

objpack-doc_size = tab_lines * 255.

append objpack.

  • Completing the recipient list

RECLIST-RECEIVER = 'xxx@yahoo.com'.

RECLIST-REC_TYPE = 'U'.

APPEND RECLIST.

  • Sending the document

call function 'SO_NEW_DOCUMENT_ATT_SEND_API1'

exporting

document_data = doc_chng

put_in_outbox = 'X'

commit_work = 'X'

tables

packing_list = objpack

object_header = objhead

contents_bin = objbin

contents_txt = objtxt

receivers = reclist

exceptions

too_many_receivers = 1

document_not_sent = 2

operation_no_authorization = 4

others = 99.

case sy-subrc.

when 0.

write: / 'Result of the send process:'.

loop at reclist.

write: / reclist-receiver(48), ':'.

if reclist-retrn_code = 0.

write 'The document was sent'.

else.

write 'The document could not be sent'.

endif.

endloop.

when 1.

write: / 'No authorization for sending to the specified number',

'of recipients'.

when 2.

write: / 'Document could not be sent to any recipient'.

when 4.

write: / 'No send authorization'.

when others.

write: / 'Error occurred while sending'.

endcase.

hope this helps,

do reward if it helps,

priya.

Read only

0 Likes
517

Thanks for the answers. I think my problem deals more with 2 PDF files. This is presenting me the most problem. The first attachment opens correctly, but the second PDF is all messed up.

Sending 2 text files, I think is ok, but 2 PDF's present a challenge.