Email with attachments whose path is mentioned in hier seq list

Hi,
I am trying to send 3 attachments to an email by using SO_NEW_DOCUMENT_ATT_SEND_API1
The files are to be picked up from an editable field of header of an hierarchical sequential ALV list. The email with attachments has to be sent on click of a user button 'Send email'.
Can anyone guide me how to achieve these?
1) F4 for filepath on the ALV field for hier seq list
2) The attachments should be the ones mentioned in the file paths of fields f1, f2, f3 resply.
Currently, the attachments are sent with the mail but are empty and without filenames!
Part of the code for attachments is pasted below:
Pack the mail contents and attachment
  lt_packing_list-transf_bin  = space.
  lt_packing_list-head_start  = 1.
  lt_packing_list-head_num    = 0.
  lt_packing_list-body_start  = 1.
  lt_packing_list-body_num    = LINES( objcont ).
  lt_packing_list-doc_type    = 'RAW'.
  APPEND lt_packing_list. CLEAR lt_packing_list.
  lt_packing_list-transf_bin  = 'X'.
  lt_packing_list-head_start  = 1.
  lt_packing_list-head_num    = 1.
  lt_packing_list-body_start  = 1.
  lt_packing_list-doc_type    = 'XLS'. " You can give RAW incase if you want just a txt file.
  lt_packing_list-obj_name    = gt_ppsn_hdr-att1.
  APPEND lt_packing_list. CLEAR lt_packing_list.
Regards,
Poonam

I would like to suggest you , to use this kind of form.... for you sending mail result
    PERFORM send_file_as_email_attachment  USING g_email "Email
          userid "Account SAP
    CHANGING return_error. "Eventually
*&      Form  send_file_as_email_attachment
      text
     -->P_EMAIL    text
     -->P_ERROR    text
FORM send_file_as_email_attachment USING p_email
                                         p_parid
                                CHANGING p_error.
  DATA: f_send_request  TYPE REF TO CL_BCS,
        f_sent_to_all   TYPE OS_BOOLEAN,
        f_xls_content   TYPE SOLIX_TAB,
        f_document      TYPE REF TO CL_DOCUMENT_BCS,
        f_recipient     TYPE REF TO if_recipient_bcs,
        f_bcs_exception TYPE REF TO CX_BCS,
        f_text          TYPE bcsy_text WITH HEADER LINE,
        f_wa_text       TYPE soli,
        f_error         TYPE TABLE OF solisti1 WITH HEADER LINE,
        f_lw_error      LIKE LINE OF f_error,
        f_length        TYPE so_obj_len,
        f_xls_length    TYPE so_obj_len,
        f_subject       TYPE so_obj_des,
        f_n10           TYPE I.
  CONSTANTS:  con_tab TYPE C VALUE cl_abap_char_utilities=>HORIZONTAL_TAB,   "OK for non Unicode
              con_cret TYPE C VALUE cl_abap_char_utilities=>CR_LF.  "OK for non Unicode
  DATA:
  bxls_string    TYPE string,
  bxls_str      TYPE xstring.
  CHECK NOT p_email IS INITIAL.
*To send mail the xstring having excel format data
  TRY.
    Create persistent send request
      f_send_request = cl_bcs=>create_persistent( ).
      f_wa_text = TEXT-m01.  
      APPEND f_wa_text TO f_text.   "****** CONTENT OF MAIL
      "Data above populated
      f_subject = TEXT-t01.
      DESCRIBE TABLE f_text LINES f_n10.
      f_n10 = ( f_n10 - 1 ) * 255 + STRLEN( f_text ).
      f_length = f_n10.
      MOVE text-c01 TO f_subject.
      f_document = cl_document_bcs=>create_document(
      i_type    = 'RAW'
      i_text    = f_text[]
      i_length  = f_length
      i_subject = f_subject ).                              "#EC NOTEXT
ATTACHMENT
XLS HEADER 
      CLEAR: bxls_string, bxls_str.
      CONCATENATE text-001 text-002 text-003 text-004 text-020 text-017 text-018 text-019
                  text-005 text-006 text-007
                  text-008 text-009 text-010 text-011 text-012 text-013 text-014
                  text-015 text-016 con_cret INTO bxls_string SEPARATED BY con_tab.
      CALL FUNCTION 'SCMS_STRING_TO_XSTRING'
        EXPORTING
          TEXT   = bxls_string
        IMPORTING
          BUFFER = bxls_str
        EXCEPTIONS
          FAILED = 1
          OTHERS = 2.
      IF SY-SUBRC <> 0.
      ENDIF.
FILE CONTENT
      LOOP AT it_xls_invio.
Allega ciascun elenco individuato per l'indirizzo mail in elaborazione
        REFRESH f_xls_content.
    Create and set document
        CONCATENATE bxls_str it_xls_invio-xls_str INTO it_xls_invio-xls_str IN BYTE MODE.
        f_xls_content = cl_document_bcs=>xstring_to_solix( it_xls_invio-xls_str ). "String having Excel format
        CALL METHOD f_document->add_attachment
        EXPORTING
          i_attachment_type    = C_FORMATO   "CONSTANT         C_FORMATO(3) VALUE 'XLS'.
          I_ATT_CONTENT_HEX    = f_xls_content
         i_attachment_size    = xls_length
          i_attachment_subject = f_subject.
      ENDLOOP.
      CHECK sy-subrc EQ 0.
    Add document object to send request
      f_send_request->set_document( f_document ).
    Add recipient (e-mail address)
    Create recipient object
      f_recipient = cl_cam_address_bcs=>create_internet_address( p_email ).
    Add recipient object to send request
      f_send_request->add_recipient( f_recipient ).
    Send document
      f_sent_to_all = f_send_request->send( i_with_error_screen = 'X' ).
      COMMIT WORK.
     ENDLOOP.
  Exception handling
  replace this rudimentary exception handling with your own one
    CATCH cx_bcs INTO f_bcs_exception.
      WRITE:/ ' Sending Error'.'
  ENDTRY.
ENDFORM.                    "send_file_as_email_attachment

Similar Messages

  • Send emails with attachments residing in the network

    Hi All,
    My requirement is to send email with attachments. I am using javamail and it works fine only if the attachment resides in the local machine.
    If the attachment resides in the network [the folder is shared by the user], the application gives me IOException.
    Please help. Let me know if I am not clear.

    Please find the trace below . Also I am able to browse the share but haven't tried writing a test app.
    javax.mail.MessagingException: IOException while sending message
    at com.sun.mail.smtp.SMTPTransport.sendMessage(SMTPTransport.java:595)
    at javax.mail.Transport.send0(Transport.java:169)
    at javax.mail.Transport.send(Transport.java:98)
    at SendEmail.sendMail(SendEmail.java:66)
    at FetchDetails.fetchResultSet(FetchDetails.java:69)
    at FetchDetails.<init>(FetchDetails.java:36)
    at Index.main(Index.java:3)
    Caused by: java.io.FileNotFoundException: \xxx.xxx.xx.xxx\dinesh\dialog.gif (The
    system cannot find the path specified)
    at java.io.FileInputStream.open(Native Method)
    at java.io.FileInputStream.<init>(FileInputStream.java:103)
    at javax.activation.FileDataSource.getInputStream(FileDataSource.java:80
    at javax.activation.DataHandler.writeTo(DataHandler.java:287)
    at javax.mail.internet.MimeBodyPart.writeTo(MimeBodyPart.java:1248)
    at javax.mail.internet.MimeBodyPart.writeTo(MimeBodyPart.java:747)
    at javax.mail.internet.MimeMultipart.writeTo(MimeMultipart.java:361)
    at com.sun.mail.handlers.multipart_mixed.writeTo(multipart_mixed.java:85
    at javax.activation.ObjectDataContentHandler.writeTo(DataHandler.java:83
    9)
    at javax.activation.DataHandler.writeTo(DataHandler.java:295)
    at javax.mail.internet.MimeBodyPart.writeTo(MimeBodyPart.java:1248)
    at javax.mail.internet.MimeMessage.writeTo(MimeMessage.java:1673)
    at com.sun.mail.smtp.SMTPTransport.sendMessage(SMTPTransport.java:555)
    ... 6 more
    Cant send mail. IOException while sending message

  • Cant send emails with attachments

    All of a sudden I cant send emails with attachments from my iphone or iPad.
    Has anyone else had similar issues?
    I have deleted and reset the accounts up and also tried different devices all with the same problem.

    Please find the trace below . Also I am able to browse the share but haven't tried writing a test app.
    javax.mail.MessagingException: IOException while sending message
    at com.sun.mail.smtp.SMTPTransport.sendMessage(SMTPTransport.java:595)
    at javax.mail.Transport.send0(Transport.java:169)
    at javax.mail.Transport.send(Transport.java:98)
    at SendEmail.sendMail(SendEmail.java:66)
    at FetchDetails.fetchResultSet(FetchDetails.java:69)
    at FetchDetails.<init>(FetchDetails.java:36)
    at Index.main(Index.java:3)
    Caused by: java.io.FileNotFoundException: \xxx.xxx.xx.xxx\dinesh\dialog.gif (The
    system cannot find the path specified)
    at java.io.FileInputStream.open(Native Method)
    at java.io.FileInputStream.<init>(FileInputStream.java:103)
    at javax.activation.FileDataSource.getInputStream(FileDataSource.java:80
    at javax.activation.DataHandler.writeTo(DataHandler.java:287)
    at javax.mail.internet.MimeBodyPart.writeTo(MimeBodyPart.java:1248)
    at javax.mail.internet.MimeBodyPart.writeTo(MimeBodyPart.java:747)
    at javax.mail.internet.MimeMultipart.writeTo(MimeMultipart.java:361)
    at com.sun.mail.handlers.multipart_mixed.writeTo(multipart_mixed.java:85
    at javax.activation.ObjectDataContentHandler.writeTo(DataHandler.java:83
    9)
    at javax.activation.DataHandler.writeTo(DataHandler.java:295)
    at javax.mail.internet.MimeBodyPart.writeTo(MimeBodyPart.java:1248)
    at javax.mail.internet.MimeMessage.writeTo(MimeMessage.java:1673)
    at com.sun.mail.smtp.SMTPTransport.sendMessage(SMTPTransport.java:555)
    ... 6 more
    Cant send mail. IOException while sending message

  • Is it possible to send emails with attachments fro...

    Hi there,
    I was wondering whether it's possible to send emails with attachments from a Nokia 5230, it's just I would like to be able to send emails with attachments without using a computer especially when I'm out on my journeys.
    Many thanks,
    Tim Auluck
    Solved!
    Go to Solution.

    Hi RocknRollTim,
    Thanks for your reply. Have you already tried sending these files? Though you're not able to create all these files on the phone itself, you should be able to send them in an attachment when they're on your memory card.
    Uploading a .jpg, .tiff, .gif, .doc, .docx .htm, .html .key, .numbers, .pages, .pdf, .ppt, .pptx, .txt, .rtf, .vcf, .xls or .xlsx file shouldn't be a problem when uploading. Just click on 'Other' when adding an attachment, then on 'Other files' and there you will be able to select any file that you have saved on your memory card.   
    Whether you can actually send the email depends on the strength of your internet connection (as I mentioned in my previous post). Also keep in mind that the phone itself as well as the network work with a maximum size file that you can send over 3G (more information about this can be found here), and can therfore also limit you in sending large files.
    In any case, let me know how you get on so that we can assist further where necessary.
    Iris9290 
    If my post has helped you in any way, please accept it as a solution or click on the white star, so that other users will be able to benefit from it too.

  • Can not view (some) emails with attachments

    There has already been some discussion about individuals getting the "This message has not been downloaded from the server" error.
    http://discussions.apple.com/message.jspa?messageID=4983643
    Has anyone found a solution to this problem? I am using GMail and am having problems reading (some) emails with attachments. I can read the first several lines through the preview view, but can not open (some) emails without getting the "This message has not been downloaded from the server" error.
    The problem appears to be completely random. The problem occurs sometimes after I open the email on my computer, and other times it occurs before I open the email on my computer. And sometimes opening the email on my computer does not cause any problem opening the email on my phone.
    I have seen this problem on two different phones now and have re-created the email accounts on both phone several times. But the problems keeps (eventually) appearing--for some, but not all emails.
     PowerBook G4, Macintosh 512K     iPod nano (2nd Gen 8GB), iPhone (8GB)

    So, I think things are actually sending/downloading and it's just taking time and the iphone is defaulting to the error message.
    I don't think that's the case. I have several week-old messages on my iPhone (each under 300k) that still say "The message has not been downloaded from the server."
    I've been connected to wifi for over an hour now, so that's plenty of time to downloaded these few small emails. I can read the "preview" of the message from the Inbox screen, but when I click on the message itself, I get the error.
    And, those messages with the attachments that I was able to open this morning? I can no longer open them now. Very, very frustrating.

  • Email with attachments QPAC: setting "From" using process data doesn't work

    Hi,
    I trying to set the "From" in the Email with attachments QPAC from a process variable, let's call it "mailagent", which is of type xs:string.
    So I use a set value QPAC, which sets the "mailagent" variable to "[email protected]". The workflow then continous with the Email QPAC.
    Which stalls and throws the following exception:
    javax.mail.MessagingException: 501 Syntax error, parameters in command "MAIL FROM:<{$/process_data/@mailagent$}>" unrecognized or missing
    Hrm. I thought, I had already used the Email QPAC this way.
    Is there some kind of magic to apply to the Email with attachments QPAC in order for it to accept process data in the "From"?
    Steve

    Yes, I'm sure, it worked for us to. But it obviously no longer does.
    Yes, "mailagent" definitely is a variable of type string, though it's of type
    xs:string. I'm no longer able to create variables, which don't feature the
    xs namespace. Which is quite confusing as I've got absolutely no idea, what the
    xs is used for.
    We are using LiveCycle Workflow 7.2.1, the Email QPAC is 7.0.2. Is this the latest version?
    Steve

  • I am using a mac mini (10.8.3) with Mac Mail 6.3 (1503).  Whenever I try to forward an email with attachments, the attachments do not make it.  They show being sent, but the attachments never are sent.

    Hey Guys,
    The title says it all.  Whenever I receive an email with attachments, I will try to forward the email to someone with the attachments.  Mac Mail shows that the attachments are attached, but the receiver says the attachments are not there. Our mail host is Rackspace.  We are setup with IMAP.  It should be noted that we are experiencing similar issues with OS 10.5.8 with Mac Mail 3.6 (936).
    We assumed Rackspace was the problem, so we logged into their webmail portal and tested it and the attachments were received as normal, which points everything back to Mac Mail.  We even had an ISP change but the problem do not change.
    I have researched the problem, and there seems to be evidence of this being a known bug with Mac Mail, but I am hoping there is a workaround.  The company is unwilling to move to a different mail client since they use Daylite 4, which does not support Thunderbird.

    Back up all data.
    1. Triple-click the line below to select it:
    ~/Library/Mail/Bundles
    Right-click or control-click the highlighted line and select
    Services ▹ Open
    from the contextual menu. A folder may open, or you may get an error message that the item can't be found. Either result is normal. If the folder does open and has contents, move the contents to the Desktop. Relaunch Mail and test. If there's no change, put the contents of the folder back and quit Mail again.
    2. Repeat with this line:
    /Library/Mail/Bundles
    This time you may be prompted for your login password when you remove the items. Make sure they're removed from the folder and not just copied to the Desktop. If necessary, copy them first and then move the originals to the Trash.

  • Saving email with attachments together

    I am running leopard on an iMac. I am a recent convert to Mac from the PC, and since I get a lot of emails with attachments, I simply want to save the email and attachment as one entity, as I used to do on my PC. It is very important that I be able to easily know which attachments came with which email. Ideally I would like to retrieve a saved email from a folder, open it, and also see the attachments. Currently, when I try to save an email that contains attachments, I go to File and pull down SAVE AS... A box pops up asking me for the location and it also contains a box at the bottom for me to check if I also want to save the attachments. I check the box, but no attachments are saved. I can go under File and pull down to Save Attachments, and it will save them to wherever I want, but I need the email and attachments together as one unit, for later retrieval. SO CAN ANYONE TELL ME WHAT I AM DOING WRONG HERE ??

    Ok, first your attachments in Leopard Mail are saved in homefolder/library/Mail Downloads, so whatever you do, do not delete attachments in that folder.
    Second, if you have an IMAP account, go to mail>preferences>accounts>advanced... and make sure that for "keep copies of messages for offline viewing" the option "all messages and their attachments" is chosen.
    Third, where are you trying to save these emails, outside of Leopard Mail? I would suggest you save them within Leopard Mail, in mailboxes you will have created for that effect - to create a mailbox go to mailbox>new mailbox, choose the location you want to create the mailbox in as in under your IMAP account, or on your mac, and choose a name for your mailbox. Once that mailbox is created, you can move the emails you want to keep by either selecting the email(s), dragging and dropping in the mailbox you want to keep them, or you can right click and move to, or you can go to message>move to...
    hope this helps.

  • Mail; emails with attachments are not shown in Sent folder

    Since upgrading to Yosemite I have had lots of problems with Mail.
    One is that it seems that some emails with attachments do not show in the Sent folder! Some of them can be found further down, On my Mac in a folder called Recreated letters, or something like that in English.
    Anyone have the same problem?
    Nina

    What is your version of TB? Have you changed anything since the last time it worked? Mail servers changes done by your provider are also possible.
    * Does it occur when an e-mail is sent immediately (before a possible auto-save, see below)?
    * Can you copy any mail from any folder to the Sent folder?
    I've heard of the error "saving to Sent" with older versions of TB, but not related to attachments.
    So, for the general saving to Sent error, some people report that this
    https://kb.wisc.edu/wiscmail/page.php?id=3679
    has helped them.
    I've also heard that turning off "Auto save every .. minutes" in TB preferences > Composition > General has helped some in older versions and IMAP.
    You may check this page: <br>http://kb.mozillazine.org/IMAP:_advanced_account_configuration
    PS: You seem to use Firefox 16, an extremely outdated and insecure browser version. Same for Thunderbird? To be on the safe side (bugs, security), IMHO you should really upgrade regularly to the latest versions, of course backing up your profiles first, especially with TB ( http://kb.mozillazine.org/Profile_backup ).

  • Functionality to send email with attachments.(all types ot attachments)

    Hi experts,
    I have an requirement to modify the existing workflow to include the new part/functionality to send the email with attachments.
    I mean, the existing workflow is sending only the notification as of now, the new requirement was i need to add the new functionalaity such a way the email functionality needs to be enabled so that the receiver who is receiving the notification will also get the email as well along with the attachments.
    Note* Attachment could be of any types like pdf,tex,word etc...
    Please suggest will it be possible to achieve this functionalites?
    Any sample code will be a great help for me.
    Thanks in advance,
    Thiru.

    You can send attachments in email notification by defining message attributes of type document. Oracle Workflow supports document types called "PL/SQL" documents, "PL/SQL CLOB" documents, and "PL/SQL BLOB" documents.
    You can go through the below document for defining documents.
    http://www-apps.us.oracle.com/wf/doc/wfr1213/wfdg/html/T361836T362168.htm#2807860

  • Email not in sent box when I send email with attachments in Word.

    Several times, I've noticed that when I send an email with attachments in Word = .doc format, I don't find the emails in my Sent Box…Why?

    Then this sounds like a problem at the receiving end. More information is needed.

  • Fetching email with attachments in Tomcat

    I'm trying to process emails with attachments using following code and it works fine in standalone java application, but when I run this code on Tomcat it treates all messages as not multipart. Class of all contents got from messages is SharedByteArrayInputStream.
    I'm using jdk1.6.0_27 and javamail1_4_5
    I put mail.jar in WEB-INF/lib of my war.
    Can anyone help my how to deal with this? What's wrong?
    package test;
    import java.util.Arrays;
    import java.util.List;
    import java.util.Properties;
    import javax.mail.Folder;
    import javax.mail.Message;
    import javax.mail.MessagingException;
    import javax.mail.Multipart;
    import javax.mail.Session;
    import javax.mail.Store;
    public class Main {
    private static Store store;
    private static Folder folder;
    * @param args
    * @throws Exception
    public static void main(String[] args) throws Exception {
    try {
    List<Message> messages = getMessages("...", "...", "...");
    for (Message mess : messages) {
    System.out.println(mess.getSentDate());
    Object content = mess.getContent();
    if (content instanceof Multipart) {
    System.out.println("miltipart");
    } else {
    System.out.println("plain");
    } finally {
    close();
    public static List<Message> getMessages(String host, String userName, String password) throws Exception {
    if (store != null || folder != null) {
    throw new IllegalStateException("There are open and closed messages exist");
    // create empty properties
    Properties props = new Properties();
    // get session
    Session session = Session.getDefaultInstance(props, null);
    try {
    // get the store
    store = session.getStore("pop3");
    store.connect(host, userName, password);
    // get folder
    folder = store.getFolder("INBOX");
    folder.open(Folder.READ_ONLY);
    // get directory
    return Arrays.asList(folder.getMessages());
    } catch (MessagingException e) {
    throw new Exception("Exception while mail receiving ", e);
    public static void close() throws MessagingException {
    // close connection
    if (folder != null) {
    folder.close(false);
    if (store != null) {
    store.close();
    folder = null;
    store = null;
    }

    But I found another interesting issue.
    When I run my application everything works fine on first iteration. According to my code I get default instance of Session, get Store, get Folder and at last getMessages. After processing messages I close folder and store.
    But if I don't restart my application and try to get messages again all of the SAME messages became plain (SharedByteArrayInputStream) again (as it was earlier).
    If I restart my application first iteration works fine and others fails.
    In both iterations used the same instance of class where I put Thread.currentThread().setContextClassLoader(BaseEmailService.class.getClassLoader());
    What I must reinitialize to make it works on each iteration?

  • I often get emails with attachments that will not open with my mac. Is there any free software to help this

    I often get emails with attachments that will not open with my mac often a small ? will show. How do I open these

    What kind of attachment? Post an example file name.

  • Unable to move email with attachments from local folders to icloud

    I'm in the process of migrating my email to icloud. I've been able to move all emails without attacments from local folders to the cloud but evrytime I try to move emails with attachments I get one of two errors, either the imap server times out or it's unable to establish a secure connection (SSL).
    Anyone else come across this or point me in the right direction.
    And yes - I have been searching Google all afternoon and have not been able to find anything.

    I do not have an answer to your problem but am interested in following this thread because I would like to get off the Mail application and do everything in iCloud.  My problem is I have a ton of messages in Mail folders, on my MacAir. I don't know how to get them to iCloud folders.  At this point I keep the attachments in folders on the HD so I don't need the attachments to come but I do need the message.

  • Mail not receiving emails with attachments

    Hi
    I'd appreciate any suggestions in relation to the following.
    My wife and I both run computers from the one account, Mail on her PowerBook logging in through my name and password. Until recently, we have had no problems at all. However, it has come to light that my wife has not been receiving emails with attachments for some time. To test this, my wife sent an email with an attachment to her home email address from work, and copied it to me. I received the email and the attachment on my PC; my wife's Mac did not receive the email. I then forwarded the email with the attachment to her computer; this was successful. This would suggest some problem with her Mail account on the Mac. However, the configuration has not been changed. Is it possible for it just to stop working for some reason?

    I'm using a PC for my email at the moment. I'm not sure if all my wife's emails have been downloaded. However, Mail has made a Home/Mail/MessageUidsAlreadyDowloaded file. This was created when I sent an email to test what happened. I was unable to make Mail download all her emails, so I guess they must have gone from the server. She has a different email address to mine, but it's run from the same ISP account; as I said, she logs in, automatically, through Mail to her email. I have contacted the ISP about it, but they are unable to see any trace of emails that colleagues have sent my wife and which she sends home to herself. All of these files happen to have attachments, but I cannot see any setting of Mail which would account for them being rejected. Also, I can't be entiurely sure that only emails with attachments don't get through; there may be others, 'unattached'.
    Thanks for your continued assistance.

Maybe you are looking for