Send an e-mail with attachment 10g

Hello guys,
I have a form with a single button and I want to send an e-mail with a file attachment by pressing that button. I managed to send the e-mail without the attachment using utl_smtp. I am using forms 10g and I know there is also utl_mail but could not find any code.
Can anyone send me a code example that sends an e-mail with a file attachment ?
Thank you

Check out this link. It has a sample form which shows how to send the email using SMTP and UTL MAIL.
http://www.alexyscorp.com/products.htm
It has also a sample on how to send to report as an attachment.
Let me see if I get time I will modify it to send an attachment.
Rajesh

Similar Messages

  • Sending an E-mail with attachment with PHP from Flex

    Hey,
    I've made a custom compontent wich mails your own drawings to you. But I have a problem to send an e-mail with attachment.
    I use the HttpService to send the data to the php-file, but I always get the Fault message (form phpFault()).
    This is my code in Flex:
    <mx:Script>
        <![CDATA[
            import mx.rpc.events.FaultEvent;
            import mx.rpc.events.ResultEvent;
            import mx.graphics.codec.PNGEncoder;
            import mx.events.ValidationResultEvent;
            import mx.controls.Alert;
            [Bindable]
            private var byteArray:ByteArray;
            private function mailImage(comp:DisplayObject):void
                var emailValidation:ValidationResultEvent = validEmail.validate();
                if(emailValidation.type == ValidationResultEvent.INVALID)
                    Alert.show("Invalid E-mail");
                else
                    var bitmapData:BitmapData = new BitmapData(comp.width, comp.height);
                    bitmapData.draw(comp);
                    var png:PNGEncoder = new PNGEncoder();
                    byteArray = png.encode(bitmapData);
                    httpMail.send();
            private function phpResult(evt:ResultEvent):void
                Alert.show("You've got mail.");
            private function phpFault(evt:FaultEvent):void
                Alert.show("Something went wrong. /n" + evt.message.toString());
        ]]>
    </mx:Script>
    <mx:EmailValidator id="validEmail" source="{ipEmail}" property="text"/>
    <mx:HTTPService id="httpMail" url="php/byte-receiver.php" method="POST" result="phpResult(event)" fault="phpFault(event)">
        <mx:request>
            <img>{byteArray}</img>
            <mail>{ipEmail.text}</mail>
        </mx:request>
    </mx:HTTPService>
    <mx:Label text="draw your own image" styleName="h1" x="10" y="0" width="493" height="60"/>
    <mx:Canvas
        id="drawCanvas"
        x="10" y="77"
        width="561" height="245"
        borderStyle="solid" borderColor="#A6A6A6">
    </mx:Canvas>
    <mx:Label x="10" y="329" text="Your e-mail:" styleName="text"/>
    <mx:TextInput
        id="ipEmail"
        x="86" y="324" width="417"/>   
    <mx:Label
        id="lblMailImage"
        x="10" y="383"
        text="Mail my image"
        click="mailImage(drawCanvas)"
        mouseOver="lblMailImage.setStyle('color',  '#00067b')"
        mouseOut="lblMailImage.setStyle('color',  '#717171')"
        styleName="button"/>
    </mx:Canvas>
    This is my PHP code
    <?php                 
    $fileatt_type = "application/octet-stream"; // File Type
    $fileatt_name = "ImgContact.png"; // Filename that will be used for the file as the attachment
    $email_from = "[email protected]"; //Who the email is from
    $email_subject = "Contact Winckelmans.net"; // The Subject of the email
    $email_message = "Mail send by winckelmans.net. Your drawing is in the attachment"; // Message that the email has in it
    $email_to = $_POST['mail']; // Who the email is too
    $headers = "From: $email_from";  
    $data= $_POST['img'];
    $semi_rand = md5(time());  
    $mime_boundary = "==Multipart_Boundary_x{$semi_rand}x";  
    $headers .= "\nMIME-Version: 1.0\n" .  
                "Content-Type: multipart/mixed;\n" .  
                " boundary=\"{$mime_boundary}\"";  
    $email_message = "This is a multi-part message in MIME format.\n\n" .  
                    "--{$mime_boundary}\n" .  
                    "Content-Type:text/html; charset=\"iso-8859-1\"\n" .  
                   "Content-Transfer-Encoding: 7bit\n\n" .  
    $email_message . "\n\n";  
    $email_message .= "--{$mime_boundary}\n" .  
                      "Content-Type: {$fileatt_type};\n" .  
                      " name=\"{$fileatt_name}\"\n" .  
                      //"Content-Disposition: attachment;\n" .
                      //" filename=\"{$fileatt_name}\"\n" .
                      "Content-Transfer-Encoding: base64\n\n" .  
                     $data . "\n\n" .  
                      "--{$mime_boundary}--\n";  
    $mailsend = mail($email_to, $email_subject, $email_message, $headers);  
    echo $mailsend;
    ?>
    This is the error I get in an Alert:
    (mx.messaging.messages::ErrorMessage)#0
      body = ""
      clientId = "DirectHTTPChannel0"
      correlationId = "F3C16CE1-65CF-E690-1907-D28293FD6BB9"
      destination = ""
      extendedData = (null)
      faultCode = "Server.Error.Request"
      faultDetail = "Error: [IOErrorEvent type="ioError" bubbles=false cancelable=false eventPhase=2 text="Error #2032: Stream Error. URL: php/byte-receiver.php"]. URL: php/byte-receiver.php"
      faultString = "HTTP request error"
      headers = (Object)#1
        DSStatusCode = 0
      messageId = "7A1DCDBE-0358-7E39-3AF8-D282945A7748"
      rootCause = (flash.events::IOErrorEvent)#2
        bubbles = false
        cancelable = false
        currentTarget = (flash.net::URLLoader)#3
          bytesLoaded = 0
          bytesTotal = 0
          data = ""
          dataFormat = "text"
        eventPhase = 2
        target = (flash.net::URLLoader)#3
        text = "Error #2032: Stream Error. URL: php/byte-receiver.php"
        type = "ioError"
      timestamp = 0
      timeToLive = 0
    Thanks in advance
    Vincent

    Hi
    I'm having the same issue, except my application actually sends the email but the attachment is 0 octet and it doesn't even give me an error... Any chance you found a solution for this and could share it ?
    Thanks

  • How can I set the language when sending an e-mail with attachment - 'Html'?

    "Character Broken"
    I made an ALV program, and this convert to "HTML',  and send an e-mail with this.
    Used Process is:
    DATA: gt_abaplist LIKE TABLE OF abaplist,
          gt_html LIKE TABLE OF w3html,
          doc_chng LIKE sodocchgi1,
          objpack LIKE TABLE OF sopcklsti1 WITH HEADER LINE,
          objhead LIKE TABLE OF solisti1 WITH HEADER LINE,
          mail LIKE TABLE OF solisti1 WITH HEADER LINE,
          reclist LIKE TABLE OF somlreci1 WITH HEADER LINE,
          lv_line TYPE i.
    DELETE FROM MEMORY ID '%_LIST'.
    SUBMIT z_template
       AND RETURN EXPORTING LIST TO MEMORY.
    CALL FUNCTION 'LIST_FROM_MEMORY'
      TABLES
        listobject = gt_abaplist
      EXCEPTIONS
        not_found  = 1
        OTHERS     = 2.
    CALL FUNCTION 'WWW_HTML_FROM_LISTOBJECT'
      TABLES
        html       = gt_html
        listobject = gt_abaplist.
    doc_chng-obj_name   = 'URGENT'.
    doc_chng-sensitivty = 'O'.
    doc_chng-obj_descr  = ' '.
    doc_chng-obj_langu  = '3'.
    objhead-line        = ' '.
    APPEND objhead.
    mail[] = gt_html[].
    DESCRIBE TABLE mail LINES lv_line.
    CLEAR: objpack.
    objpack-transf_bin = 'X'.
    objpack-head_start = 1.
    objpack-head_num   = 0.
    objpack-body_start = 1.
    objpack-body_num   = lv_line.
    objpack-doc_type   = 'htm'.
    objpack-obj_descr  = ' '. 
    objpack-doc_size   = lv_line * 255.
    objpack-obj_langu = '3'.
    APPEND objpack.
    CLEAR: reclist.
    reclist-receiver = 'e-mail address'.
    reclist-rec_type = 'U'.
    APPEND reclist.
    CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
      EXPORTING
        document_data              = doc_chng 
        put_in_outbox              = 'X'
        commit_work                = 'X'
      TABLES
        packing_list               = objpack
        object_header              = objhead
        contents_bin               = mail
        receivers                  = reclist
      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.
    SUBMIT rsconn01 AND RETURN.
    I want to show  this by "Japanese".
    But the character is broken.
    LIke This:
    u01D1u072C          u0205|            u0205u072C          u0508           QC u04B90m
    How can I set the language?  How can I solve "Charancter Broken" ?
    Plesse, let me know.
    Thank you so much.
    Edited by: Jaime White 999 on Nov 21, 2011 8:45 AM
    Edited by: Jaime White 999 on Nov 21, 2011 8:46 AM

    Hi Jaime,
    Are you saying, you are getting junk characters in the email attachment? Then pls check the following. Since you want to send Japanese fonts, please pass language 'J' in both  objpack-obj_langu = '3' & doc_chng-obj_langu  = '3' instead of '3' please replace it with 'J'.
    Another thing which you may have to check is the SCOT device type. As I understand from my basis colleague, this may also affect your attachment fonts since the emails are sent through SCOT. Go to transaction SCOT-> Settings-> Device types for format conversion. Check whether wrong device type is defined for Japanese there. Hope this helps
    Regards,
    Gokul

  • Send an e-mail with attachment

    Hello Experts
    I have created one ALV report.
    Now, my requirement is that
    1.     While selecting one checkbox (Send e-mail), I want to send e-mail while running this report in background.
    2.     Report should be Excel or text as an attachment of e-mail
    Can we do that?
    Points will be awarder immediately.
    Regards
    n.master

    hi,
      the following threads will help you
    /thread/98781 [original link is broken]
    Regarding mail sent with an excel attachment
    How to send a ttachment with email.
    regards,
    pavan

  • Send Mail with Attachment to Outlook - Version 3.1i

    Hi Every one,
           I need to draft a logic in 3.1i system that sends a mail to Microsoft outlook inbox with attachments.
    The below flow of logic is the core part of the code that I am using for mails without attachments.
      OPEN DATASET P_FNAME FOR OUTPUT IN TEXT MODE.
      IF P_FROM NE SPACE.
        CONCATENATE 'From:'(MFR) P_FROM INTO P_FROM SEPARATED BY SPACE.
        TRANSFER P_FROM TO P_FNAME.
      ENDIF.
      IF P_TO NE SPACE.
        CONCATENATE 'To:'(MTO) P_TO INTO P_TO SEPARATED BY SPACE.
        TRANSFER P_TO TO P_FNAME.
      ENDIF.
      IF P_CC NE SPACE.
        CONCATENATE 'Cc:'(MCC) P_CC INTO P_CC SEPARATED BY SPACE.
        TRANSFER P_CC TO P_FNAME.
      ENDIF.
      IF P_BCC NE SPACE.
        CONCATENATE 'Bcc:'(MBC) P_BCC INTO P_BCC SEPARATED BY SPACE.
        TRANSFER P_BCC TO P_FNAME.
      ENDIF.
      IF P_SUB NE SPACE.
        CONCATENATE 'Subject:'(MSB) P_SUB INTO P_SUB SEPARATED BY SPACE.
        TRANSFER P_SUB TO P_FNAME.
      ENDIF.
      LOOP AT S_BODY.
        TRANSFER S_BODY-LOW TO P_FNAME.
      ENDLOOP.
      CLOSE DATASET P_FNAME.
    Run External Command: SENDMAIL
      CLEAR PARCOM.
      REFRESH OUT_LINES.
    concatenate 'sendmail -t < '     p_fname into parcom.
    Execute Command
    call         'system'        id         'COMMAND'   field   PARCOM   id   'TAB'   field    out_lines-SYS   .
    I have tried creating another file in AL11 and using it as attachment after the transfer of subject text in the above code, like -
        CONCATENATE 'Attach:'(MAT) '/usr/sap/GS1/DVEBMGS20/work/attach.txt INTO P_ATTACH SEPARATED BY SPACE.
        TRANSFER P_ATTACH TO P_FNAME.
    But, this did not work.
    Need your help in extending the code to send attachments.
    Thanks in Advance,
    Regards
    Govardhan
    Edited by: Gova12 on Sep 8, 2009 12:25 PM
    Edited by: Gova12 on Sep 8, 2009 12:57 PM

    < DATA:   i_message     TYPE STANDARD TABLE OF solisti1,
            i_attach      TYPE STANDARD TABLE OF solisti1,
            i_attach_body TYPE STANDARD TABLE OF solisti1,
            i_suc_notify  TYPE STANDARD TABLE OF zifdl,
            i_mail_rcpnts TYPE STANDARD TABLE OF zbss_mail.
    Populate table with detaisl to be entered into .xls file
      PERFORM build_xls_data_table.
    Send file by email as .xls speadsheet
      PERFORM send_file_as_email_attachment.
    *&      Form  BUILD_XLS_DATA_TABLE
    Populate table with detaisl to be entered into .xls file
    FORM build_xls_data_table .
      CONSTANTS: l_c_head1   TYPE  char20  VALUE 'Credit Card Type', "#EC NOTEXT
                 l_c_head2   TYPE  char20  VALUE 'OrigSysRef',
                 l_c_head3   TYPE  char20  VALUE 'OrderNum',
                 l_c_head4   TYPE  char20  VALUE 'OrigSysLineRef',
                 l_c_head5   TYPE  char20  VALUE 'LineNum',
                 l_c_head6   TYPE  char20  VALUE 'ItemNum',
                 l_c_head7   TYPE  char20  VALUE 'LineAmt',
                 l_c_head8   TYPE  char20  VALUE 'ScheduleDate',
                 l_c_head9   TYPE  char20  VALUE 'ReqDate',
                 l_c_head10  TYPE  char20  VALUE 'PromiseDate',
                 l_c_head11  TYPE  char20  VALUE 'AuthReqDate'.
      DATA:
             l_vtext            TYPE char50,                     "Credit Card Type
             l_bstnk            TYPE char20,                     "OrigSysRef
             l_vbeln            TYPE char20,                     "OrderNum
             l_posex            TYPE char20,                     "OrigSysLineRef
             l_posnr            TYPE char20,                     "LineNum
             l_matnr            TYPE char20,                     "ItemNum
             l_netwr            TYPE char20,                     "LineAmt
             l_lddat            TYPE char20,                     "ScheduleDate
             l_vdatu            TYPE char20,                     "ReqDate
             l_edatu            TYPE char20,                     "PromiseDate
             l_req_date         TYPE char20,                     "AuthReqDate
             l_sub_tot          TYPE vbap-netwr,
             l_sto              TYPE char20,
             l_v_datum          TYPE char10,
             l_v_time           TYPE char10,
             l_dummy            TYPE char20.
      DATA:  l_wa_attach           TYPE solisti1,
             l_wa_attach_body      TYPE solisti1,
             l_wa_final            TYPE t_final.
      CLEAR: l_dummy.
      CONCATENATE sy-datum(4) sy-datum4(2) sy-datum6(2) INTO l_v_datum SEPARATED BY '/'.
      CONCATENATE sy-uzeit(2) sy-uzeit2(2) sy-uzeit4(2) INTO l_v_time  SEPARATED BY ':'.
    This table  contain actual column headings for the fields in the attachment
      CLEAR: l_wa_attach.
      CONCATENATE  text-011
                   cl_abap_char_utilities=>horizontal_tab
                   text-003
                   cl_abap_char_utilities=>horizontal_tab
                   cl_abap_char_utilities=>horizontal_tab
                   cl_abap_char_utilities=>horizontal_tab
                   text-021
                   l_v_datum
                   l_v_time
                   cl_abap_char_utilities=>cr_lf
                   cl_abap_char_utilities=>cr_lf
                   INTO l_wa_attach SEPARATED BY cl_abap_char_utilities=>horizontal_tab.
      APPEND  l_wa_attach TO i_attach.
      CLEAR: l_wa_attach.
    This table  contain actual column headings for the fields in the attachment
      CONCATENATE   l_c_head1 l_c_head2 l_c_head3 l_c_head4 l_c_head5
                    l_c_head6 l_c_head7 l_c_head8 l_c_head9 l_c_head10
                    l_c_head11 cl_abap_char_utilities=>cr_lf
                    INTO l_wa_attach SEPARATED BY cl_abap_char_utilities=>horizontal_tab.
      APPEND  l_wa_attach TO i_attach.
      CLEAR: l_wa_attach.
    This table contain the actual contents of the attachment
      SORT i_final BY vbeln posnr.
      CLEAR: l_wa_final,l_wa_attach_body.
      LOOP AT i_final INTO l_wa_final.
        WRITE :
                l_wa_final-vtext    TO l_vtext,
                l_wa_final-bstnk    TO l_bstnk,
                l_wa_final-vbeln    TO l_vbeln,
                l_wa_final-posex    TO l_posex,
                l_wa_final-posnr    TO l_posnr,
                l_wa_final-matnr    TO l_matnr,
                l_wa_final-netwr    TO l_netwr CURRENCY 'VBAP-WAERK',
                l_wa_final-lddat    TO l_lddat,
                l_wa_final-vdatu    TO l_vdatu,
                l_wa_final-edatu    TO l_edatu,
                l_wa_final-req_date TO l_req_date.
        l_sub_tot = l_sub_tot + l_wa_final-netwr.
        CONCATENATE l_dummy
                    l_vtext l_bstnk l_vbeln l_posex l_posnr l_matnr
                    l_netwr l_lddat l_vdatu l_edatu l_req_date
                    INTO l_wa_attach_body SEPARATED BY cl_abap_char_utilities=>horizontal_tab.
        APPEND  l_wa_attach_body TO i_attach_body.
        CLEAR: l_wa_attach_body.
        AT END OF vbeln.
          READ TABLE i_final INTO l_wa_final INDEX sy-tabix.
          MOVE l_sub_tot TO l_sto.
          CONCATENATE cl_abap_char_utilities=>horizontal_tab
                      cl_abap_char_utilities=>horizontal_tab
                      cl_abap_char_utilities=>horizontal_tab
                      'Order total'
                      l_sto
                      cl_abap_char_utilities=>cr_lf
                 INTO l_wa_attach_body SEPARATED BY cl_abap_char_utilities=>horizontal_tab.
          APPEND  l_wa_attach_body TO i_attach_body.
          CLEAR: l_sub_tot,l_sto,l_wa_attach_body.
        ENDAT.
      ENDLOOP.
    ENDFORM.                    " BUILD_XLS_DATA_TABLE
      DATA:   l_v_desc  TYPE sood1-objdes,
              l_wa_suc_notify TYPE zifdl,
              l_wa_mail_rcpnts TYPE zbss_mail.
    Get the mail ids from distribution list
      REFRESH: i_suc_notify.
      SELECT * INTO TABLE i_suc_notify
                      FROM zifdl
                      WHERE zdstlist EQ p_disid.
      IF sy-subrc <> c_zero.
      Show exit msg if there is no distribution list maintained
        MESSAGE e002 WITH  text-014 p_disid.
      ENDIF.
    format the email id details
      CLEAR: l_wa_suc_notify,l_wa_mail_rcpnts.
      LOOP AT i_suc_notify INTO l_wa_suc_notify .
        IF l_wa_suc_notify-zuserid CA '@'.
          l_wa_mail_rcpnts-l_adr_name = l_wa_suc_notify-zuserid.
        ELSE.
          l_wa_mail_rcpnts-usrnam = l_wa_suc_notify-zuserid.
        ENDIF.
        APPEND l_wa_mail_rcpnts TO i_mail_rcpnts.
        CLEAR: l_wa_mail_rcpnts,l_wa_suc_notify.
      ENDLOOP.
    Populate message body text
      PERFORM populate_email_message_body.
    Send the report output generated to the list of recipients
      MOVE text-012 TO l_v_desc.
    Send the e-mail with attachment
      TRY.
        -------- create persistent send request ------------------------
          send_request = cl_bcs=>create_persistent( ).
        -------- create and set document with attachment ---------------
        create document from internal table with text
          document = cl_document_bcs=>create_document(
                          i_type    = 'RAW'
                          i_text    = i_content_body[]
                          i_subject = subject ).
    Check if Attachment should be sent in mail
          IF p_skip_attach IS INITIAL.
            IF i_attachment_type = 'ALI'.
              CALL METHOD document->add_attachment
                EXPORTING
                  i_attachment_type    = i_attachment_type
                  i_attachment_subject = l_filename
                  i_att_content_hex    = i_content_hex.
            ELSE.
    Get No of lines
              DESCRIBE TABLE i_attach LINES l_lines.
    Size to multiplied by no of lines
              l_size = l_lines * 255.
              CALL METHOD document->add_attachment
                EXPORTING
                  i_attachment_type    = i_attachment_type
                  i_attachment_size    = l_size
                  i_attachment_subject = i_filename
                  i_att_content_text   = i_attach[].
            ENDIF.
          ENDIF.
        add document to send request
          CALL METHOD send_request->set_document( document ).
        --------- add recipient (e-mail address) -----------------------
          LOOP AT i_receivers INTO l_receiver_wa.
            CLEAR l_mailaddr.
            l_mailaddr = l_receiver_wa-receiver.
            recipient = cl_cam_address_bcs=>create_internet_address(
                                                l_mailaddr ).
        add recipient with its respective attributes to send request
            CALL METHOD send_request->add_recipient
              EXPORTING
                i_recipient  = recipient
                i_express    = express
               i_copy       = ' '
               i_blind_copy = ' '
                i_copy       = l_receiver_wa-copy
                i_blind_copy = l_receiver_wa-blind_copy
                i_no_forward = ' '.
          ENDLOOP.
    *Set sender based on l_userid
          lo_sender = cl_sapuser_bcs=>create( l_userid ).
          CALL METHOD send_request->set_sender( EXPORTING i_sender = lo_sender ).
        ---------- send document ---------------------------------------
          CALL METHOD send_request->send(
            EXPORTING
              i_with_error_screen = 'X'
            RECEIVING
              result              = sent_to_all ).
          IF i_bypass_commit IS INITIAL.
            COMMIT WORK.
          ENDIF.
    *                     exception handling
        CATCH cx_bcs INTO bcs_exception.
      ENDTRY. >
    Edited by: sugunav on Sep 8, 2009 4:41 PM

  • Impossible to sent  mail  with attachement created in pages

    I am new   with Mac
    this morning i  jsut tried to send email  via  mail  with  attachement creatad  in pages 
    message could not be sent
    I tried several time  and  received allways answer  :  something like refused by  server
    I tried to convert  pages  into  word  but still the same
    I am not working on my mac  for the moment  to send  message  but can some help  to  solve    this problem  and tell me what to do 
    tks

    The new Pages file format is a complicated zipped package which GMail, Google, Yahoo and up until recently DropBox have had trouble with.
    Try sending it with Mail.
    Peter

  • Can I send an E-Mail with photo (not as an attachment)?

    I would like to send an E-Mail with a small photo (not as an attachment) to someone who is reluctant to open attachments. Can I do this and how??
    Thank you
    tch

    If you insert an image into the body, it will still be 'attached', even though it won't be listed as an attachment in the usual way. Another option is to upload the photo to your personal storage space such as OneDrive or Google Drive, and then email the link to the image. The image can then be displayed in a web browser. If you don't have a storage space, there are plenty of free image-hosting services.

  • Sending mail with attachment and body.

    Hi Experts,
    I have a requirement of sending a mail with an attachment and also the mail will have a body whose content will be same as that in the attachment.Subject of the mail will also be configured dynamically.Though I am able to send the mail with the attachment but I am not able to configure the body whose content will be same as that of the attachment.
    I have unchecked the "Use Mail Package" and has hard-coded the "TO","From" field for sending the mail with attachment.
    Can you please check and let me know how to configure the body which will be same as that of the attachment.
    Thanks and Regards
    Atanu Mazumdar

    Hi,
    Use MTB module and then one of the parameter which can allow you to send message in attachment as well as in message body.
    Transform.ContentDisposition: it helps us to decide if we want to send the payload as an attachment or in the message body. If we give the Parameter value as u201Cattachmentu201D then we will have the payload attached in the mail and if we assign this value as u201Cinlineu201D the payload will go in the mail body.
    Hope this helps you..
    Regards....

  • Sending mail with attachment fails on MAC Mail and WRP400.

    Sending mail with attachment fails on MAC Mail and WRP400.
    We have hundreds of WRP400 connected with Mac (Machintosh) computers. No special configurations are applied (no virtual server or DMZ). Web navigation, P2P programs and sending mail without attachment work right.
    The problem is the impossibility to send mails with medium or big size files attachment from MAC Mail.
    If we use Windows PCs or a different linksys routers (eg. WRT54G) the problem not happens.
    We have upgraded WRP400 firmware version from 1.00.06 to 2.00.05 but the result is the same. Sending mail with attachment using Mac fails.
    We tried to configure WRP400 with DMZ to a particular MAC. We tried to configure Virtual server on tcp 25 port of a MAC. The result is always the same.
    This is a WRP400 bug? Windows PCs work right. MAC and MAC mail works right with other linksys router.
    We need help. Thanks.

    The problem was fixed since beta firmware 2.00.11.
    I think that this issue was caused from a bug that decrease upload bitrate of WRP400 after some days of activity.
    See more details on Cisco forum under title "WRP400 stops responding after browsing certain websites".
    Thanks.

  • Mail_Receiver: Send Mail with attachment

    Hi everybody,
    I need some help. I want to send a mail with attachment.
    for this I have imported SAPs xsd for the mail adapter.
    I wonder how to map the target fields?
    The following causes five! attachments in SXMB_MONI and the adapter throws
    java.lang.IllegalArgumentException: can't parse argument number
    <?xml version="1.0" encoding="UTF-8"?>
    <ns0:Messages xmlns:ns0="http://sap.com/xi/XI/SplitAndMerge">
       <ns0:Message1>
          <ns1:Mail xmlns:ns1="http://sap.com/xi/XI/Mail/30">
             <Subject>SubjctName</Subject>
             <From>mailadress</From>
             <To>mailadress</To>
             <Content_Type>text/plain; charset=&quot;ISO-8859-1&quot;</Content_Type>
             <Content_Description>
                <attachment filename="filename.txt">This should be the content of the attachment</attachment>
             </Content_Description>
             <Content>Constant</Content>
          </ns1:Mail>
       </ns0:Message1>
    </ns0:Messages>
    How do I have to foll the target fields?
    Thanks regards
    Mario

    Hi
    the following links may help you :
    https://www.sdn.sap.com/irj/sdn/weblogs?blog=/pub/wlg/1685 [original link is broken] [original link is broken] [original link is broken]
    http://help.sap.com/saphelp_nw04/helpdata/en/3c/b4a6490a08cd41a8c91759c3d2f401/content.htm
    /people/prasad.ulagappan2/blog/2005/06/07/mail-adapter-scenarios-150-sap-exchange-infrastructure
    XI Mail Adapter: An approach for sending emails with attachment with help of Java mapping
    Also reffer to the below mentioned thread;
    Regarding mail sent with an excel attachment
    Regard's
    Chetan Ahuja

  • Convert Script output data to Text(.txt) file & send mail with attachment.

    Hi All,
    Requirement: I shulb be able to conver th Script output data to Text(.text) file & send a maill with attachment with this text file. Formant of text file should be like output of Print priview.
    Plese sugget with Function modules to cover as Text file.
    I am able to converting the Script output data to PDF and sending mail with attachment. So I don't want PDF file now.
    Thanks in advance.

    Hi, Thanks for responst.
    We can convert the Scirpt output to PDF file by using OTF function module and the PDF file looks like Print Privew output.
    Same like this I want Script out in NOTEPAD (.txt). Is that possible, Plz sugget with relavent Function Modules.
    Thanks.

  • We want to send a mail with attachment pdf file.

    Hi!!!
    We want to send a mail with attachment pdf file.
    The PDF file this is in the server sap.

    Hi,
    Pls check web logs like
    /people/thomas.jung3/blog/2004/09/08/sending-e-mail-from-abap--version-610-and-higher--bcs-interface
    Eddy
    PS.
    Put yourself on the SDN world map (http://sdn.idizaai.be/sdn_world/sdn_world.html) and earn 25 points.
    Spread the wor(l)d!

  • Send a mail with attached file .xls but i got file without

    i tried to send a mail with attached file .xls. but i am able to send the file , we recived the file without file name. please do the same
    thnaks in advance.
    END-OF-SELECTION.
    Populate message body text
    PERFORM POPULATE_EMAIL_MESSAGE_BODY.
    Send file by email as .xls speadsheet
    PERFORM SEND_FILE_AS_EMAIL_ATTACHMENT
    TABLES IT_MESSAGE
    IT_ATTACH
    USING P_EMAIL
    'Example .xls documnet attachment'
    'XLS'
    'filename'
    CHANGING GD_ERROR
    GD_RECIEVER.
    Instructs mail send program for SAPCONNECT to send email(rsconn01)
    PERFORM INITIATE_MAIL_EXECUTE_PROGRAM.
    *& Form DATA_RETRIEVAL
    Retrieve data form EKPO table and populate itab it_ekko
    FORM DATA_RETRIEVAL.
    SELECT EBELN EBELP AEDAT MATNR
    UP TO 10 ROWS
    FROM EKPO
    INTO TABLE IT_EKPO.
    ENDFORM. " DATA_RETRIEVAL
    *& Form BUILD_XLS_DATA_TABLE
    Build data table for .xls document
    FORM BUILD_XLS_DATA_TABLE.
    CONSTANTS: CON_CRET TYPE X VALUE '0D', "OK for non Unicode
    CON_TAB TYPE X VALUE '09'. "OK for non Unicode
    *If you have Unicode check active in program attributes thnen you will
    *need to declare constants as follows
    *class cl_abap_char_utilities definition load.
    *constants:
    con_tab type c value cl_abap_char_utilities=>HORIZONTAL_TAB,
    con_cret type c value cl_abap_char_utilities=>CR_LF.
    CONCATENATE 'EBELN' 'EBELP' 'AEDAT' 'MATNR'
    INTO IT_ATTACH SEPARATED BY ''.
    CONCATENATE '' IT_ATTACH INTO IT_ATTACH.
    APPEND IT_ATTACH.
    LOOP AT IT_EKPO INTO WA_CHAREKPO.
    CONCATENATE WA_CHAREKPO-EBELN WA_CHAREKPO-EBELP
    WA_CHAREKPO-AEDAT WA_CHAREKPO-MATNR
    INTO IT_ATTACH SEPARATED BY ''.
    CONCATENATE '' IT_ATTACH INTO IT_ATTACH.
    APPEND IT_ATTACH.
    ENDLOOP.
    ENDFORM. " BUILD_XLS_DATA_TABLE
    *& Form SEND_FILE_AS_EMAIL_ATTACHMENT
    Send email
    FORM SEND_FILE_AS_EMAIL_ATTACHMENT TABLES PIT_MESSAGE
    PIT_ATTACH
    USING P_EMAIL
    P_MTITLE
    P_FORMAT
    P_FILENAME
    P_ATTDESCRIPTION
    P_SENDER_ADDRESS
    P_SENDER_ADDRES_TYPE
    CHANGING P_ERROR
    P_RECIEVER.
    DATA: LD_ERROR TYPE SY-SUBRC,
    LD_RECIEVER TYPE SY-SUBRC,
    LD_MTITLE LIKE SODOCCHGI1-OBJ_DESCR,
    LD_EMAIL LIKE SOMLRECI1-RECEIVER,
    LD_FORMAT TYPE SO_OBJ_TP ,
    LD_ATTDESCRIPTION TYPE SO_OBJ_NAM ,
    LD_ATTFILENAME TYPE SO_OBJ_DES ,
    LD_SENDER_ADDRESS LIKE SOEXTRECI1-RECEIVER,
    LD_SENDER_ADDRESS_TYPE LIKE SOEXTRECI1-ADR_TYP,
    LD_RECEIVER LIKE SY-SUBRC.
    LD_EMAIL = P_EMAIL.
    LD_MTITLE = P_MTITLE.
    LD_FORMAT = P_FORMAT.
    LD_ATTDESCRIPTION = P_ATTDESCRIPTION.
    LD_ATTFILENAME = P_FILENAME.
    LD_SENDER_ADDRESS = P_SENDER_ADDRESS.
    LD_SENDER_ADDRESS_TYPE = P_SENDER_ADDRES_TYPE.
    Fill the document data.
    W_DOC_DATA-DOC_SIZE = 1.
    Populate the subject/generic message attributes
    W_DOC_DATA-OBJ_LANGU = SY-LANGU.
    W_DOC_DATA-OBJ_NAME = 'SAPRPT'.
    W_DOC_DATA-OBJ_DESCR = LD_MTITLE .
    W_DOC_DATA-SENSITIVTY = 'F'.
    Fill the document data and get size of attachment
    CLEAR W_DOC_DATA.
    READ TABLE IT_ATTACH INDEX W_CNT.
    W_DOC_DATA-DOC_SIZE =
    ( W_CNT - 1 ) * 255 + STRLEN( IT_ATTACH ).
    W_DOC_DATA-OBJ_LANGU = SY-LANGU.
    W_DOC_DATA-OBJ_NAME = 'SAPRPT'.
    W_DOC_DATA-OBJ_DESCR = LD_MTITLE.
    W_DOC_DATA-SENSITIVTY = 'F'.
    CLEAR T_ATTACHMENT.
    REFRESH T_ATTACHMENT.
    T_ATTACHMENT[] = PIT_ATTACH[].
    Describe the body of the message
    CLEAR T_PACKING_LIST.
    REFRESH T_PACKING_LIST.
    T_PACKING_LIST-TRANSF_BIN = SPACE.
    T_PACKING_LIST-HEAD_START = 1.
    T_PACKING_LIST-HEAD_NUM = 0.
    T_PACKING_LIST-BODY_START = 1.
    DESCRIBE TABLE IT_MESSAGE LINES T_PACKING_LIST-BODY_NUM.
    T_PACKING_LIST-DOC_TYPE = 'RAW'.
    APPEND T_PACKING_LIST.
    Create attachment notification
    T_PACKING_LIST-TRANSF_BIN = 'X'.
    T_PACKING_LIST-HEAD_START = 1.
    T_PACKING_LIST-HEAD_NUM = 1.
    T_PACKING_LIST-BODY_START = 1.
    DESCRIBE TABLE T_ATTACHMENT LINES T_PACKING_LIST-BODY_NUM.
    T_PACKING_LIST-DOC_TYPE = LD_FORMAT.
    T_PACKING_LIST-OBJ_DESCR = LD_ATTDESCRIPTION.
    T_PACKING_LIST-OBJ_NAME = LD_ATTFILENAME.
    T_PACKING_LIST-DOC_SIZE = T_PACKING_LIST-BODY_NUM * 255.
    APPEND T_PACKING_LIST.
    Add the recipients email address
    CLEAR T_RECEIVERS.
    REFRESH T_RECEIVERS.
    T_RECEIVERS-RECEIVER = LD_EMAIL.
    T_RECEIVERS-REC_TYPE = 'U'.
    T_RECEIVERS-COM_TYPE = 'INT'.
    T_RECEIVERS-NOTIF_DEL = 'X'.
    T_RECEIVERS-NOTIF_NDEL = 'X'.
    APPEND T_RECEIVERS.
    CALL FUNCTION 'SO_DOCUMENT_SEND_API1'
    EXPORTING
    DOCUMENT_DATA = W_DOC_DATA
    PUT_IN_OUTBOX = 'X'
    SENDER_ADDRESS = LD_SENDER_ADDRESS
    SENDER_ADDRESS_TYPE = LD_SENDER_ADDRESS_TYPE
    COMMIT_WORK = 'X'
    IMPORTING
    SENT_TO_ALL = W_SENT_ALL
    TABLES
    PACKING_LIST = T_PACKING_LIST
    CONTENTS_BIN = T_ATTACHMENT
    CONTENTS_TXT = IT_MESSAGE
    RECEIVERS = T_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.
    Populate zerror return code
    LD_ERROR = SY-SUBRC.
    Populate zreceiver return code
    LOOP AT T_RECEIVERS.
    LD_RECEIVER = T_RECEIVERS-RETRN_CODE.
    ENDLOOP.
    ENDFORM.
    *& Form INITIATE_MAIL_EXECUTE_PROGRAM
    Instructs mail send program for SAPCONNECT to send email.
    FORM INITIATE_MAIL_EXECUTE_PROGRAM.
    WAIT UP TO 2 SECONDS.
    SUBMIT RSCONN01 WITH MODE = 'INT'
    WITH OUTPUT = 'X'
    AND RETURN.
    ENDFORM. " INITIATE_MAIL_EXECUTE_PROGRAM
    *& Form POPULATE_EMAIL_MESSAGE_BODY
    Populate message body text
    FORM POPULATE_EMAIL_MESSAGE_BODY.
    REFRESH IT_MESSAGE.
    IT_MESSAGE = 'Please find attached a list test ekpo records'.
    APPEND IT_MESSAGE.
    ENDFORM. " POPULATE_EMAIL_MESSAGE_BODY

    PERFORM SEND_FILE_AS_EMAIL_ATTACHMENT
      TABLES IT_MESSAGE
      IT_ATTACH
      USING P_EMAIL
      'Failed IDOC Analysis report'(020)
      'xls'(021)
      'IDOC_REP'(022)
      CHANGING GD_ERROR
      GD_RECIEVER.
    Instructs mail send program for SAPCONNECT to send email(rsconn01)
      PERFORM INITIATE_MAIL_EXECUTE_PROGRAM.
    ENDFORM.                    " F_MAIL
    *& Form BUILD_XLS_DATA_TABLE
    Build data table for .xls document
    FORM BUILD_XLS_DATA_TABLE.
    *CONSTANTS: CON_CRET TYPE X VALUE '0D', "OK for non Unicode
    *CON_TAB TYPE X VALUE '09'. "OK for non Unicode
    *If you have Unicode check active in program attributes thnen you will
    *need to declare constants as follows
    *class cl_abap_char_utilities definition load.
      constants:
       con_tab type c value cl_abap_char_utilities=>HORIZONTAL_TAB,
       con_cret type c value cl_abap_char_utilities=>CR_LF.
      CONCATENATE text-040 text-041 text-042 text-043 text-044 text-045 text-046 text-047 text-048 text-049
      INTO IT_ATTACH SEPARATED BY con_tab.
      CONCATENATE con_cret IT_ATTACH INTO IT_ATTACH.
      APPEND IT_ATTACH.
      clear IT_ATTACH.
      loop at i_final_t into w_final.
        CONCATENATE
        w_final-mestyp w_final-docnum  w_final-statxt w_final-msgno w_final-rvplant w_final-kunnr w_final-vbeln w_final-credat
                w_final-cretim w_final-flag INTO IT_ATTACH SEPARATED BY con_tab.
        CONCATENATE con_cret IT_ATTACH INTO IT_ATTACH.
        APPEND IT_ATTACH.
        clear IT_attach.
      endloop.
    ENDFORM. " BUILD_XLS_DATA_TABLE
    *& Form SEND_FILE_AS_EMAIL_ATTACHMENT
    Send email
    FORM SEND_FILE_AS_EMAIL_ATTACHMENT TABLES PIT_MESSAGE
    PIT_ATTACH
    USING P_EMAIL
    P_MTITLE
    P_FORMAT
    P_FILENAME
    P_ATTDESCRIPTION
    P_SENDER_ADDRESS
    P_SENDER_ADDRES_TYPE
    CHANGING P_ERROR
    P_RECIEVER.
      DATA: LD_ERROR TYPE SY-SUBRC,
      LD_RECIEVER TYPE SY-SUBRC,
      LD_MTITLE LIKE SODOCCHGI1-OBJ_DESCR,
      LD_EMAIL LIKE SOMLRECI1-RECEIVER,
      LD_FORMAT TYPE SO_OBJ_TP ,
      LD_ATTDESCRIPTION TYPE SO_OBJ_NAM ,
      LD_ATTFILENAME TYPE SO_OBJ_DES ,
      LD_SENDER_ADDRESS LIKE SOEXTRECI1-RECEIVER,
      LD_SENDER_ADDRESS_TYPE LIKE SOEXTRECI1-ADR_TYP,
      LD_RECEIVER LIKE SY-SUBRC.
      LD_EMAIL = P_EMAIL.
      LD_MTITLE = P_MTITLE.
      LD_FORMAT = P_FORMAT.
      LD_ATTDESCRIPTION = P_ATTDESCRIPTION.
      LD_ATTFILENAME = P_FILENAME.
      LD_SENDER_ADDRESS = P_SENDER_ADDRESS.
      LD_SENDER_ADDRESS_TYPE = P_SENDER_ADDRES_TYPE.
    Fill the document data.
      W_DOC_DATA-DOC_SIZE = 1.
    Populate the subject/generic message attributes
      W_DOC_DATA-OBJ_LANGU = SY-LANGU.
      W_DOC_DATA-OBJ_NAME = 'SAPRPT'.
      W_DOC_DATA-OBJ_DESCR = LD_MTITLE .
      W_DOC_DATA-SENSITIVTY = 'F'.
    Fill the document data and get size of attachment
      CLEAR W_DOC_DATA.
      READ TABLE IT_ATTACH INDEX W_CNT.
      W_DOC_DATA-DOC_SIZE =
      ( W_CNT - 1 ) * 255 + STRLEN( IT_ATTACH ).
      W_DOC_DATA-OBJ_LANGU = SY-LANGU.
      W_DOC_DATA-OBJ_NAME = 'SAPRPT'.
      W_DOC_DATA-OBJ_DESCR = LD_MTITLE.
      W_DOC_DATA-SENSITIVTY = 'F'.
      CLEAR T_ATTACHMENT.
      REFRESH T_ATTACHMENT.
      T_ATTACHMENT[] = PIT_ATTACH[].
    Describe the body of the message
      CLEAR T_PACKING_LIST.
      REFRESH T_PACKING_LIST.
      T_PACKING_LIST-TRANSF_BIN = SPACE.
      T_PACKING_LIST-HEAD_START = 1.
      T_PACKING_LIST-HEAD_NUM = 0.
      T_PACKING_LIST-BODY_START = 1.
      DESCRIBE TABLE IT_MESSAGE LINES T_PACKING_LIST-BODY_NUM.
      T_PACKING_LIST-DOC_TYPE = 'RAW'.
      APPEND T_PACKING_LIST.
    Create attachment notification
      T_PACKING_LIST-TRANSF_BIN = 'X'.
      T_PACKING_LIST-HEAD_START = 1.
      T_PACKING_LIST-HEAD_NUM = 1.
      T_PACKING_LIST-BODY_START = 1.
      DESCRIBE TABLE T_ATTACHMENT LINES T_PACKING_LIST-BODY_NUM.
      T_PACKING_LIST-DOC_TYPE = LD_FORMAT.
      T_PACKING_LIST-OBJ_DESCR = LD_ATTDESCRIPTION.
      T_PACKING_LIST-OBJ_NAME = LD_ATTFILENAME.
      T_PACKING_LIST-DOC_SIZE = T_PACKING_LIST-BODY_NUM * 255.
      APPEND T_PACKING_LIST.
    Add the recipients email address
      CLEAR T_RECEIVERS.
      REFRESH T_RECEIVERS.
      T_RECEIVERS-RECEIVER = LD_EMAIL.
      T_RECEIVERS-REC_TYPE = 'U'.
      T_RECEIVERS-COM_TYPE = 'INT'.
      T_RECEIVERS-NOTIF_DEL = 'X'.
      T_RECEIVERS-NOTIF_NDEL = 'X'.
      APPEND T_RECEIVERS.
      CALL FUNCTION 'SO_DOCUMENT_SEND_API1'
        EXPORTING
          DOCUMENT_DATA              = W_DOC_DATA
          PUT_IN_OUTBOX              = 'X'
          SENDER_ADDRESS             = LD_SENDER_ADDRESS
          SENDER_ADDRESS_TYPE        = LD_SENDER_ADDRESS_TYPE
          COMMIT_WORK                = 'X'
        IMPORTING
          SENT_TO_ALL                = W_SENT_ALL
        TABLES
          PACKING_LIST               = T_PACKING_LIST
          CONTENTS_BIN               = T_ATTACHMENT
          CONTENTS_TXT               = IT_MESSAGE
          RECEIVERS                  = T_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.
    Populate zerror return code
      LD_ERROR = SY-SUBRC.
    Populate zreceiver return code
      LOOP AT T_RECEIVERS.
        LD_RECEIVER = T_RECEIVERS-RETRN_CODE.
      ENDLOOP.
    ENDFORM.                    "SEND_FILE_AS_EMAIL_ATTACHMENT
    *& Form INITIATE_MAIL_EXECUTE_PROGRAM
    Instructs mail send program for SAPCONNECT to send email.
    FORM INITIATE_MAIL_EXECUTE_PROGRAM.
      WAIT UP TO 2 SECONDS.
      SUBMIT RSCONN01 WITH MODE = 'INT'
      WITH OUTPUT = 'X'
      AND RETURN.
    ENDFORM. " INITIATE_MAIL_EXECUTE_PROGRAM
    *& Form POPULATE_EMAIL_MESSAGE_BODY
    Populate message body text
    FORM POPULATE_EMAIL_MESSAGE_BODY.
      data: l1(99)    type c,
             l2(15)    type c,
             lt_message         type standard table of solisti1,
             ls_message      like line of lt_message.
      clear ls_message.
      l1 = 'Dear'(007).
      l2 =  'Sir/Madam'(008).
      concatenate l1 l2 ',' into
      ls_message-line separated by space.
      append ls_message to lt_message.
    *insert Blank Line
      clear ls_message.
      ls_message-line = space.
      append ls_message to lt_message.
    *Assign Message text
      clear ls_message.
      concatenate text-011
                  text-012
                  into ls_message-line separated by space.
      append ls_message to lt_message.
    *insert Blank Line
      clear ls_message.
      ls_message-line = space.
      append ls_message to lt_message.
    *Assign Message text
      clear ls_message.
      concatenate text-013
                  text-014
                  text-015
                  into ls_message-line separated by space.
      append ls_message to lt_message.
      concatenate text-016
                  text-017
                  into ls_message-line separated by space.
      append ls_message to lt_message.
    *insert Blank Line
      clear ls_message.
      ls_message-line = space.
      append ls_message to lt_message.
      ls_message-line = text-018.
      append ls_message to lt_message.
      ls_message-line = text-019.
      append ls_message to lt_message.
      clear: ls_message.
      REFRESH IT_MESSAGE.
      it_message[] = lt_message[].
      APPEND IT_MESSAGE.
    ENDFORM. " POPULATE_EMAIL_MESSAGE_BODY

  • How to send a mail with attaching a report

    hi gurus,
        my requirment is i have to send a mail with attaching the report of a program to the client.. is it possible? help me with sample code.
    Thanks in advance.
    Regards,
    Indira D

    Hi Indira,
    plz check out this code below,
    *& Report  ZATTACH                                               *
    REPORT  ZATTACH                   .
    TABLES: ekko.
    PARAMETERS: p_email   TYPE somlreci1-receiver
                                      DEFAULT '[email protected]'.
    TYPES: BEGIN OF t_ekpo,
      ebeln TYPE ekpo-ebeln,
      ebelp TYPE ekpo-ebelp,
      aedat TYPE ekpo-aedat,
      matnr TYPE ekpo-matnr,
    END OF t_ekpo.
    DATA: it_ekpo TYPE STANDARD TABLE OF t_ekpo INITIAL SIZE 0,
          wa_ekpo TYPE t_ekpo.
    TYPES: BEGIN OF t_charekpo,
      ebeln(10) TYPE c,
      ebelp(5)  TYPE c,
      aedat(8)  TYPE c,
      matnr(18) TYPE c,
    END OF t_charekpo.
    DATA: wa_charekpo TYPE t_charekpo.
    DATA:   it_message TYPE STANDARD TABLE OF solisti1 INITIAL SIZE 0
                    WITH HEADER LINE.
    DATA:   it_attach TYPE STANDARD TABLE OF solisti1 INITIAL SIZE 0
                    WITH HEADER LINE.
    DATA:   t_packing_list LIKE sopcklsti1 OCCURS 0 WITH HEADER LINE,
            t_contents LIKE solisti1 OCCURS 0 WITH HEADER LINE,
            t_receivers LIKE somlreci1 OCCURS 0 WITH HEADER LINE,
            t_attachment LIKE solisti1 OCCURS 0 WITH HEADER LINE,
            t_object_header LIKE solisti1 OCCURS 0 WITH HEADER LINE,
            w_cnt TYPE i,
            w_sent_all(1) TYPE c,
            w_doc_data LIKE sodocchgi1,
            gd_error    TYPE sy-subrc,
            gd_reciever TYPE sy-subrc.
    *START_OF_SELECTION
    START-OF-SELECTION.
      Retrieve sample data from table ekpo
      PERFORM data_retrieval.
      Populate table with detaisl to be entered into .xls file
      PERFORM build_xls_data_table.
    *END-OF-SELECTION
    END-OF-SELECTION.
    Populate message body text
      perform populate_email_message_body.
    Send file by email as .xls speadsheet
      PERFORM send_file_as_email_attachment
                                   tables it_message
                                          it_attach
                                    using p_email
                                          'Example .xls documnet attachment'
                                          'XLS'
                                          'filename'
                                 changing gd_error
                                          gd_reciever.
      Instructs mail send program for SAPCONNECT to send email(rsconn01)
      PERFORM initiate_mail_execute_program.
    *&      Form  DATA_RETRIEVAL
          Retrieve data form EKPO table and populate itab it_ekko
    FORM data_retrieval.
      SELECT ebeln ebelp aedat matnr
       UP TO 10 ROWS
        FROM ekpo
        INTO TABLE it_ekpo.
    ENDFORM.                    " DATA_RETRIEVAL
    *&      Form  BUILD_XLS_DATA_TABLE
          Build data table for .xls document
    FORM build_xls_data_table.
      CONSTANTS: con_cret TYPE x VALUE '0D',  "OK for non Unicode
                 con_tab TYPE x VALUE '09'.   "OK for non Unicode
    *If you have Unicode check active in program attributes thnen you will
    *need to declare constants as follows
    *class cl_abap_char_utilities definition load.
    *constants:
       con_tab  type c value cl_abap_char_utilities=>HORIZONTAL_TAB,
       con_cret type c value cl_abap_char_utilities=>CR_LF.
      CONCATENATE 'EBELN' 'EBELP' 'AEDAT' 'MATNR'
             INTO it_attach SEPARATED BY con_tab.
      CONCATENATE con_cret it_attach  INTO it_attach.
      APPEND  it_attach.
      LOOP AT it_ekpo INTO wa_charekpo.
        CONCATENATE wa_charekpo-ebeln wa_charekpo-ebelp
                    wa_charekpo-aedat wa_charekpo-matnr
               INTO it_attach SEPARATED BY con_tab.
        CONCATENATE con_cret it_attach  INTO it_attach.
        APPEND  it_attach.
      ENDLOOP.
    ENDFORM.                    " BUILD_XLS_DATA_TABLE
    *&      Form  SEND_FILE_AS_EMAIL_ATTACHMENT
          Send email
    FORM send_file_as_email_attachment tables pit_message
                                              pit_attach
                                        using p_email
                                              p_mtitle
                                              p_format
                                              p_filename
                                              p_attdescription
                                              p_sender_address
                                              p_sender_addres_type
                                     changing p_error
                                              p_reciever.
      DATA: ld_error    TYPE sy-subrc,
            ld_reciever TYPE sy-subrc,
            ld_mtitle LIKE sodocchgi1-obj_descr,
            ld_email LIKE  somlreci1-receiver,
            ld_format TYPE  so_obj_tp ,
            ld_attdescription TYPE  so_obj_nam ,
            ld_attfilename TYPE  so_obj_des ,
            ld_sender_address LIKE  soextreci1-receiver,
            ld_sender_address_type LIKE  soextreci1-adr_typ,
            ld_receiver LIKE  sy-subrc.
      ld_email   = p_email.
      ld_mtitle = p_mtitle.
      ld_format              = p_format.
      ld_attdescription      = p_attdescription.
      ld_attfilename         = p_filename.
      ld_sender_address      = p_sender_address.
      ld_sender_address_type = p_sender_addres_type.
    Fill the document data.
      w_doc_data-doc_size = 1.
    Populate the subject/generic message attributes
      w_doc_data-obj_langu = sy-langu.
      w_doc_data-obj_name  = 'SAPRPT'.
      w_doc_data-obj_descr = ld_mtitle .
      w_doc_data-sensitivty = 'F'.
    Fill the document data and get size of attachment
      CLEAR w_doc_data.
      READ TABLE it_attach INDEX w_cnt.
      w_doc_data-doc_size =
         ( w_cnt - 1 ) * 255 + STRLEN( it_attach ).
      w_doc_data-obj_langu  = sy-langu.
      w_doc_data-obj_name   = 'SAPRPT'.
      w_doc_data-obj_descr  = ld_mtitle.
      w_doc_data-sensitivty = 'F'.
      CLEAR t_attachment.
      REFRESH t_attachment.
      t_attachment[] = pit_attach[].
    Describe the body of the message
      CLEAR t_packing_list.
      REFRESH t_packing_list.
      t_packing_list-transf_bin = space.
      t_packing_list-head_start = 1.
      t_packing_list-head_num = 0.
      t_packing_list-body_start = 1.
      DESCRIBE TABLE it_message LINES t_packing_list-body_num.
      t_packing_list-doc_type = 'RAW'.
      APPEND t_packing_list.
    Create attachment notification
      t_packing_list-transf_bin = 'X'.
      t_packing_list-head_start = 1.
      t_packing_list-head_num   = 1.
      t_packing_list-body_start = 1.
      DESCRIBE TABLE t_attachment LINES t_packing_list-body_num.
      t_packing_list-doc_type   =  ld_format.
      t_packing_list-obj_descr  =  ld_attdescription.
      t_packing_list-obj_name   =  ld_attfilename.
      t_packing_list-doc_size   =  t_packing_list-body_num * 255.
      APPEND t_packing_list.
    Add the recipients email address
      CLEAR t_receivers.
      REFRESH t_receivers.
      t_receivers-receiver = ld_email.
      t_receivers-rec_type = 'U'.
      t_receivers-com_type = 'INT'.
      t_receivers-notif_del = 'X'.
      t_receivers-notif_ndel = 'X'.
      APPEND t_receivers.
      CALL FUNCTION 'SO_DOCUMENT_SEND_API1'
           EXPORTING
                document_data              = w_doc_data
                put_in_outbox              = 'X'
                sender_address             = ld_sender_address
                sender_address_type        = ld_sender_address_type
                commit_work                = 'X'
           IMPORTING
                sent_to_all                = w_sent_all
           TABLES
                packing_list               = t_packing_list
                contents_bin               = t_attachment
                contents_txt               = it_message
                receivers                  = t_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.
    Populate zerror return code
      ld_error = sy-subrc.
    Populate zreceiver return code
      LOOP AT t_receivers.
        ld_receiver = t_receivers-retrn_code.
      ENDLOOP.
    ENDFORM.
    *&      Form  INITIATE_MAIL_EXECUTE_PROGRAM
          Instructs mail send program for SAPCONNECT to send email.
    FORM initiate_mail_execute_program.
      WAIT UP TO 2 SECONDS.
      SUBMIT rsconn01 WITH mode = 'INT'
                    WITH output = 'X'
                    AND RETURN.
    ENDFORM.                    " INITIATE_MAIL_EXECUTE_PROGRAM
    *&      Form  POPULATE_EMAIL_MESSAGE_BODY
           Populate message body text
    form populate_email_message_body.
      REFRESH it_message.
      it_message = 'Please find attached a list test ekpo records'.
      APPEND it_message.
    endform.
    " POPULATE_EMAIL_MESSAGE_BODY
    <b>
    Reward points if this helps,</b>
    Kiran

  • Convert Screen(spool) to PDF file sending mail with attach file

    Hi :
    I'd like convert spool list to pdf and sending file...
    so, I read thread about spool convert to PDF before,
    and know how to convert Spool to PDF file and send mail with attach file.
    but I have a problem.
    my solution as:
    step 1. Call function: "CONVERT_ABAPSPOOLJOB_2_PDF"
    step 2. Call function: "SO_NEW_DOCUMENT_ATT_SEND_API1"
    then, I got a mail with attached PDF file, but the PDF file display limited 255 line.( SO_NEW_DOCUMENT_ATT_SEND_API1 limited)
    I want to showing word is wider that 255.
    and then I find a manual method as:
    After program finished.
    Function Menu -> system -> List -> Send
    use Prog: "Create Document and Send"
    I use this prog sending mail and attached file ,
    PDF file do <b>NOT</b> have 255 word limit !
    finally. my question is, If I want sending mail as Prog: "Create Document and Send", how to do?
    which Function I have to use?...
    Please help me, Thanks!

    Hi,
    Check this sample code of sending spool as attachment to an email address..
    Parameters.
    PARAMETERS: p_email(50) LOWER CASE.
    PARAMETERS: p_spool LIKE tsp01-rqident.
    Data declarations.
    DATA: plist         LIKE sopcklsti1 OCCURS 2 WITH HEADER LINE.
    DATA: document_data LIKE sodocchgi1.
    DATA: so_ali        LIKE soli OCCURS 100 WITH HEADER LINE.
    DATA: real_type     LIKE soodk-objtp.
    DATA: sp_lang       LIKE tst01-dlang.
    DATA: line_size     TYPE i VALUE 255.
    DATA: v_name        LIKE soextreci1-receiver.
    DATA rec_tab        LIKE somlreci1 OCCURS 1 WITH HEADER LINE.
    Get the spool data.
    CALL FUNCTION 'RSPO_RETURN_SPOOLJOB'
         EXPORTING
              rqident              = p_spool
              first_line           = 1
              last_line            = 0
              desired_type         = '   '
         IMPORTING
              real_type            = real_type
              sp_lang              = sp_lang
         TABLES
              buffer               = so_ali
         EXCEPTIONS
              no_such_job          = 1
              job_contains_no_data = 2
              selection_empty      = 3
              no_permission        = 4
              can_not_access       = 5
              read_error           = 6
              type_no_match        = 7
              OTHERS               = 8.
    IF sy-subrc <> 0.
      MESSAGE s208(00) WITH 'Error'.
      LEAVE LIST-PROCESSING.
    ENDIF.
    Prepare the data.
    plist-transf_bin = 'X'.
    plist-head_start = 0.
    plist-head_num = 0.
    plist-body_start = 0.
    plist-body_num = 0.
    plist-doc_type = 'RAW'.
    plist-obj_descr = 'Test ALV'.
    APPEND plist.
    plist-transf_bin = 'X'.
    plist-head_start = 0.
    plist-head_num = 0.
    plist-body_start = 1.
    DESCRIBE TABLE so_ali LINES plist-body_num.
    plist-doc_type = real_type.
    Get the size.
    READ TABLE so_ali INDEX plist-body_num.
    plist-doc_size = ( plist-body_num - 1 ) * line_size
                     + STRLEN( so_ali ).
    APPEND plist.
    Move the receiver address.
    MOVE: p_email  TO rec_tab-receiver,
          'U'      TO rec_tab-rec_type.
    APPEND rec_tab.
    IF NOT sp_lang IS INITIAL.
      document_data-obj_langu = sp_lang.
    ELSE.
      document_data-obj_langu = sy-langu.
    ENDIF.
    v_name = sy-uname.
    Send the email.
    CALL FUNCTION 'SO_DOCUMENT_SEND_API1'
         EXPORTING
              document_data              = document_data
              sender_address             = v_name
              sender_address_type        = 'B'
         TABLES
              packing_list               = plist
              contents_bin               = so_ali
              receivers                  = rec_tab
         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.
    IF sy-subrc <> 0.
      MESSAGE e208(00) WITH 'Error'.
    ENDIF.
    COMMIT WORK.
    Send the email immediately.
    SUBMIT rsconn01
    WITH mode = 'INT'
    AND RETURN.
    Thanks,
    Naren

Maybe you are looking for

  • Netboot Issues

    I am having trouble with netboot.  Clients show the image as the boot disk, but when i restart it flashes the globe, then a circle with a slash through it, then shut off.  The following is the system log: Jan 17 10:59:31 macserver bootpd[27142]: serv

  • Greater Than Function in Script Logic File

    BPC Experts, I've got a pretty simple script logic file to calculate salary amounts, overtime, etc.  The purpose of this logic is for forecasting.  I have two referenced dimensions, TIME and SCENARIO, where TIME.MONTHNUM is equal to its relative mont

  • PLZ HELP: BB TORCH 9800: not able to start ,keep on rebooting after 70% booting. plzzz.. its urgent.

    Hi, i m using bb torch 9800,i installed viber app from bbworld .During instalation, it automaticaly went for restart.n till now it is rebooting everytime after every70% complition. its just like a do loop. 1.i removed battery so many times kept back.

  • Formating Email Body In SO_NEW_DOCUMENT_SEND_API1

    Hai, I am Trying to send an email, from my program , where body of the email is simply hardcoded. I need the email body in the below format with just 2 lines. Hi, line 1 :-Report Generated successfully line 2:- This mail is SAP generated pls dont rep

  • Entry missing in Integration Engine (sxmb_moni)

    Dear all, We have a Synchronous scenario from SAP ECC --PI -- Database. A synchronous outbound proxy is trigeered at EC to send some data to PI and from PI  to Database. We are not able to find an entry in PI-SXMB_MONI.Where as , wer are able to see