2 attachments in a single mail

Hi
Can any 1 send me a piece of code to send 2 attachments in a single mail.
regards
Prasun

Have a look at this sample code
Prepare Packing List
PERFORM prepare_packing_list.
Set recipient - email address here!!!
mailrec-receiver = 'xxxx at yahoo com'.
mailrec-rec_type = 'U'.
APPEND mailrec.
Sending the document
CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
EXPORTING
document_data = maildata
put_in_outbox = 'X'
TABLES
packing_list = mailpack
object_header = mailhead
contents_bin = mailbin
contents_txt = mailtxt
receivers = mailrec
EXCEPTIONS
too_many_receivers = 1
document_not_sent = 2
operation_no_authorization = 4
OTHERS = 99.
ENDFORM. "send_form_via_email
Form PREPARE_PACKING_LIST
FORM prepare_packing_list.
CLEAR: mailpack, mailbin, mailhead.
REFRESH: mailpack, mailbin, mailhead.
DESCRIBE TABLE mailtxt LINES tab_lines.
READ TABLE mailtxt INDEX tab_lines.
maildata-doc_size = ( tab_lines - 1 ) * 255 + STRLEN( mailtxt ).
Creation of the entry for the compressed document
CLEAR mailpack-transf_bin.
mailpack-head_start = 1.
mailpack-head_num = 0.
mailpack-body_start = 1.
mailpack-body_num = tab_lines.
mailpack-doc_type = 'RAW'.
APPEND mailpack.
mailhead = 'TEST.TXT'.
APPEND mailhead.
File 1
mailbin = 'This is file 1'.
APPEND mailbin.
DESCRIBE TABLE mailbin LINES tab_lines.
mailpack-transf_bin = 'X'.
mailpack-head_start = 1.
mailpack-head_num = 1.
mailpack-body_start = 1.
mailpack-body_num = tab_lines.
mailpack-doc_type = 'TXT'.
mailpack-obj_name = 'TEST1'.
mailpack-obj_descr = 'Subject'.
mailpack-doc_size = tab_lines * 255.
APPEND mailpack.
*File 2
mailbin = 'This is file 2'.
APPEND mailbin.
DATA: start TYPE i.
DATA: end TYPE i.
start = tab_lines + 1.
DESCRIBE TABLE mailbin LINES end.
mailpack-transf_bin = 'X'.
mailpack-head_start = 1.
mailpack-head_num = 1.
mailpack-body_start = start.
mailpack-body_num = end.
mailpack-doc_type = 'TXT'.
mailpack-obj_name = 'TEST2'.
mailpack-obj_descr = 'Subject'.
mailpack-doc_size = tab_lines * 255.
APPEND mailpack.

Similar Messages

  • Need to send CSV attachments in a single mail to the Rcvr

    Hi All,
         Currently we are using 7.1 release of PI system. The scenario is from IDOC to ANSI Format. All the files recieved from IDOC should be sent as an attachment in  CSV format in a single mail .Could anyone please let me know how to proceed with this. If there is any javamapping needed for this? If yes, could you please provide the code for the  same,
    Regards,
       Pavithra

    Hi Pavithra,
    How to Guide for sending mails:
    http://www.sdn.sap.com/irj/scn/index?rid=/library/uuid/d0964d7c-e66e-2910-24bb-ac535e4a5992
    Use StrictXML2PlainBean in the module processor to convert the data to CSV:
    /people/pooja.pandey/blog/2009/02/23/xml-to-text-conversion-made-easy-by-strictxml2plainbean
    http://help.sap.com/saphelp_nwpi711/helpdata/en/44/748d595dab6fb5e10000000a155369/content.htm
    Regards,
    Aravind

  • How to send multiple attachment in single mail

    i am using FM SO_NEW_DOCUMENT_ATT_SEND_API1 for sending mail.
    pls guide me how can i modify my code so that i can send multiple attachments

    Hi Manish,
    Check out the links below.
    E-mail multiple PDF attachments
    Send a Single Mail with Multiple Attachment
    Hope it helps.
    Regards,
    Amit
    *Always reward points for helpful answers
    Message was edited by:
            Amit Kumar

  • How to send multiple attachements in single mail

    Hi All,
    Currently i am using this function module SO_NEW_DOCUMENT_ATT_SEND_API1 to send mail with only one attachment.
    But now i need to send multiple attachments to a single mail.
    Can any one please tell me as how to send multiple attachments in single mail.
    Thanks in advance.

    Hi
    See this and do accordingly
    Mailing with Attachment by ABAP Coding  
    Refer this link:
    Mail with attachment.
    FORM send_list_to_basis .
      DATA: w_path      LIKE rlgrap OCCURS 0 WITH HEADER LINE,
            lt_index    TYPE sy-tabix,
            doc_type(3) TYPE c,
            descr       LIKE it_objpack_basis-obj_descr,
            temp_data   LIKE w_path,
            temp1       TYPE string,
            tab_lines   TYPE i,
            langu(15)   TYPE c,
            expirydate  TYPE so_obj_edt,
            L_FILE1(100).
      CONCATENATE 'C:\' sy-repid '_' sy-datum '.XLS' INTO L_FILE1.
      W_PATH-FILENAME = L_FILE1.
      APPEND w_path.
      CLEAR w_path.
      wa_doc_chng-obj_descr  = 'User List not logged on for 180 days'.
      wa_doc_chng-obj_langu  = 'E'.
      wa_doc_chng-obj_expdat = sy-datum.
      CLEAR w_subject.
      CONCATENATE 'Please find attached document with list of users'
                  'not logged on for 180 days for client' sy-mandt
                  INTO w_subject SEPARATED BY space.
      it_objtxt_basis-line = w_subject.
      APPEND it_objtxt_basis.
      CLEAR it_objtxt_basis.
      it_objtxt_basis-line = text-004.
      APPEND it_objtxt_basis.
      CLEAR it_objtxt_basis.
      CLEAR w_tab_line.
      DESCRIBE TABLE it_objtxt_basis LINES w_tab_line.
      READ TABLE it_objtxt_basis INDEX w_tab_line  INTO l_cline.
      wa_doc_chng-doc_size =
       ( w_tab_line - 1 ) * 255 + STRLEN( l_cline ).
      CLEAR it_objpack_basis-transf_bin.
      it_objpack_basis-head_start = 1.
      it_objpack_basis-head_num   = 0.
      it_objpack_basis-body_start = 1.
      it_objpack_basis-body_num   = w_tab_line.
      it_objpack_basis-doc_type   = 'RAW'.
      APPEND it_objpack_basis.
      CLEAR it_objpack_basis.
      LOOP AT w_path.
        temp1 = w_path.
        descr = w_path.
        CALL FUNCTION 'STRING_REVERSE'
          EXPORTING
            string  = descr
            lang    = 'E'
          IMPORTING
            rstring = descr.
        CALL FUNCTION 'STRING_SPLIT'
          EXPORTING
            delimiter = '\'
            string    = descr
          IMPORTING
            head      = descr
            tail      = temp_data.
        CALL FUNCTION 'STRING_REVERSE'
          EXPORTING
            string  = descr
            lang    = 'E'
          IMPORTING
            rstring = descr.
        CALL FUNCTION 'STRING_SPLIT'
          EXPORTING
            delimiter = '.'
            string    = descr
          IMPORTING
            head      = temp_data
            tail      = doc_type.
        CALL FUNCTION 'GUI_UPLOAD'
          EXPORTING
            filename      = temp1
            filetype      = 'BIN'
            header_length = 0
            read_by_line  = 'X'
            replacement   = '#'
          TABLES
            data_tab      = it_upload.
        DESCRIBE TABLE it_upload LINES tab_lines.
        DESCRIBE TABLE it_objbin_basis LINES lt_index.
        lt_index = lt_index + 1.
        LOOP AT it_upload.
          wa_objbin_basis-line = it_upload-line.
          APPEND wa_objbin_basis TO it_objbin_basis.
          CLEAR wa_objbin_basis.
        ENDLOOP.
        it_objpack_basis-transf_bin = 'X'.
        it_objpack_basis-head_start = 0.
        it_objpack_basis-head_num   = 0.
        it_objpack_basis-body_start = lt_index.
        it_objpack_basis-body_num   = tab_lines.
        it_objpack_basis-doc_type   = doc_type.
        it_objpack_basis-obj_descr  = descr.
        it_objpack_basis-doc_size   = tab_lines * 255.
        APPEND it_objpack_basis.
        CLEAR it_objpack_basis.
      ENDLOOP.
      it_reclist_basis-receiver = '[email protected]'.
      it_reclist_basis-rec_type = 'U'.
      APPEND it_reclist_basis.
      CLEAR it_reclist_basis.
      CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
        EXPORTING
          document_data              = wa_doc_chng
          put_in_outbox              = 'X'
          commit_work                = 'X'
        TABLES
          packing_list               = it_objpack_basis
          contents_txt               = it_objtxt_basis
          contents_bin               = it_objbin_basis
          receivers                  = it_reclist_basis
        EXCEPTIONS
          too_many_receivers         = 1
          document_not_sent          = 2
          operation_no_authorization = 4
          OTHERS                     = 99.
      IF sy-subrc EQ 0.
        SUBMIT rsconn01 WITH mode = 'INT' AND RETURN.
      ENDIF.
    ENDFORM.                    " send_list_to_basis
    <b>Reward points for useful Answers</b>
    Regards
    Anji

  • Multiple Mail attachment (PDF and Excel) in a single mail

    Please help me to send the PDF and Excel attachment in the single mail. I am using the FM for PDF is 'SO_NEW_DOCUMENT_ATT_SEND_API1' and for Excel 'SO_DOCUMENT_SEND_API1'. Currently the program sends 2 different attachments for PDF and Excel.
    Thanks in Advance.

    Hi,
    If you want to send multiple attachments in a single mail then i would suggest to use
    CL_BCS for achieving it.
    Look at standard program BCS_EXAMPLE_6 for more clarity.
    There you find this statement of code
    document1 = cl_document_bcs=>create_document
    After creating one document using this you can use the same statement again and create another document.
    document2 = cl_document_bcs=>create_document
    Both documents should have different name.
    Then use
    send_request->set_document( document1 ).
    send_request->set_document( document2 ).
    This will attach both the documents to a single email.
    Hope this helps.
    Regards,
    -Sandeep

  • Multiple attachments in single mail using XML publisher bursting

    Hi all
    I am sending the PDF generated to a particular mail recipient using the bursting options.
    There is requirement in which I have to attach two different PDF's to the mail. These multiple attachments should go in a single mail. Please let me know how we can achieve this.
    Thanks in adv,
    Srini
    Edited by: 796646 on Mar 4, 2011 2:35 PM

    Suresh,
    just copy your question and paste it in search box.. press enter
    there are too many posts already on this.
    still a little help for you, with explanation:
    [code snipet with documentation|http://wiki.sdn.sap.com/wiki/display/Snippets/MultipleAttachmentsExplanation]

  • TS3276 Mail Services - Mavericks this is new OS to me.I am having trouble with attachments to my e-mails.  The attachments were not large (single sheet typed).  Getting message file to large.  Never had this before.  Please advise correct procedure to att

    Some of the attachments were only a couple of typed pages.  I saved them as pdf format so receiver could read.  The pdf file would not attach.  Program gave message file to large for attachment to e-mail.  Perhaps I am not doing correct procedure to attaching a file to an e-mail.  I tried typing the document and saving it in pdf format to the desktop.  Opened the e-mail on Safarii - typed a quick message and then tried to drop /drag attachment from desktop to e-mail. Up pops the stupid message.  Would someone give me the step by step procedure for adding attachments to an e-mail being sent via Safari.  Also is there a way to send large files as an attachment.  I was able to do this when I was using mountain lion.  Help please.

        I can see that this issue has been quite extensive, and frustrating, and I am so sorry for all that has happened societygirl! I would like to help you work this issue out. Please follow & send me a Direct Message, so I can get your account specifics and help finally bring this to a resolution.
    Thank you,
    MichelleH_VZW
    Follow us on Twitter @VZWSupport

  • How to attach Multiple attachments to single mail

    How to attach multiple pdfs to single mail  ?
    or
    how to attach one pdf & One excel & One word document to single mail ?
    Thanks In Advance

    Hello Karunya,
    Please refer to the link below.
    https://wiki.sdn.sap.com/wiki/display/Snippets/Send%20email%20with%20multiple%20zipped%20attachments
    Regards,
    P Bansal

  • Sending multiple reports thru single mail in Crystal reports server XI R2

    2)
    Ex:
    I have a crystal report  which takes country as input parameter. Each country has one responsible person.
    US--- A person
    UK---B person
    INDIA ---C person
    I need to run this report with these three paramters(may increase infuture) and send the exported report to A,B and C as an mail attachment through crystal reports server XI R2.
    I have achieved above with Java code and deployed that java code as JAR file in crystal reports server and scheduled this JAR file.
    Here I need to attach all these three attachments to single mail and send it to Manager. And also I need to wait till all the reports gets executed and then attach all the attachments to single mail.
    Please help me how to achieve this.
    I am using --- Crystal reports server XI R2
    Thanks,
    Vijay Kanth

    How are you creating the first three files, are you scheduling each to smtp, or are you waiting until they finish and emailing the instance through your jar file?
    If you are scheduling each one, and the instance in enterprise keeps a copy of the finished report, then you could monitor the status of the 3 jobs, once all finish you could get the report and email them out through your java code.  There wouldn't be a way to email all three reports as one email to the manager directly through the product.  You would be able to cc or bcc the manager on each, but then the manager would be receiving 3 emails.

  • Send a Single Mail with Multiple Attachment

    Hi Every One,
    SO_DOCUMENT_SEND_API1 is the function Module used  to send a file as attachment with the mail.My requirement is to send more than one file as multiple attachments in the same mail. Is this Possible? and How?
    Regds,
    Rajeev.N

    Yes this is possible.  This is what the packing_list parameter of this function module is for.  You put all of your content together into the contents_bin or the contents_txt (or a combination of both).  You then add an entry into the packing_list  table for each individual element.  Here is some code samples for filling in the packing_list:
              objpack-transf_bin = 'X'.
              objpack-head_start = body_counter.
              objpack-head_num   = 1.
              objpack-body_start = body_counter.
              objpack-body_num   = tab_lines.
              objpack-doc_type   = extention.
              objpack-obj_name   = objhead.
              move objhead to
                           objpack-obj_descr.
              body_counter = body_counter + tab_lines.
              objpack-doc_size   = tab_lines * 255.
              append objpack.
    We keep a counter for each element.  We have to supply the starting position of each element and its total lenght.

  • How do I save attachments with an E Mail?

    How do I save attachments with an E Mail?

    Hover the mouse at the top of an email with an attachment, in the area shown in the image below, and it should reveal the attachments icon - select it and download the attachments to wherever you wish on your HD.

  • Can attachments be sent with mail from an Ipad

    Can attachments be sent with mail from an Ipad?

    Please ignore this question as I have just found the answer filed by other users.

  • How to add multiple passbooks cards to a single mail

    im trying to add multiple passbook cards to a single mail on iphone
    how can i do that....
    the upload or share tab in passbook card only allows one card at a time on my iphone...
    pls help...

    its still not happening
    i did that way and pasted all multiple passbook cards in a single message
    then i copied all and pasted it in mail...
    its coming as attachment .pk in mail body but no attachment is there ...
    so the receiver of the mail is not able to get the picture of the passbook card...
    its not working...

  • Since I downloaded Firefox 4, I can't see attachments in my Yahoo mail. This is not a problem of Yahoo, because with Internet Explorer works fine. What is the problem?

    Question
    Since I downloaded Firefox 4, I can't see attachments in my Yahoo mail. This is not a problem of Yahoo, because with Internet Explorer works fine. What is the problem?

    Ok, now they are showing. I restarted my computer again and they are showing now.

  • Multiple PDF Sending via single mail

    Hi Experts,
    I have a requirement in which when the user runs a report, he could get many invoices. We need to send all the invoices in the list converted to PDF and sent all the PDF(Multiple) to the sold to party mail ID.
    If the Size of the PDF attachment exceeds we need to send as multiple mails.
    I have only the invoice number and output type from the report. ITs not a print program there is no Close_form to get otf_data.
    Is there any function module to convert a invoice to OTF then to PDF. ?
    Is there any function module to send Mutiple PDF(MIN of 10) attached in a single mail ?
    Regards,
    Venkatesh.

    Hi
    USe this link.
    http://forums.sdn.sap.com/search.jspa?threadID=&q=multiplePDFinSinglemail&objID=f231&dateRange=all&numResults=15&rankBy=10001
    Regards
    Azeez

Maybe you are looking for