Sending mail with 2 attachments

Hi All,
        I have a requirement where I have to send a mail with 2 attachments. Both attachments should be excel sheets.
Iam using the function module
  CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
    EXPORTING
      document_data              = gd_doc_data
      put_in_outbox              = 'X'
      commit_work                = 'X'
    IMPORTING
      sent_to_all                = gd_sent_all
    TABLES
      packing_list               = it_packing_list
      contents_txt               = it_message
     contents_bin               = it_attachment
      receivers                  = it_receivers
    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 don't know where to pass another attachment.
How can it be done?
Kindly help me.
Regards,
Krithika

Hi,
Try this code.
you have to populate both packing_list and contents_bin internal tables before passing to the fm SO_NEW_DOCUMENT_ATT_SEND_API1
FORM CONVERT_OTF_TO_PDF TABLES OTFTAB STRUCTURE OTF.
  CLEAR: SOOD, W_LINES, CONTENT_IN, CONTENT_OUT.
  REFRESH: CONTENT_IN, CONTENT_OUT.
  DESCRIBE TABLE OTFTAB LINES W_LINES.
  SOOD-OBJLEN = W_LINES.
  REFRESH: CONTENT_IN, CONTENT_OUT.
  CLEAR: CONTENT_IN, CONTENT_OUT.
   CONTENT_IN[] = OTFTAB[].
    CALL FUNCTION 'SX_OBJECT_CONVERT_OTF_PDF'
         EXPORTING
              FORMAT_SRC      = 'OTF'
              FORMAT_DST      = 'PDF'
              DEVTYPE         = 'HPLJ5SI'
*         FUNCPARA        =
              LEN_IN          = SOOD-OBJLEN
*    IMPORTING
*         LEN_OUT         =
         TABLES
              CONTENT_IN      = CONTENT_IN
              CONTENT_OUT     = CONTENT_OUT
         EXCEPTIONS
              ERR_CONV_FAILED = 1
              OTHERS          = 2.
  REFRESH OBJBIN. CLEAR OBJBIN.
  IF GV_SUMMARY <> 'X'.
    OBJBIN[] = CONTENT_OUT[].
  ELSE.
    REFRESH CONTENT_OUT.
    CLEAR CONTENT_OUT.
  ENDIF.
  REFRESH: CONTENT_IN, OBJPACK.
  CLEAR: CONTENT_IN, OBJPACK.
  DOC_CHNG-OBJ_NAME = TEXT-003.
  IF SY-SYSID NE 'S4P'.
   IF DOC_CHNG-OBJ_DESCR IS  INITIAL.
      DOC_CHNG-OBJ_DESCR = TEXT-004.
    ELSE.
      IF GV_SUMMARY = 'X'.
       DOC_CHNG-OBJ_DESCR = TEXT-012.
      ENDIF.
    ENDIF.
  ENDIF.
  DESCRIBE TABLE OBJTXT LINES TAB_LINES.
  READ TABLE OBJTXT INDEX TAB_LINES.
  DOC_CHNG-DOC_SIZE = ( TAB_LINES - 1 ) * 255 + STRLEN( OBJTXT ).
* Fill the fields of the packing_list for the main document:
    CLEAR  OBJPACK.
    DESCRIBE TABLE OBJBIN LINES TAB_LINES.
   OBJPACK-TRANSF_BIN = 'X'.
    OBJPACK-HEAD_START = 1.
    OBJPACK-HEAD_NUM = 0.
    OBJPACK-BODY_START = 1.
    OBJPACK-BODY_NUM = TAB_LINES.
    OBJPACK-DOC_TYPE = 'XLS'.
    OBJPACK-OBJ_NAME = 'Attachment'.
    OBJPACK-OBJ_DESCR = C_PAYER.
    READ TABLE OBJBIN INDEX TAB_LINES.
    DOC_SIZE = ( TAB_LINES - 1 ) * 255 + STRLEN( OBJBIN ).
    OBJPACK-DOC_SIZE = DOC_SIZE.
    APPEND OBJPACK.
    CLEAR  OBJPACK.
    DESCRIBE TABLE OBJBIN LINES TAB_LINES.
   OBJPACK-TRANSF_BIN = 'X'.
    OBJPACK-HEAD_START = 1.
    OBJPACK-HEAD_NUM = 0.
    OBJPACK-BODY_START = 1.
    OBJPACK-BODY_NUM = TAB_LINES.
    OBJPACK-DOC_TYPE = 'XLS'.
    OBJPACK-OBJ_NAME = 'Attachment'.
    OBJPACK-OBJ_DESCR = C_PAYER.
    READ TABLE OBJBIN INDEX TAB_LINES.
    DOC_SIZE = ( TAB_LINES - 1 ) * 255 + STRLEN( OBJBIN ).
    OBJPACK-DOC_SIZE = DOC_SIZE.
    APPEND OBJPACK.
    REFRESH RECLIST.
    CLEAR RECLIST.
** get E-mail address
      IF NOT P_EMAIL IS INITIAL.
        RECIPIENT_INT-ADDRESS = P_EMAIL.
      ENDIF.
        RECLIST-RECEIVER = RECIPIENT_INT.
        RECLIST-REC_TYPE = 'U'.
        APPEND RECLIST.
* SEND THE DOCUMENT BY CALLING THE SAPOFFICE API1 MODULE
* FOR SENDING DOCUMENTS WITH ATTACHMENTS
  CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
       EXPORTING
            DOCUMENT_DATA              = DOC_CHNG
            PUT_IN_OUTBOX              = 'X'
       IMPORTING
            SENT_TO_ALL                = SENT_TO_ALL
       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.
Regards,
Sailaja.

Similar Messages

  • How to send mail with attachments - ALBPM 5.7

    Hi All,
    I am new to BPM,
    Someone could help giving me a example of Send Mail with attachments in Aqualogic Studio 5.7?
    thanks,
    Renata

    nombrefichero="C:\\Temp\\test.doc"
    subject as String="Subject"
    message as String="Message"
    mailAttachment = Fuego.Net.MailAttachment(source : BinaryFile.readToBinaryFrom(name : nombrefichero), fileName : "test2.doc")
    mailAttachments[0] = mailAttachment
    correo as Mail
    correo.attachments = mailAttachments
    correo.contentType = "text/html"
    send correo
    using from = "[email protected]",
    recipient = "[email protected]",
    subject = subject,
    message = message

  • Receiving mail, but can't send mail with attachments?

    Hello,
    I can't send mails anymore, I have been able to send some without any attachments (i.e. reply doesn't work as it automatically attaches the original text). This started 3 days ago. Also, my mail doesn't seem to recognize powerpoint and word docs., but I a know the people who have send me such files do not have VISTA. When I choose "open with" then it works. So I have 2 problems, one being moe urgent then the other.
    1) can't send mail with attachments
    2) .doc (word), .pps (powerpoint)attachments are not always recognized.
    thank you all!!!

    Try going into Settings > Mail, Contacts, Calendars > select the account > account name , tap on SMTP (under the 'Outgoing Mail Server' heading) and then tap on your Primary Server and try entering your email account and password and see if it then works

  • Sending mails with attachments using oracle 8i

    Hi,
    Could anybody please send a sample code for sending mails
    with attachments using oracle 8i.
    Thanks in advance

    For oracle8i there is an example package from OTN:
    http://www.oracle.com/technology/sample_code/tech/pl_sql/htdocs/Utl_Smtp_Sample.html
    You have to re-write the package a bit to work it with BLOBs instead of RAW attachments, but that should be no problem
    Hop this helps,
    Michiel

  • Problem sending mail with attachments???

    Hi Everybody,
    I have got a problem sending mail with attachments...
    I am able to send a plain mail ... but when i am trying to send mail along with an attachment ... its not being sent....
    its not showing any error it is simply hanging...
    what should i do?
    If u know any solns please do suggest me....
    Thanks in advance

    activation.jar is already there...
    initially i wrote a swing program as a front end and it was working abs fine... in my sense it was properly sending mails along with the attachments...
    when i changed the front-end to JSP handled by Servlets i am getting a problem...
    and even the swing program stopped working ...
    now swing program is getting compiled but it is hanging at run time showing an exception "Exception occured during event dispatching"
    i dont understand what probably may be the problem...
    if u can trace out, please give me any suggestions
    Thanks in advance and regards

  • Cannot send mail with attachments-plain mail its ok. Any ideas?

    Out of the blue I cannot send e-mails with attachments (any kind). Mail without attachments go out without problems.
    Very weird.
    I have an iMac, mac mail 5.2. and Lion.
    Please help.
    Thanks

    Perhaps the mail server has a size limit that it allows. Might try a free web service and see if that will work for those attachments.

  • Iphone - cant send mails with attachments

    Hi,
    We run exchange 2007 & I have my account setup on my iphone but mails with attachments wont send they just sit in the outbox. Now other users in job have nokia E63 which they can send attachments without problems.
    Both would use activesync but presume maybe in a different way & that i just might need to make some change on exhange.
    Anyone have any ideas?

    Turns out a couple of components of AVG were causing the problem. Please see http://www.avg.com/us-en/faq?num=3254#tba7

  • Mail doesn't send mails with attachments 1Mb

    Hi,
    I'm using Mail with a ManagedExchange account. Before Snow Leopard I was using Entourage 2008.
    Everything seems to work fine. Except sending of larger files fails.
    Every time I send a mail which is approx. <1Mb Mail starts transmitting data (see it via Little Snitch 2.2b) and stops after a while doing nothing anymore. The mail stays in the outbox, and the moving circle which indicates that a folder is being synchronized appears endless. No other mails are going out then. After a while I get a message that my email couldn't be sent via my mail server. And the connection failed. And I can choose another mail server if I would have any. Entourage doesn't have that problems. So the connection seems to be fine. Small attachments are no problem.
    What's the problem?
    Regards,
    OberMufti

    I'm getting a similar problem. Snow Leopard Mail for me seems to be choking on large attachments - sending them, forwarding them, or even moving them from one IMAP folder to another.
    My mails are getting through, but it takes a long time and they are dragging the whole system to a crawl in the process.

  • Sending mails with attachments is sending some parts in HTM format

    I have configured my ME account to Apple Mail. When I send an email with first some text, then i add an picture under the text, and after the picture i add some more text. Then i send the mail to someone.
    When that person opens the mail in Outlook on Windows for example, the first text that i typed above the picture is visible in the mail, the picture is added as an jpg attachment, but the text that i typed under the picture is always added in a HTM file
    So they don't see the whole mail, only the first end until the picture, the rest is an HTM attachment.
    It happens with mails send with Mobile Me, but also with other POP3 accounts.
    I already tried to change EDIT - ATTACHMENTS - SEND AS WINDOWS ATTACHMENTS and ATTACHMENTS AT END OF THE MAIL
    Both settings doesn't work.
    Please HELP!!

    I was troubleshooting my own issue noted above and tried to send the attachments via gmail's web interface (bypassing Apple Mail). This time, gmail provided an error message stating that the file contained a virus.
    Since it was a zip of several Word docs, I saved them as PDFs and then rezipped, and Apple Mail sent them off like a champ.
    Evidently, Mail does not have a method for relaying the precise nature of the error message that gmail sends (in this case that the attachment had what gmail thought was a virus). This would be a prime area for some software developers to tackle on a future version of Mail.
    By the way, the files almost certainly do not contain viruses; they are extremely old Word Docs that have been on my successive Mac hard drives for at least 9 years. Too old a format for gmail to recognize?
    Hope this helps someone who may be having the same trouble.

  • Geary cannot send mail with attachments

    I've been using Geary, a mail client, and I've never been able to send any mail containing attachments. The same mail, meanwhile, gets through if I use Thunderbird. The exact messages which Geary posts if I run it through a terminal are:
    ** Message: smtp-client-session.vala:80: Unable to QUIT: Error writing data to TLS socket: The specified session has been invalidated for some reason.
    ** Message: smtp-client-session.vala:88: Unable to disconnect: Unable to shutdown socket: Transport endpoint is not connected
    These two messages keep repeating. There is no problem with mails not containing attachments. Has anyone else had the same problem? Or is this a bug I should be reporting upstream?

    Perhaps the mail server has a size limit that it allows. Might try a free web service and see if that will work for those attachments.

  • Send mail with attachments

    I downloaded a code from-
    http://www.stardeveloper.com/articles/display.html?article=2001101101&page=1
    it has four files: three files are ok. but there is one bean file.
    MailerBean.class
    package com.stardeveloper.bean.test;
    import java.io.*;
    import java.util.*;
    import javax.mail.*;
    import javax.mail.event.*;
    import javax.mail.internet.*;
    public final class MailerBean extends Object implements Serializable {
         /* Bean Properties */
         private String to = null;
         private String from = null;
         private String subject = null;
         private String message = null;
         public static Properties props = null;
         public static Session session = null;
         static {
              /*     Setting Properties for STMP host */
              props = System.getProperties();
              props.put("mail.smtp.host", "mail.yourisp.com");
              session = Session.getDefaultInstance(props, null);
         /* Setter Methods */
         public void setTo(String to) {
              this.to = to;
         public void setFrom(String from) {
              this.from = from;
         public void setSubject(String subject) {
              this.subject = subject;
         public void setMessage(String message) {
              this.message = message;
         /* Sends Email */
         public void sendMail() throws Exception {
              if(!this.everythingIsSet())
                   throw new Exception("Could not send email.");
              try {
                   MimeMessage message = new MimeMessage(session);
                   message.setRecipient(Message.RecipientType.TO,
                        new InternetAddress(this.to));
                   message.setFrom(new InternetAddress(this.from));
                   message.setSubject(this.subject);
                   message.setText(this.message);
                   Transport.send(message);
              } catch (MessagingException e) {
                   throw new Exception(e.getMessage());
         /* Checks whether all properties have been set or not */
         private boolean everythingIsSet() {
              if((this.to == null) || (this.from == null) ||
                 (this.subject == null) || (this.message == null))
                   return false;
              if((this.to.indexOf("@") == -1) ||
                   (this.to.indexOf(".") == -1))
                   return false;
              if((this.from.indexOf("@") == -1) ||
                   (this.from.indexOf(".") == -1))
                   return false;
              return true;
    }1. Do i have to give some protocol names.
    2. If so how do i find them.
    3. I want to send mail from our intranet.(company).
    4. I am using NetBeans 5.0. it is asked to save the bean file in a folder in web-inf\classes. but i dont have classses in that folder. Also i dont have libraries folder. Do I have to change any settings?
    5. How can i create class for this bean file. If i save it in web-inf, it says u can not save it there and saves it in source packages. What shall i do.

    (You found all the free sample source code that's included with JavaMail, right?)
    You probably don't need to specify any protocol names, the defaults should work.
    You will have to set the properties appropriately for your environment, however.
    You'll want to handle this class just like any other Java source file in your
    web application. Usually such files are compiled and the resulting class
    file ends up in WEB-INF/classes.

  • Not sending mails with attachments (Imap Gmail)

    I've only Imap-Gmail accounts in my Apple Mail, and using it for almost a year without any problems. But since a couple of weeks, most of the time I'll send an email with an attachment in it. I'll get the Pop-Up window that the mail can not be sent, and that I can choose another mailserver to send the mail. When I check my connection, there is not a problem. But the mail is still standing in my Outgoing Mail and is not sending.
    Can anyone help?

    I was troubleshooting my own issue noted above and tried to send the attachments via gmail's web interface (bypassing Apple Mail). This time, gmail provided an error message stating that the file contained a virus.
    Since it was a zip of several Word docs, I saved them as PDFs and then rezipped, and Apple Mail sent them off like a champ.
    Evidently, Mail does not have a method for relaying the precise nature of the error message that gmail sends (in this case that the attachment had what gmail thought was a virus). This would be a prime area for some software developers to tackle on a future version of Mail.
    By the way, the files almost certainly do not contain viruses; they are extremely old Word Docs that have been on my successive Mac hard drives for at least 9 years. Too old a format for gmail to recognize?
    Hope this helps someone who may be having the same trouble.

  • Crash when I send mail with attachments.

    Having upgraded to 10.6, when I send an email (through Mail) which has an attachment, Mail will crash. This is bad. Bad, Bad, bad,bad, BAD! Almost every email I want to send has to have attachments, and so mu mail has (effectively) been crippled.
    This is something I need a solution to YESTERDAY!

    I have the same problem, but its not limited to Mail. whenever I attach a file to mail or entourage or import to word, or upload via facebook or safari, i get a crash
    any help on this issue would be advisable

  • Cannot send mail with attachments after 3.0

    Upgraded to 3.0 last night. At first I thought I couldn't send any mail at all, but after testing this some more I've found that I can send and receive email from my mobileme account, but if there is an attachment, (pic etc) mail hesitates then closes without sending anything.
    My other email account has no problems at all with this. Just MobileMe.

    I am also having this problem. Mine keeps saying that it can't connect to the SMTP server that I have turned off. I was told by Apple that I had to use the AT&T SMTP server which fixed my problem before. However, I downloaded 3.0 yesterday and now it refuses to even try the AT&T server even though it's the only one I have turned on. I can send text emails without any issue.

  • Sending mail with attachments screws up signature images

    Hello,
    For work I have to use an image in my corporate signature. All works well on plain emails, but as soon as I add an attachment to a message, the image in the signature also becomes an attachment and leaves a blank space in the signature.
    Tested on the receiving end with Gmail and Outlook.
    Any ideas?
    P.S. I can't use Exchange (office365) and must use IMAP. If I use Exchange, my message encoding gets screwed up and displays ? instead of čęėį. Lastly, if the attachment is inline, the rest of the message (after the attachment) is gone on the receiving end.

    Try force closing the Mail app and resetting your phone.  To do this, double-tap the home button, locate and swipe up on Mail to close it, tap the home button again, then hold the sleep/wake and home buttons at the same time until you see the Apple logo, then release.  After it restarts, test Mail again.
    If it still fails and this is an iCloud email account, try going to Settings>iCloud, turn Mail off, reset your phone again, then go back and turn Mail back on again.  (This removes, then adds back your iCloud email account.)

  • Sending Emails with Attachments greater than 255 chars in 4.6C

    Hi,
    I have a requirement in which i have to send mails with attachments greater than 255 characters. The attachment would be a tab-delimited .TXT file. Since i am working on 4.6C, i don't have the luxury of using the FM 'SCMS_STRING_TO_FTEXT'.
    It's very urgent. So any help in this regards would be greatly appreciated.
    Thank you.
    Balaji

    Hi,
    Internal table to be passed to SOLIST1 type int, table and then compress this table using fm "table_compress" with the compressed table then call fm "table_decompress" and pass this to function module SO_NEW_DOCUMENT_ATT_SEND_API1.
    Keep in mind the following variable
    i_packing_list-transf_bin = 'X'.
    aRs

Maybe you are looking for

  • Recently created items not shown in finder.

    In an effort to replace the invaluable (IMO) recent item canned searches that were on the older Mac OSX finder sidebars, I've changed the settings of the "All My Files" folder to display by "last modified". Only problem is that it doesn't want to sho

  • Blu-ray Compatibility Testing: Not Encouraging

    Today, I decided to try playing a disc that I created with Encore, a Blu-ray disc that my Sony BDP-S301 reads just fine, at a local Sears consumer electronics showroom. They had three Blu-ray disc players: Sony BDP-S300 Samsung Sharp Aquos I tried th

  • IMac G5 w/ internal camera

    I am working on an iMac G5 20" w/ internal camera and when I try to run a video chat session in iChatAV I get a message saying the camera is in use by another Application. Rebotting doesn't solve the problem and Activity View doesn't show any process

  • Captions for Web Galleries Created by Aperture 2

    I recently created a web gallery with Aperture 2 and posted it on .Mac. When looking at the Settings for for the Web Gallery (under Aperture 2), I see an option to "Show Version Name." I'd like to use the caption for each photo as opposed to using th

  • Slow Shutdown & Startup on MacBookPro OS ML 10.8.2

    I have faced slow shutdown & startup on my MacBook Pro Late 2011 , OS X Mountain Lion 10.8.2 for a while. I have done searching for solution and had tried some but no luck. Could someone please help. Thanks! Below are the message from console Dec 24