Send table with email as excel-attachment

Hi.
I have such a requirement. I have a report that selects data and show it in ALV form.
No I need to execute it as background job and then send emails with selected data as an attached excel file.
Does anybody know the way to convert usual internal table into the internal table that contains the same data in a excel file form, that I could send then with email?
All ways of converting itab to excel use excel file on frontend PC as a destination. Is there any way to avoid downloading to a real file and then uploading back to internal table?
Thanks in advance.

hi,
these steps will help u to achieve your requirement.
step 1 : for getting the selected records only , u can use the below code
                lr_selections = go_alv_table_ref->get_selections( ).
                lr_selection(gs->get_selected_rows( RECEIVING value = gt_rows ).
Step2 : paa the selected records (gt_rows) to the method cl_bcs_convert=>string_to_solix - (give the code page as 4103 -this wll convert to an excel file ) get the file and send as a mail attachment using the method 'add_attachement' from the class 'cl_document_bcs'.
Hope this helps,
Thanks,
Sindhuja

Similar Messages

  • Sending table with email

    Hi,
    Please let me know FM for sending internal table as an email,
    Thanks,

    Hi,
    Well i would advise you to use obect oriented.
    you can send mails by using class CL_BCS.
    check the below link for the same.
    [sned mails using OOPS ABAP|http://wiki.sdn.sap.com/wiki/display/Snippets/SendMailhavingMultipleFilesasAttachmentusingobjectorientedtechnique]

  • File to Mail with content as excel attachment

    Hi there,
    Can somebody please guide me in achieving this goal.
    I have a requirement in which I have to send the email content as an excel attachment which is very new to me.
    Requirement
    File.............XI............Mail
    Sender File: xyz.xml
    Mapped with standard mail.xsd and concat all the requested filed to the content but now the requirement is changed and I need to send the content as an excel attachment.
    I don't know JAVA & ABAP and this is the first time I am using mail adapter.
    Can somebody please guide me how to achieve this.
    In Another interface I have to send the source file name as a mail attachment, By Default mail adapter send the filename as untitled.
    Is there easy way to changed the name of the attachment to the source file name.
    File ............... XI.........Mail.
    Source file: xyz.xml
    No mapping required just send the file to the mail adapter but condition is that the file name should be the same.
    Mail (Attachment: xyz.xml)
    Please can somebody suggest me how to achieve this.
    Thanks,

    Hi,
    Please refer the blogs given which help you a lot regarding your requirement.
    /people/community.user/blog/2006/09/08/email-report-as-attachment-excelword
    /people/michal.krawczyk2/blog/2005/12/10/xi-generating-excel-files-without-the-java-nor-the-conversion-agent-not-possible
    /people/sap.user72/blog/2005/07/04/read-excel-instead-of-xml-through-fileadapter
    /people/prasad.ulagappan2/blog/2005/06/07/mail-adapter-scenarios-150-sap-exchange-infrastructure
    /people/sravya.talanki2/blog/2006/01/12/xi-triggering-e-mails-with-multiple-attachments--problems

  • Sending attachments with emails in Javamail

    I'm trying to send attachments with emails using Javamail. Following is the code through which I'm trying to achieve that. It works as expected on a JRE1.6 environment. But on JRE1.5, the content of the file gets added to the mail body as text.I want the file to be sent as an attachment.
    Any pointers on the observed difference in behavior would be highly appreciated!
    String msgText = mailInfo.getMessage();
            String attachmentFileName = mailInfo.getFileName();
            MimeBodyPart mimeBodyPart = new MimeBodyPart();
            mimeBodyPart.setText(msgText);
            // create the second message part
            MimeBodyPart attachmentBodyPart = new MimeBodyPart();
            // attach the file to the message
            FileDataSource fileDataSource = new FileDataSource(attachmentFileName);
            attachmentBodyPart.setFileName(fileDataSource.getName());
            attachmentBodyPart.setDataHandler(new DataHandler(fileDataSource));
            // create the Multipart and add its parts to it
            Multipart multipart = new MimeMultipart();
            multipart.addBodyPart(mimeBodyPart);
            multipart.addBodyPart(attachmentBodyPart);
            message.setContent(multipart);The email in case of JRE1.5 is as follows
    {color:#0000ff}------=_Part_0_33189144.1233078680250
    Content-Type: text/plain; charset=us-ascii
    Content-Transfer-Encoding: 7bit
    Hi...Test Mail
    ------=_Part_0_33189144.1233078680250
    Content-Type: application/octet-stream; name=corba_architecture.pdf
    Content-Transfer-Encoding: base64
    Content-Disposition: attachment; filename=corba_architecture.pdf
    Content-ID: Attachment
    JVBERi0xLjIgDSXi48/TDQogDTggMCBvYmoNPDwNL0xlbmd0aCA5IDAgUg0vRmlsdGVyIC9GbGF0
    ZURlY29kZSANPj4Nc3RyZWFtDQpIiUWPW07DMBBFV+A93E9QlWBP/Kj5awt8USFRbyBKnTQIkshK
    YfvYcQoaybrSzDkzFhCxQgemeWkUyKTXEIeSHMGjZXvHSFBJCpXUpQLcE+NIlbCHFw4pUxeuZQUv
    ueY25gYxk9mKmH9wtwvNpZ99M1+jc2wxXzxweHvf73AP9xGFhaIsTyC3/w6ZDYfxaxoHP8w4jmf/
    ------=_Part_0_33189144.1233078680250-- {color}

    Following is the debug trace obtained on running the program on 1.5.
    +12:45:57,218 INFO [MailerThread] EmailManager:306 - Sending message {toAddress [email protected],+
    +replyTo =null,+
    +cc =null,+
    +message =Hi...Test Mail,+
    +subject =test mail,+
    +contentType =null fileName =C:\docs\cbe\dist computing\A.txt }+
    Loading javamail.default.providers from jar:file:/C:/docs/cbe/lib/mail-1.4.jar!/META-INF/javamail.default.providers
    DEBUG: loading new provider protocol=imap, className=com.sun.mail.imap.IMAPStore, vendor=Sun Microsystems, Inc, version=null
    DEBUG: loading new provider protocol=imaps, className=com.sun.mail.imap.IMAPSSLStore, vendor=Sun Microsystems, Inc, version=null
    DEBUG: loading new provider protocol=smtp, className=com.sun.mail.smtp.SMTPTransport, vendor=Sun Microsystems, Inc, version=null
    DEBUG: loading new provider protocol=smtps, className=com.sun.mail.smtp.SMTPSSLTransport, vendor=Sun Microsystems, Inc, version=null
    DEBUG: loading new provider protocol=pop3, className=com.sun.mail.pop3.POP3Store, vendor=Sun Microsystems, Inc, version=null
    DEBUG: loading new provider protocol=pop3s, className=com.sun.mail.pop3.POP3SSLStore, vendor=Sun Microsystems, Inc, version=null
    DEBUG: getProvider() returning provider protocol=smtp; type=javax.mail.Provider$Type@77eaf8; class=com.sun.mail.smtp.SMTPTransport; vendor=Sun Microsystems, Inc
    DEBUG SMTP: useEhlo true, useAuth false
    DEBUG SMTP: trying to connect to host "10.16.68.131", port 25, isSSL false
    +220 mailhost5.vmware.com ESMTP Postfix (mailhost5)+
    DEBUG SMTP: connected to host "10.16.68.131", port: 25
    EHLO sbanerjee
    +250-mailhost5.vmware.com+
    +250-PIPELINING+
    +250-SIZE 26800000+
    +250-VRFY+
    +250-ETRN+
    +250-ENHANCEDSTATUSCODES+
    +250-8BITMIME+
    +250 DSN+
    DEBUG SMTP: Found extension "PIPELINING", arg ""
    DEBUG SMTP: Found extension "SIZE", arg "26800000"
    DEBUG SMTP: Found extension "VRFY", arg ""
    DEBUG SMTP: Found extension "ETRN", arg ""
    DEBUG SMTP: Found extension "ENHANCEDSTATUSCODES", arg ""
    DEBUG SMTP: Found extension "8BITMIME", arg ""
    DEBUG SMTP: Found extension "DSN", arg ""
    DEBUG SMTP: use8bit false
    MAIL FROM:<[email protected]>
    +250 2.1.0 Ok+
    RCPT TO:<[email protected]>
    +250 2.1.5 Ok+
    DEBUG SMTP: Verified Addresses
    DEBUG SMTP:   [email protected]
    DATA
    +354 End data with <CR><LF>.<CR><LF>+
    ------=_Part_0_3278348.1233126957281
    Content-Type: text/plain; charset=us-ascii
    Content-Transfer-Encoding: 7bit
    Hi...Test Mail
    ------=_Part_0_3278348.1233126957281
    Content-Type: text/plain; charset=us-ascii; name=A.txt
    Content-Transfer-Encoding: 7bit
    Content-Disposition: attachment; filename=A.txt
    Content-ID: Attachment
    adasdasdd
    ------=_Part_0_3278348.1233126957281--
    +.+
    +250 2.0.0 Ok: queued as 5BE5BDC100+
    +12:45:59,125 INFO [MailerThread] EmailManager:331 - Message {toAddress [email protected],+
    +replyTo =null,+
    +cc =null,+
    +message =Hi...Test Mail,+
    +subject =test mail,+
    +contentType =null fileName =C:\docs\cbe\dist computing\A.txt } sent to the SMTP server successfully+

  • Email XLS excel attachment from ABAP

    Hi,
    I am trying to email an excel attachment from ABAP, but when I open in excel, it says not a recognizable format, but when I click OK it does open as a tab-delimited file and look OK.
    Any ideas please?

    Hi,
    Please check this link
    http://www.sapdevelopment.co.uk/reporting/email/attach_xls.htm
    aRs

  • Problem with Emailing the Internal table data as an excel attachment

    Hi Friends,
    I am facing problem with Emailing an internal table data as an excel file. I am using standard function module "SO_NEW_DOCUMENT_ATT_SEND_API1" which is using SOLI structure can have record with 255 character length. But my Internal table having each record means after concatenating all the fields it is going to be morethan 450 characters. so i t is not displaying all the data in excel file.
    Can somebody help me if there is any other function module or any other way that i need to follow.
    thanks for help
    venkat.

    You must use the the :
    CL_ABAP_CHAR_UTILITIES=>HORIZONTAL_TAB as a field seperator and
    CL_ABAP_CHAR_UTILITIES=>CR_LF as a record seperator.
    Check this example:
    http://www.sapdevelopment.co.uk/reporting/email/attach_xls.htm
    Regards,
    Naimesh Patel

  • Problem sending .pdf with email in ECC 6.0

    hi there,
    we are upgrading from r/3 4.6.c to ECC 6.0.
    i have the following problem: in many z-ababs we convert spool-files to pdf-files and send them with function SO_NEW_DOCUMENT_ATT_SEND_API1 via email.
    well, this is working okay, BUT: the ending '.pdf' is missing in the filename:
    in R/3 4.6.c it looks like the following:
    zfl_reporting.pdf
    Now it looks like this:
    zfl_reporting
    So the file is not recognized as pdf-file. You have to add a .pdf manually to open it.
    We can't do this as we send the pdf-files thousands of times to our customers.
    Any ideas ?
    reg, Martin

    hi
    Posted below is the sample code..
    find the bolded ones...
    REPORT ZMAIL_PDF NO STANDARD PAGE HEADING.
    Data for mailing purpose
    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.
    Spool table
    TABLES : TSP01.
    Data required for creating spool
    DATA: MSTR_PRINT_PARMS LIKE PRI_PARAMS VALUE 'LP01',
          MC_VALID(1),
          MI_BYTECOUNT TYPE I,
          MI_LENGTH    TYPE I,
          MI_RQIDENT   LIKE TSP01-RQIDENT,
          REP          LIKE PRI_PARAMS-PLIST.
    Internal table for capturing data into PDF format
    DATA: MTAB_PDF LIKE TLINE OCCURS 0 WITH HEADER LINE.
    File name
    DATA : MC_FILENAME LIKE RLGRAP-FILENAME.
    SELECTION SCREEN
    PARAMETERS : P_REPID LIKE SY-REPID,
                 P_LINSZ LIKE SY-LINSZ DEFAULT 132,
                 P_PAART LIKE SY-PAART DEFAULT 'X_65_132'.
    START-OF-SELECTION.
    <b>  CONCATENATE 'C:\'
                   P_REPID
                  '.PDF'
             INTO  MC_FILENAME.</b>
      MOVE SY-REPID TO REP.
    Get print parameters
      PERFORM GET_PRINT_PARAMS.
    Send output of the required program to Spool
      SUBMIT (P_REPID) TO SAP-SPOOL WITHOUT SPOOL DYNPRO
                          SPOOL PARAMETERS MSTR_PRINT_PARMS
                          VIA SELECTION-SCREEN AND RETURN.
    Get the the spool number that is just created
      PERFORM GET_SPOOL_NUMBER USING    SY-REPID SY-UNAME
                               CHANGING MI_RQIDENT.
    Convert Spool to PDF & download the same
      PERFORM SPOOL_2_PDF.
    Upload downloaded PDF file for mailing
      PERFORM UPLOAD_PDF_FILE.
    Send mail with PDF attachment
      PERFORM SEND_MAIL.
          FORM get_spool_number *
          Get the most recent spool created by user/report              *
    form get_spool_number using    f_repid
                                   f_uname
                          changing f_rqident.
      data:
        lc_rq2name like tsp01-rq2name.
      concatenate f_repid
                  f_uname
             into lc_rq2name separated by '_'.
      select * from tsp01 where  rq2name = sy-repid
        order by rqcretime descending.
        f_rqident = tsp01-rqident.
        exit.
      endselect.
      if sy-subrc ne 0.
        clear f_rqident.
      endif.
    endform." get_spool_number
    *&      Form  send_mail
          text
    -->  p1        text
    <--  p2        text
    form send_mail.
    Creation of the document to be sent
      DOC_CHNG-OBJ_NAME = 'TEST'.
      DOC_CHNG-OBJ_DESCR = 'TEST MAIL WITH PDF ATTACHMENT'. "mail subject
      OBJTXT = 'Test mail with PDF attachment'.
      APPEND OBJTXT.
      CLEAR OBJTXT.
      APPEND OBJTXT.
      APPEND OBJTXT.
      OBJTXT = 'Please double click the attachment to verify'.
      APPEND OBJTXT.
      DESCRIBE TABLE OBJTXT LINES TAB_LINES.
      READ TABLE OBJTXT INDEX TAB_LINES.
      DOC_CHNG-DOC_SIZE = ( TAB_LINES - 1 ) * 255 + STRLEN( OBJTXT ).
    Creation of the entry for the compressed document
      CLEAR OBJPACK-TRANSF_BIN.
      OBJPACK-HEAD_START = 1.
      OBJPACK-HEAD_NUM   = 0.
      OBJPACK-BODY_START = 1.
      OBJPACK-BODY_NUM   = TAB_LINES.
      OBJPACK-DOC_TYPE   = 'RAW'.
      APPEND OBJPACK.
      DESCRIBE TABLE OBJBIN LINES TAB_LINES.
      OBJHEAD = 'Sample PDF attachement'. "
      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.
    <b>  OBJPACK-DOC_TYPE   = 'PDF'.</b>
      OBJPACK-OBJ_NAME   = 'TEST'.
      OBJPACK-OBJ_DESCR  = 'Test.PDF'.
      OBJPACK-DOC_SIZE   = TAB_LINES * 255.
      APPEND OBJPACK.
    Completing the recipient list
    For sending mail to Internet Address
      RECLIST-RECEIVER = '[email protected].
      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'
                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  :/ 'MAIL SENT....'.
            WHEN 1.
              WRITE  :/ 'TOO MANY RECEIVERS'.
            WHEN 2.
              WRITE  :/ 'DOCUMENT NOT SENT'.
            WHEN 4.
              WRITE  :/ 'NO SEND AUTHORIZATION'.
            WHEN OTHERS.
              WRITE  :/ 'ERROR OCCURED WHILE SENDING MAIL'.
          ENDCASE.
    endform.                    " send_mail
    *&      Form  GET_PRINT_PARAMS
    FORM GET_PRINT_PARAMS.
      call function 'GET_PRINT_PARAMETERS'
      exporting destination           = 'LP01'
                copies                = 1
                list_name             = rep
                list_text             = 'LIST ..... TO SAP-SPOOL'
                immediately           = 'X'
                release               = 'X'
                new_list_id           = 'X'
                expiration            = 1
                line_size             = 132
                line_count            = 65
                layout                = 'X_PAPER'
                sap_cover_page        = 'X'
                cover_page            = 'X'
                receiver              = sy-uname
                department            = 'System'
                no_dialog             = 'X'
      importing out_parameters        =  mstr_print_parms
                valid                 = mc_valid.
    ENDFORM.                    " GET_PRINT_PARAMS
    *&      Form  SPOOL_2_PDF
    FORM SPOOL_2_PDF.
        call function 'CONVERT_ABAPSPOOLJOB_2_PDF'
        exporting
          src_spoolid      = mi_rqident
          no_dialog        = space
          dst_device       = mstr_print_parms-pdest
        importing
          pdf_bytecount    = mi_bytecount
        tables
          pdf              = mtab_pdf
        exceptions
          err_no_abap_spooljob           = 1
          err_no_spooljob                = 2
          err_no_permission              = 3
          err_conv_not_possible          = 4
          err_bad_destdevice             = 5
          user_cancelled                 = 6
          err_spoolerror                 = 7
          err_temseerror                 = 8
          err_btcjob_open_failed         = 9
          err_btcjob_submit_failed       = 10
          err_btcjob_close_failed        = 11
          others     = 12.
         call function 'WS_DOWNLOAD'
           exporting
             bin_filesize                  =  mi_bytecount
    <b>        filename                      =  mc_filename</b>
             filetype                      = 'BIN'
           tables
             data_tab                      =  mtab_pdf
    if sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    endif.
    ENDFORM.                    " SPOOL_2_PDF
    *&      Form  UPLOAD_PDF_FILE
    FORM UPLOAD_PDF_FILE.
      call function 'WS_UPLOAD'
        exporting
    <b>      filename                      = mc_filename</b>
          filetype                      = 'BIN'
        tables
          data_tab                      = OBJBIN
    if sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    endif.
    ENDFORM.                    " UPLOAD_PDF_FILE
    **reward if helpful
    regards,
    madhumitha

  • Sending smartform through email as PDF attachment

    Hi,
    I want to send a smartform through email as pdf attachment.In the code I have hardcoded the receiver mail id.But I don't want this to be sent only to a particular receiver.I want this to be sent as many people as I can without hardcoding their mail id's in the program.How can I do that?
    Regards,
    Hema

    **Data Declarations
    **Internal Table
    DATA : BEGIN OF it_spfli OCCURS 0,
              carrid LIKE spfli-carrid,
              connid LIKE spfli-connid,
           END OF it_spfli.
    DATA:   it_packing_list LIKE sopcklsti1 OCCURS 0 WITH HEADER LINE,
            it_contents     LIKE solisti1 OCCURS 0 WITH HEADER LINE,
    storing receivers      
            it_receivers    LIKE somlreci1 OCCURS 0 WITH HEADER LINE,
    **storing file attachment data
            it_attachment   LIKE solisti1 OCCURS 0 WITH HEADER LINE,                    gd_doc_data     LIKE sodocchgi1,
            gd_error        TYPE sy-subrc,
            l_gntxt         LIKE t357g_t-gntxt,
            lv_message(100) TYPE c.
    DATA:   it_message TYPE STANDARD TABLE OF solisti1 INITIAL SIZE 0
                    WITH HEADER LINE. "storing mail body
    DATA : psubject(30) TYPE c VALUE 'Sample Mail'. "subject of the mail
    DATA : ld_format TYPE so_obj_tp , "file format
           ld_attfilename TYPE so_obj_des, "file name
           w_cnt TYPE i.
    **Selecting the data
    SELECT carrid connid INTO TABLE it_spfli FROM spfli WHERE carrid EQ 'AA'.
    **Perform for populating mail body
    PERFORM populate_message.
    **Perform for populating file attachment
    PERFORM populate_attachment.
    **Perform for populating mail characteristic info
    PERFORM populate_pack.
    **Perform for populating receivers
    PERFORM populate_receivers.
    **Perform to send mail
    PERFORM send_mail.
    *&      Form  populate_message
          text
    -->  p1        text
    <--  p2        text
    FORM populate_message .
    **Populating the body
      lv_message = 'Sample mail for testing purpose.'.
      APPEND lv_message TO it_message.
    ENDFORM.                    " populate_message
    *&      Form  populate_attachment
          text
    -->  p1        text
    <--  p2        text
    FORM populate_attachment .
    **Populating the attachment file with the data from final intenal table
      CONCATENATE 'CARRIER ID'
                  'CONNECTION ID'
                  INTO it_attachment SEPARATED BY
                  cl_abap_char_utilities=>horizontal_tab.
      CONCATENATE cl_abap_char_utilities=>cr_lf it_attachment INTO
      it_attachment.
      APPEND it_attachment.
      LOOP AT it_spfli.
        CONCATENATE it_spfli-carrid it_spfli-connid INTO it_attachment SEPARATED BY
                 cl_abap_char_utilities=>horizontal_tab.
        CONCATENATE cl_abap_char_utilities=>cr_lf it_attachment INTO
        it_attachment.
        APPEND it_attachment.
      ENDLOOP.
    ENDFORM.                    " populate_attachment
    *&      Form  populate_receivers
          text
    -->  p1        text
    <--  p2        text
    FORM populate_receivers .
    **Populating Mail Recepients
    **If there are more than one mail recepient then loop and append them to it_receivers
      it_receivers-receiver = '[email protected]'.
      it_receivers-rec_type = 'U'.
      it_receivers-com_type = 'INT'.
      it_receivers-notif_del = 'X'.
      it_receivers-notif_ndel = 'X'.
      it_receivers-express = 'X'.
      APPEND it_receivers.
    ENDFORM.                    " populate_receivers
    *&      Form  populate_pack
          text
    -->  p1        text
    <--  p2        text
    FORM populate_pack .
    **File Type
      ld_format = 'XLS'.
    **File Name
      ld_attfilename = 'File1'.
    Fill the document data.
      gd_doc_data-doc_size = 1.
    Populate the subject/generic message attributes
      gd_doc_data-obj_langu = sy-langu.
      gd_doc_data-obj_name = 'SAPRPT'.
      gd_doc_data-obj_descr = psubject .
      gd_doc_data-sensitivty = 'F'.
    Fill the document data and get size of attachment
      CLEAR gd_doc_data.
    Populate the subject/generic message attributes
      gd_doc_data-obj_langu = sy-langu.
      READ TABLE it_attachment INDEX w_cnt.
      gd_doc_data-doc_size = ( w_cnt - 1 ) * 255 + STRLEN( it_attachment ).
      gd_doc_data-obj_name  = 'SAPRPT'.
      gd_doc_data-obj_descr = psubject.
      gd_doc_data-sensitivty = 'F'.
    Describe the body of the message
      CLEAR it_packing_list.
      REFRESH it_packing_list.
      it_packing_list-transf_bin = space.
      it_packing_list-head_start = 1.
      it_packing_list-head_num = 0.
      it_packing_list-body_start = 1.
      DESCRIBE TABLE it_message LINES it_packing_list-body_num.
      it_packing_list-doc_type = 'RAW'.
      APPEND it_packing_list.
    **Describe the attachment info
      it_packing_list-transf_bin = 'X'.
      it_packing_list-head_start = 1.
      it_packing_list-head_num = 1.
      it_packing_list-body_start = 1.
      DESCRIBE TABLE it_attachment LINES  it_packing_list-body_num.
      it_packing_list-doc_type = ld_format.
      it_packing_list-obj_name = ld_attfilename.
      it_packing_list-obj_descr = ld_attfilename.
      it_packing_list-doc_size = it_packing_list-body_num * 255.
      APPEND it_packing_list.
    ENDFORM.                    " populate_pack
    *&      Form  send_mail
          text
    -->  p1        text
    <--  p2        text
    FORM send_mail .
    **Function Module to send mail
      CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
        EXPORTING
          document_data              = gd_doc_data
          put_in_outbox              = 'X'
          commit_work                = 'X'
        TABLES
          packing_list               = it_packing_list
          contents_bin               = it_attachment
          contents_txt               = it_message
          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.
    ENDFORM.                    " send_mail

  • Can not send attachments with emails on Me and aol Imap??

    I have an aol and MobileMe imap accounts set up with my mac mail, but I can not send any email with attachemnts no matter how small the smallest I have tried is 152Kb. I have been reeding the threads about not being able to send any email, but I can send and recive emails(with attachments) just not send with attachments.I have been able to send attachments with my aol Imap account before.
    I have recently signed up to Mobile me and created the Me Imap account, this is the first time I have had to send an attachment. Is it something to do with the Mobile me?? Any help much appreciated
    still relitivly new to Mac....

    Hi Kursten, and a warm welcome to the forums!
    Have you tried Port 587 instead of 25 for the .me account anyway?
    Mail>Preferences>Accounts>Outgoing SMTP>Server Settings...

  • ALV output to be send to an email in Excel format

    Hi All,
    Now I am sending alv output to email through excel format successfully but my problem is in last coloumn output some times last charectors are missing. Please help me out.
    For example out put is 'Not Approved'. Some times it is displaying correct and some times it is displaying only 'Not'.
    Thanks and Regards,
    Siva.

    hi,
    check this thread for  reference:
    Sending ALV by mail

  • TS3899 How do I send a "spam" email as an attachment to iCloud using my iPad or iPhone

    ICloud directs you to send spam email as an attachment in an email to [email protected] I have no problem doing that on my MacBook Pro but cannot find "message=>forward As Attachment" from the menu bar on my iPhone or iPad. Can anyone direct me?

    That only forwards the email exactly as you see it in letter form. icloud wants it sent as an attachment to an email.  Thanks for answering me.

  • Why can I not send attachments with emails?

    Since updating to Maverick have been unable to send attachments to emails. WHY?

    Launch the Console application in any of the following ways:
    ☞ Enter the first few letters of its name into a Spotlight search. Select it in the results (it should be at the top.)
    ☞ In the Finder, select Go ▹ Utilities from the menu bar, or press the key combination shift-command-U. The application is in the folder that opens.
    ☞ Open LaunchPad. Click Utilities, then Console in the icon grid.
    Make sure the title of the Console window is All Messages. If it isn't, select All Messages from the SYSTEM LOG QUERIES menu on the left. If you don't see that menu, select
    View ▹ Show Log List
    from the menu bar.
    Click the Clear Display icon in the toolbar. Then try the action that you're having trouble with again. Select any messages that appear in the Console window. Copy them to the Clipboard by pressing the key combination command-C. Paste into a reply to this message (command-V).
    When posting a log extract, be selective. In most cases, a few dozen lines are more than enough.
    Please do not indiscriminately dump thousands of lines from the log into this discussion.
    Important: Some private information, such as your name, may appear in the log. Anonymize before posting.

  • Send email with spool in excel attachment

    Hi,
    I have this function:
    CALL FUNCTION 'Z_SEND_EMAIL_SPOOL_PDF'
           EXPORTING
                application = 'EMAIL'
                emailtitle  = texttitle
                recextnam   = email
                src_spoolid = tsp01-rqident
           TABLES
                texttab     = body.
    And code:
    FUNCTION z_send_email_spool_pdf .
    *"*"Interfase local
    *"  IMPORTING
    *"     REFERENCE(APPLICATION) LIKE  SOOD1-OBJNAM DEFAULT 'EMAIL'
    *"     REFERENCE(EMAILTITLE) LIKE  SOOD1-OBJDES
    *"     VALUE(RECEXTNAM) LIKE  SOOS1-RECEXTNAM
    *"     REFERENCE(SRC_SPOOLID) LIKE  TSP01-RQIDENT
    *"  TABLES
    *"      TEXTTAB STRUCTURE  SOLI
    *- local data declaration
      DATA: ohd    LIKE sood1,
            oid    LIKE soodk,
            to_all LIKE sonv-flag,
            okey   LIKE swotobjid-objkey.
      DATA: g_document     LIKE sood4,
            g_header_data  LIKE sood2,
            g_authority LIKE sofa-usracc,
            lt_attachments LIKE STANDARD TABLE OF sood5 WITH HEADER LINE,
            l_folder_id    LIKE sofdk,
            l_objcont     LIKE soli OCCURS 0 WITH HEADER LINE,
            i_bin LIKE solisti1 OCCURS 0 WITH HEADER LINE,
            l_objhead     LIKE soli OCCURS 0 WITH HEADER LINE,
            folder_id      LIKE soodk,
            object_id      LIKE soodk,
            link_folder_id LIKE soodk,
            hd_dat  LIKE sood1.
      DATA: desired_type  LIKE sood-objtp,
            real_type LIKE sood-objtp,
            attach_type LIKE sood-objtp,
            otf LIKE sood-objtp VALUE 'OTF', " SAPscript Ausgabeformat
            ali LIKE sood-objtp VALUE 'ALI', " ABAP lists
            pdf LIKE sood-objtp VALUE 'PDF', "PDF format
            pbyte TYPE i,
            t_pdf LIKE tline OCCURS 0 WITH HEADER LINE,
            objtype LIKE rststype-type,
            type    LIKE rststype-type.
      CONSTANTS: ou_fol LIKE sofh-folrg              VALUE 'O',
                 c_objtp    LIKE g_document-objtp    VALUE 'RAW',
                 c_file_ext LIKE g_document-file_ext VALUE 'PDF'.
      DATA: BEGIN OF receivers OCCURS 0.
              INCLUDE STRUCTURE soos1.
      DATA: END OF receivers.
    * Fist part: Verify if the spool really exists
      SELECT SINGLE * FROM tsp01 WHERE rqident = src_spoolid.
      CHECK sy-subrc = 0.
    *- fill odh
      CLEAR ohd.
      ohd-objla    = sy-langu.
      ohd-objnam   = application.
      ohd-objdes   = emailtitle.
      ohd-objpri   = 3.
      ohd-objsns   = 'F'.
      ohd-ownnam   = sy-uname.
    *- send Email
      CONDENSE recextnam NO-GAPS.
      CHECK recextnam <> space AND recextnam CS '@'.
      CALL FUNCTION 'RSTS_GET_ATTRIBUTES'
           EXPORTING
                authority     = 'SP01'
                client        = tsp01-rqclient
                name          = tsp01-rqo1name
                part          = 1
           IMPORTING
                type          = type
                objtype       = objtype
           EXCEPTIONS
                fb_error      = 1
                fb_rsts_other = 2
                no_object     = 3
                no_permission = 4
                OTHERS        = 5.
      attach_type = c_objtp.
      desired_type = pdf.
      IF objtype(3) = 'OTF'.
        CALL FUNCTION 'CONVERT_OTFSPOOLJOB_2_PDF'
             EXPORTING
                  src_spoolid   = src_spoolid
             IMPORTING
                  pdf_bytecount = pbyte
             TABLES
                  pdf           = t_pdf.
      ELSE.
        CALL FUNCTION 'CONVERT_ABAPSPOOLJOB_2_PDF'
             EXPORTING
                  src_spoolid   = src_spoolid
             IMPORTING
                  pdf_bytecount = pbyte
             TABLES
                  pdf           = t_pdf.
      ENDIF.
      PERFORM convertir_tabla_pdf_2 TABLES t_pdf l_objcont.
      CALL FUNCTION 'SO_FOLDER_ROOT_ID_GET'
           EXPORTING
                owner     = sy-uname
                region    = ou_fol
           IMPORTING
                folder_id = l_folder_id
           EXCEPTIONS
                OTHERS    = 5.
    * fill out informations about the header of the email
      CLEAR: g_document.
      g_document-foltp     = l_folder_id-foltp.
      g_document-folyr     = l_folder_id-folyr.
      g_document-folno     = l_folder_id-folno.
      g_document-objtp     = c_objtp.
      g_document-objdes    = emailtitle.
      g_document-file_ext  = c_file_ext.
      g_header_data-objdes    = emailtitle.
      CALL FUNCTION 'SO_DOCUMENT_REPOSITORY_MANAGER'
           EXPORTING
                method      = 'SAVE'
                office_user = sy-uname
           IMPORTING
                authority   = g_authority
           TABLES
                objcont     = texttab
                attachments = lt_attachments
           CHANGING
                document    = g_document
                header_data = g_header_data
           EXCEPTIONS
                OTHERS      = 1.
      object_id-objtp = c_objtp.
      object_id-objyr = g_document-objyr.
      object_id-objno = g_document-objno.
      folder_id-objtp = l_folder_id-foltp.
      folder_id-objyr = l_folder_id-folyr.
      folder_id-objno = l_folder_id-folno.
      link_folder_id-objtp = l_folder_id-foltp.
      link_folder_id-objyr = l_folder_id-folyr.
      link_folder_id-objno = l_folder_id-folno.
      hd_dat-file_ext = pdf.
      hd_dat-objdes = emailtitle.
      CALL FUNCTION 'SO_ATTACHMENT_INSERT'
           EXPORTING
                object_id                  = object_id
                attach_type                = attach_type
                object_hd_change           = hd_dat
                owner                      = sy-uname
           TABLES
                objcont                    = l_objcont
                objhead                    = l_objhead
           EXCEPTIONS
                active_user_not_exist      = 35
                communication_failure      = 71
                object_type_not_exist      = 17
                operation_no_authorization = 21
                owner_not_exist            = 22
                parameter_error            = 23
                substitute_not_active      = 31
                substitute_not_defined     = 32
                system_failure             = 72
                x_error                    = 1000.
    *       FORM SO_OBJECT_SEND_REC                                       *
    FORM  so_object_send_rec
          TABLES  objcont      STRUCTURE soli
                  receivers    STRUCTURE soos1
          USING   object_hd    STRUCTURE sood1
                  folder_id
                  object_id
                  link_folder_id.
      DATA:   oid     LIKE soodk,
              to_all  LIKE sonv-flag,
              okey    LIKE swotobjid-objkey.
      CALL FUNCTION 'SO_OBJECT_SEND'
           EXPORTING
                extern_address             = 'X'
    *            object_hd_change           = object_hd
    *            object_type                = 'RAW'
                outbox_flag                = 'X'
                sender                     = sy-uname
                owner                      = sy-uname
                folder_id                  = folder_id
                object_id                  = object_id
                store_flag                 = 'X'
                link_folder_id             = link_folder_id
           IMPORTING
                object_id_new              = oid
                sent_to_all                = to_all
                office_object_key          = okey
           TABLES
                objcont                    = objcont
                receivers                  = receivers
           EXCEPTIONS
                active_user_not_exist      = 1
                communication_failure      = 2
                component_not_available    = 3
                folder_not_exist           = 4
                folder_no_authorization    = 5
                forwarder_not_exist        = 6
                note_not_exist             = 7
                object_not_exist           = 8
                object_not_sent            = 9
                object_no_authorization    = 10
                object_type_not_exist      = 11
                operation_no_authorization = 12
                owner_not_exist            = 13
                parameter_error            = 14
                substitute_not_active      = 15
                substitute_not_defined     = 16
                system_failure             = 17
                too_much_receivers         = 18
                user_not_exist             = 19
                x_error                    = 20
                OTHERS                     = 21.
      IF sy-subrc <> 0.
        RAISE others.
      ENDIF.
    ENDFORM.
    *       FORM INIT_REC                                                 *
    FORM init_rec TABLES receivers STRUCTURE soos1.
      CLEAR receivers.
      REFRESH receivers.
      MOVE sy-datum  TO receivers-rcdat .
      MOVE sy-uzeit  TO receivers-rctim.
      MOVE '1'       TO receivers-sndpri.
      MOVE 'X'       TO receivers-sndex.
      MOVE 'U-'      TO receivers-recnam.
      MOVE 'U'       TO receivers-recesc.
      MOVE 'INT'     TO receivers-sndart.
      MOVE '5'       TO receivers-sortclass.
      APPEND receivers.
    ENDFORM.
    With this function I can send a spool in pdf format by email. But, now I need send a spool in Excel (xls) format by email. I try to disconnect 'CONVERT_OTFSPOOLJOB_2_PDF' and 'CONVERT_ABAPSPOOLJOB_2_PDF' but doesnt work.
    Can you help me?
    A lot of thanks in advance.
    Best regards.

    Hi.
    I do not think it is feasible to create a worthwhile Excel file from a SAP spool file.
    I have reports that send output as Excel attachments to email, but the code (including function modules etc) is too much to post here.
    You can use OLE to create an Excel file, but this will not generally work when the report is run in the background.
    So my approach is to make the report write an Excel XML file (that's just text after all), and send that as an XLS email attachment.  When the email receiver double-clicks on the attachment, it fires up Excel and brings in the data.  Most users would not realise that it's not a native Excel file.
    One nice touch is to have two sheets in the Excel file, one with the main report and the other with the selection criteria.
    Of course there is a lot of work getting started with this.
    John

  • Sending attachments with email from iPad

    Can I send attachments, such as a pages file, when I send an email from my iPad?
    Thanks for your help

    If you want to send photos, you can do it two ways:
    1. From Photos, tap the rectangle with the curved arrow, then tap the photos you want to send, then tap the Share button to create a new mail message.
    2. From an already created mail message, do a copy-paste from Photos to include photos in the mail message.
    Other apps are a little different. You can always copy-paste but that may get cumbersome.

  • Send dashboard with email notification

    Hi,
    Is it possible to send email notification along with dashboard in OEM 12c.Please assist me on this.
    thanks,
    sagar

    Hi,
    have you checked this link :http://docs.oracle.com/cd/E24628_01/doc.121/e24473/notification.htm

Maybe you are looking for