Email existing file as an attachment

Hi all,
After executing the function 'SO_DOCUMENT_REPOSITORY_MANAGER' I get a dialog box which asks the recipients e-mailaddress.If I enter a correct mailing address everything is fine... Anyone who knows how ik can skip the dialog box en automatically fill the email address? Thanx!
kavitha

Hi,
Check this out. A simple email sending functionality.
INITIALIZATION .
CLASS cl_abap_char_utilities DEFINITION LOAD.
gf_etb = cl_abap_char_utilities=>horizontal_tab. "For horrizontal tab
gf_cr = cl_abap_char_utilities=>cr_lf. "For enter
gf_lf = cl_abap_char_utilities=>newline. "For new line
Declaration
  DATA:    lwa_hd_change TYPE sood1,
           lt_objcont    TYPE STANDARD TABLE OF soli,
           lwa_objcont   TYPE soli,
           lt_receivers  TYPE STANDARD TABLE OF soos1,
           lwa_receivers TYPE soos1 ,
           lt_att_cont   TYPE STANDARD TABLE OF soli,
           lwa_att_cont  TYPE soli,
           lt_packing    TYPE STANDARD TABLE OF soxpl,
           lwa_packing   TYPE soxpl,
           lf_sent       TYPE sonv-flag,
           lf_size       TYPE i.
  CONSTANTS: lc_obj(11)  TYPE c VALUE 'BOMSouthco',
             lc_desc(20) TYPE c VALUE 'BOM Download',
             lc_lang(1)  TYPE c VALUE 'E',
             lc_raw(3)   TYPE c VALUE 'RAW',
             lc_net(1)   TYPE c VALUE 'U',
             lc_mail(4)  TYPE c VALUE 'MAIL',
             lc_xls(3)   TYPE c VALUE 'XLS',
             lc_ext(3)   TYPE c VALUE 'EXT'.
Passing values to the strutures used in SO_OBJECT_SEND function module
  lwa_hd_change-objla      = lc_lang.
  lwa_hd_change-objnam     = lc_obj.
  lwa_hd_change-objdes     = lc_desc.
  lwa_hd_change-objlen     = 255.
  lwa_objcont-line = text-t29.
  APPEND lwa_objcont TO lt_objcont.
  CLEAR lwa_objcont.
  lwa_receivers-recextnam  = text-t31.
  lwa_receivers-recesc     = lc_net.
  lwa_receivers-sndart     = lc_mail.
  lwa_receivers-sndex      = 'X'.
  lwa_receivers-sndpri     = 1.
  lwa_receivers-mailstatus = 'E'.
  APPEND lwa_receivers TO lt_receivers.
  CLEAR lwa_receivers.
  lwa_receivers-recextnam  = text-t30.
  lwa_receivers-recesc     = lc_net.
  lwa_receivers-sndart     = lc_mail.
  lwa_receivers-sndex      = 'X'.
  lwa_receivers-sndpri     = 1.
  lwa_receivers-mailstatus = 'E'.
  APPEND lwa_receivers TO lt_receivers.
  CLEAR lwa_receivers.
Passing values for the attachment file
  LOOP AT gt_output INTO gwa_output.
    CONCATENATE gf_lf  gwa_output-matnr  gf_etb  gwa_output-idnrk  gf_etb
                gwa_output-type   gf_etb  gwa_output-menge   gf_etb
                gwa_output-meins  gf_etb  gwa_output-comp    gf_etb
      INTO lwa_att_cont-line.
    APPEND lwa_att_cont TO lt_att_cont.
    CLEAR lwa_att_cont.
  ENDLOOP.
  CHECK lt_att_cont IS NOT INITIAL.
  DESCRIBE TABLE lt_att_cont LINES lf_size.
  lwa_packing-transf_bin = ' '.
  lwa_packing-head_start = 1.
  lwa_packing-head_num   = 0.
  lwa_packing-body_start = 1.
  lwa_packing-body_num   = lf_size.
  lwa_packing-file_ext   = lc_xls.
  lwa_packing-objlen     = lf_size * 255.
  lwa_packing-objtp      = lc_ext.
  lwa_packing-objdes     = lc_desc.
  lwa_packing-objnam     = lc_obj.
  APPEND lwa_packing TO lt_packing.
  CLEAR lwa_packing.
  CHECK gf_error IS NOT INITIAL. "Check if unix file is written
FM to send email to the intended recipients
  CALL FUNCTION 'SO_OBJECT_SEND'
    EXPORTING
      object_hd_change           = lwa_hd_change
      object_type                = lc_raw
    IMPORTING
      sent_to_all                = lf_sent
    TABLES
      objcont                    = lt_objcont
      receivers                  = lt_receivers
      packing_list               = lt_packing
      att_cont                   = lt_att_cont
    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
      originator_not_exist       = 20
      x_error                    = 21
      OTHERS                     = 22.
  IF sy-subrc = 0.
    MESSAGE s004 WITH text-t34.
  ENDIF.
  COMMIT WORK.
Reward if helpful.
Regards,
Ramya

Similar Messages

  • Email CSV file as an attachment

    Hi,
    I am sending a CSV file as an e-mail attachment. Now, i use the character '0D0A' to get the lines onto a new line. But the extra spaces which are left in the previous lines are coming on to the next line. now there are spaces of the previous line and then the data of the current line follows. But in the internal table, the data is stored correctly, So, SHIFT LEFT is also not working.
    Please reply if there is any solution for the same.
    Thanks in advance,
    Pallavi.

    HI,
    1) I am assuming that you are creating the CSV file on the SAP server and that it is on the WINTEL platform.
    Your code would look something like
    data: ws_record(2000) type c.
    Open dataset filename for output in text mode.
    Loop at itab.
    concatenate itab-field1 itab-field2 itab-field3
      into ws_record separated by ','.
    transfer ws_record to filename.
    endloop itab
    close dataset filename.
    2) Alternatively please check the documentation on the following function module including the example.
    SO_NEW_DOCUMENT_ATT_SEND_API1
    Regards
    David Cooper

  • How to use UTL_SMTP to send email with existing file attachment

    Hello! I am trying to create a pl/sql procedure that lets me send an email and include an existing file to a email address. So far, I found information on how to send a file and create an attachment with information I put in the procedure. This is NOT what I'm trying to do. I'm trying to send an email and include an attachment for a file that already exists. I need the pre-existing file to be sent to the email recipient.
    This is how far I've gotten, but this only allows me to CREATE an attachment with the information I put in it from the procedure. I got it from the following site:
    http://www.orafaq.com/wiki/Send_mail_from_PL/SQL
    DECLARE
       v_From       VARCHAR2(80) := '[email protected]';
       v_Recipient  VARCHAR2(80) := '[email protected]';
       v_Subject    VARCHAR2(80) := 'Weekly Invoice Report';
       v_Mail_Host  VARCHAR2(30) := 'mail.mycompany.com';
       v_Mail_Conn  utl_smtp.Connection;
       crlf         VARCHAR2(2)  := chr(13)||chr(10);
    BEGIN
      v_Mail_Conn := utl_smtp.Open_Connection(v_Mail_Host, 25);
      utl_smtp.Helo(v_Mail_Conn, v_Mail_Host);
      utl_smtp.Mail(v_Mail_Conn, v_From);
      utl_smtp.Rcpt(v_Mail_Conn, v_Recipient);
      utl_smtp.Data(v_Mail_Conn,
        'Date: '   || to_char(sysdate, 'Dy, DD Mon YYYY hh24:mi:ss') || crlf ||
        'From: '   || v_From || crlf ||
        'Subject: '|| v_Subject || crlf ||
        'To: '     || v_Recipient || crlf ||
        'MIME-Version: 1.0'|| crlf ||     -- Use MIME mail standard
        'Content-Type: multipart/mixed;'|| crlf ||
        ' boundary="-----SECBOUND"'|| crlf ||
        crlf ||
        '-------SECBOUND'|| crlf ||
        'Content-Type: text/plain;'|| crlf ||
        'Content-Transfer_Encoding: 7bit'|| crlf ||
        crlf ||
        'This is a test'|| crlf ||     -- Message body
        'of the email attachment'|| crlf ||
        crlf ||
        '-------SECBOUND'|| crlf ||
        'Content-Type: text/plain;'|| crlf ||
        ' name="ap_inv_supplier_cc10.txt"'|| crlf ||
        'Content-Transfer_Encoding: 8bit'|| crlf ||
        'Content-Disposition: attachment;'|| crlf ||
        ' filename="ap_inv_supplier_cc10.txt"'|| crlf ||
        crlf ||
        'TXT,file,attachment'|| crlf ||     -- Content of attachment  (THIS IS MY PROBLEM!  I NEED TO BE ABLE TO ATTACH AN EXISTING FILE, NOT CREATE A NEW ONE)
        crlf ||
        '-------SECBOUND--'               -- End MIME mail
      utl_smtp.Quit(v_mail_conn);
    EXCEPTION
      WHEN utl_smtp.Transient_Error OR utl_smtp.Permanent_Error then
        raise_application_error(-20000, 'Unable to send mail: '||sqlerrm);
    END;
    /

    First, you must create a directory object
    create directory ORALOAD as '/home/ldcgroup/ldccbc/'
    /Study the Prerequisites in the link I posted above, or else you will not be able to read/write files from the above directory object
    "fname" relates to the file name that you read from.
    In the code below, it is also the name of the file that you are attaching.
    Although they can be different!
    l_Output is the contents of the file.
    declare
    vInHandle  utl_file.file_type;
    flen       number;
    bsize      number;
    ex         boolean;
    l_Output   raw(32767);
    fname      varchar2(30) := 'ap_inv_supplier_cc10.txt';
    vSender    varchar2(30) := '[email protected]';
    vRecip     varchar2(30) := '[email protected]';
    vSubj      varchar2(50) := 'Weekly Invoice Report';
    vAttach    varchar2(50) := 'ap_inv_supplier_cc10.txt';
    vMType     varchar2(30) := 'text/plain; charset=us-ascii';
    begin
      utl_file.fgetattr('ORALOAD', fname, ex, flen, bsize);
      vInHandle := utl_file.fopen('ORALOAD', fname, 'R');
      utl_file.get_raw (vInHandle, l_Output);
      utl_file.fclose(vInHandle);
      utl_mail.send_attach_raw(sender       => vSender
                              ,recipients   => vRecip
                              ,subject      => vsubj
                              ,attachment   => l_Output
                              ,att_inline   => false
                              ,att_filename => fname);
    end;
    /

  • Need Help ASAP  my State tax form is in a PDF file and the attachment in my email says Please wait

    Need Help ASAP  my State tax form is in a PDF file and the attachment in my email says Please wait...
    I tried downloading updates like it said to but it still will not display the document.  How do I print the PDF file ASAP

    Can you give us a LOT more info?
    What email client? What version of Reader (I can only assume you even have Reader at this point)?
    Please wait? I'm sure it says more than that, right?
    Have you tried simply saving the PDF (it IS a PDF correct?) to your desktop and opening it from there?
    Did you get this form from the IRS or did it come from somewhere else? If the IRS again, what version of Reader?
    Help us help you.

  • How can I attach a picture to an email in file format not as a picture

    how can I attach a picture to an email in file format,

    Please pardon the intrusion…
    Hi, Leroy! 
    Congratulations on advancing to Level 6!
    At the Water Cooler in the Level 6+ Lounge, we are throwing virtual confetti in celebration of your attainment of Level 6-dom. Would you care to join us at the Water Cooler?
    Towards the bottom of the index on the Apple Support Communities Home Page you soon will find the Lounge link available to you. It should work for you within the next 24 hours if all goes as it should.
    Hope to see you there soon!

  • I have Windows 7, Microsoft Outlook and PSE 13. I have used the "Share photos as embedded images" feature frequently, but today when I went to use it, it wasn't there, only the option to send email with files attached. How do I get back the ability to sen

    I have Windows 7, Microsoft Outlook and PSE 13. I have used the "Share photos as embedded images" feature frequently, but today when I went to use it, it wasn't there, only the option to send email with files attached. How do I get back the ability to send emails with photos embedded. I like adding the frames and backgrounds and I think it's easier for recipients to look at the photos. Thanks for any suggestions of things to try.
    Gail

    I had a similar problem in that my wife's iphone 5 could not send pics with imessage.  Had to set the settings to default to SMS or whatever.  After laboring many hours on the web I coincidentally was on the phone with the internet people to question my internet speed.  They changed the router channel, which is something that I am capable of doing myself.  After that, the pics go over imessage.  My own Iphone didn't have the problem.  We are both latest IOS 7.0.6.

  • Error while opening Excel file sent through attachment in email in sap

    Hi All,
    I have implemented sending email with excel attachment in SAP.
    Email is sent successfully with attachment but when i tried to open it i get first error dialog like " file is not in recognizable format" but after that if i click ok then file gets opened correctly.
    Can you please sort this out.
    Thanks in advance.
    regards
    Ashutosh

    Go to the following link you will get solutions:
    ABAP BASIC

  • How to send PDF file as an attachment in email?

    Hi Folks,
    I have successfully configured SMTP and by now I can successfully send normal text messages along with .TXT files. However, when I am trying to send an email along with .pdf file as an attachment, I am getting the mail in my inbox, but I cannot open the .pdf file! I am getting the following Acrobat error:
    Acrobat could not open 'abc.pdf' because it is either not a supported file type or because the file has been corrupted
    Can any help me in solving this problem?
    Thanks in advance
    Regards,
    Faisal

    Hi Vajha,
    Thanks alot for your kind reply. I also express my apologies for responding to your reply lately.
    I beleive all the links you have sent me are talking about ABAP coding. what I am interested in is,
    is there any configuration that I am missing in SCOT (Basis side)?
    Since I am not an ABAPER, so I carry out these activities.
    Can anyone please answer the following queries of mine:
    1. Can't we send any PDF attachment in a mail from R/3?
    2. Do we have to do it through coding only?
    3. In scot we have option "All formats except fllw". But it does not work for me. Any inputs?
    Thanks in advance.
    Regards,
    Faisal

  • FILE- EMAIL with pdf as an attachment and message body.

    I have a scenario where FILE to EMAIL with PDF as an attachment; I also need to send to have Email body with some text. For this i have tried using Mail Package then i wont be receiving any attachment. If I use both Mail package + Keep attachments i do not see any attachments in mail.
    Let me know  the possible ways that can used in the current scenario where i need to send pdf attachment along with messsage body.
    Thanks in advance,
    nik

    Hi Nik
    To get the customized email body you need to use the Mail package. Keep attachments tab should be selected
    Now sending PDF attachment - Do you need to send data passed by File adapter as pdf attachment or File adapter is reading message other than this attachment.
    Case 1. File adapter send message that you need to send as email attachment. Then using mail package use
    <content_type>application/pdf</content_type>
    you can even add name of the file going as an attachment.
    <content_type>application/pdf;name="filename.pdf"</content_type>
    Secondly you can use the MessageTransformBean at communication channel as an additional standard module.
    Case2: You need to pick file from file adapter as attachment. that is possible only when you use NFS with this file you read as source and attachment has be of same name type eg: you read input.txt then attachment has to be input.pdf
    Thanks
    Gaurav
    Edited by: Gaurav Bhargava on Oct 7, 2008 5:46 AM

  • Sending excel file as an attachment  in email program thru Oracle8i

    I cant send my excel file as an attachment in my email program thru Oracle 8i.
    My excel file i located in my local pc C:\test.xls
    Everything is in my local machine, DB and progams.
    I have read the example of DEMO_MAIL program i am hardly understand it.
    My sample program:
    if (p_file_name is not null) then
    begin_attachment( p_mime_type=>'application/excel',               p_fname=>p_file_name,
         p_transfer_enc=>'base64'
         dbms_lob.createtemporary(l_blob, true);
         dbms_lob.open(l_bfile);
         dbms_lob.fileopen(l_bfile);
         dbms_lob.open(l_blob, dbms_lob.lob_readwrite);
         dbms_lob.loadfromfile(l_blob, l_bfile, dbms_lob.getlength(l_bfile));
         dbms_lob.fileclose(l_bfile);
         dbms_lob.close(l_bfile);
         l_file_len := dbms_lob.getlength(l_blob);
         l_modulo := mod(l_file_len,MAX_BASE64_LINE_WIDTH);
         l_pieces := trunc(l_file_len/MAX_BASE64_LINE_WIDTH);
    while (l_counter < l_pieces)
    loop
    dbms_lob.read(l_blob, l_modulo, l_filepos, l_buffer);
    l_message := utl_raw.concat(l_message, l_buffer);
    write_mb_text(l_message||g_crlf);
    l_filepos := l_counter * MAX_BASE64_LINE_WIDTH + 1;
    l_counter := l_counter + 1;
    end loop;
    if l_modulo <> 0 then
    dbms_lob.read(l_blob, l_modulo, l_filepos, l_buffer);
    l_message := utl_raw.concat(l_message, l_buffer);
    write_mb_text(l_message||g_crlf);
    end if;
    dbms_lob.close(l_blob);
    end_attachment(true);     
    Please help

    I did not receive any error messages when executing the program. It works fine, I received the email nicely but without the attachment.
    Here is the emails I received:
    LOGICAL SPACE USED HAS REACHED ITS TRESHOLD. PLEASE DO NECESSAY TO MAKE MORE ROOM FOR THE SPACE TO EXTEND.
    Tablespace Name Used Size(MB) Free Size(MB)
    SYSTEM 259.953 4.047
    USERS 144.508 55.492
    INDX 31.258 26.742
    -------7D81B75CCC90D2974F7A1CBD
    Content-Type: multipart/mixed; boundary="-----7D81B75CCC90D2974F7A1CBD"
    Content-Disposition: attachment; filename="capacity_13-JAN-05-111226.xls"
    Content-Transfer-Encoding: base64
    -haris

  • To send TXT file as an attachment  through Email

    Hi Experts,
    I am working on requirement where i have to send a txt file as an attachment.
    Could any one suggest me a solution.
    Thanks and Regards,
    Jeswanth Kadali

    Hi,
    Use the function module SO_NEW_DOCUMENT_ATT_SEND_API1.
    We find it convenient to use a custom function module as a wrapper for that.
    Here's the code.
    FUNCTION Z_EMAILS_ATTACH.
    ""Local interface:
    *"  IMPORTING
    *"     VALUE(EMAIL_SUBJECT) LIKE  SODOCCHGI1-OBJ_DESCR
    *"     VALUE(ATTACHMENT_SUBJECT) LIKE  SOPCKLSTI1-OBJ_DESCR OPTIONAL
    *"     VALUE(ATTACHMENT_DOC_TYPE) TYPE  SO_OBJ_TP OPTIONAL
    *"     REFERENCE(ATTACHMENT_HEADER) LIKE  SOLISTI1 STRUCTURE  SOLISTI1
    *"  TABLES
    *"      EMAIL_BODY STRUCTURE  SOLISTI1
    *"      EMAIL_ATTACHMENT STRUCTURE  SOLISTI1 OPTIONAL
    *"      RECEIVERS STRUCTURE  SOMLRECI1
    *"  EXCEPTIONS
    *"      UNKNOWN_COMMUNICATION_TYPE
    *"      ERROR_SENDING_MAIL
    *"      EMPTY_ATTACHMENT
    *"      NO_ATTACHMENT_SUBJECT
    *"      USER_HAS_NO_EMAIL_ADDRESS
    *"      NO_RECEIVERS
    NOTE
    Single-testing when the tables passed to the function have reference
    structure SOLISTI1 meets with a problem.
    Entering non-blank rows into these tables is impossible, it seems.
    This is believed to be because the single testing fails to cope with
    the width of SOLISTI1-LINE [255 char].
    For single testing, use CVDTLINE as the reference structure - it's
    only 132 char.  Then remember to change it back to SOLISTI1...
    Based on Z_EMAIL_ATTACH which sends just one mail.
    08.06.2007  JNM
    DATA: document LIKE sodocchgi1.
    DATA: packlist LIKE sopcklsti1     OCCURS 0 WITH HEADER LINE.
    DATA: contents LIKE solisti1       OCCURS 0 WITH HEADER LINE.
    DATA: header   LIKE solisti1       OCCURS 0 WITH HEADER LINE.
    DATA: RECVLIST LIKE SOMLRECI1      OCCURS 0 WITH HEADER LINE.
    DATA: NEXT_ROW LIKE SY-TABIX.
    DATA: lines    LIKE sy-tabix.
    DATA: LAST_LINE_LENGTH TYPE I.
    DATA: d_doc_size LIKE packlist-doc_size.
    data: email_address type ad_smtpadr.
    A user without an email address cannot email.
    CALL FUNCTION 'Z_USER_EMAIL_ADDRESS'
      EXPORTING
        USER_NAME              = SY-UNAME
      IMPORTING
        EMAIL_ADDRESS          = email_address
      EXCEPTIONS
        UNKNOWN_USER           = 1
        NO_ADDRESS_KEY         = 2
        NO_ADDRESS_DATA        = 3
        NO_EMAIL_ADDRESS       = 4
        OTHERS                 = 5.
    IF SY-SUBRC <> 0.
      MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
              WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4
              raising USER_HAS_NO_EMAIL_ADDRESS.
      ENDIF.
    Receivers?
    describe table receivers lines lines.
    if lines eq 0.
      raise no_receivers.
      endif.
    initialization
    CLEAR: CONTENTS, DOCUMENT, HEADER, PACKLIST, RECVLIST.
    REFRESH: CONTENTS, HEADER, PACKLIST, RECVLIST.
    attachment?
    DESCRIBE TABLE EMAIL_ATTACHMENT LINES LINES.
    IF LINES EQ 0 AND ATTACHMENT_SUBJECT CN SPACE.
      RAISE EMPTY_ATTACHMENT.
      ENDIF.
    IF LINES NE 0 AND ATTACHMENT_SUBJECT CO SPACE.
      RAISE NO_ATTACHMENT_SUBJECT.
      ENDIF.
    email body
    concatenate 'SAP client:'
      sy-host sy-sysid sy-mandt
      into contents separated by space.
    append contents.
    clear contents.
    append contents.
    APPEND LINES OF EMAIL_BODY TO CONTENTS.
    header - row for body
    HEADER = 'BODY HEADER'.
    APPEND HEADER.
    packing list - row for body
    PACKLIST-TRANSF_BIN = SPACE.
    PACKLIST-HEAD_START = 1.
    PACKLIST-HEAD_NUM = 1.
    PACKLIST-BODY_START = 1.
    DESCRIBE TABLE CONTENTS LINES PACKLIST-BODY_NUM.
    NEXT_ROW = 1 + PACKLIST-BODY_NUM.
    *packlist-doc_type = 'EXT'.
    PACKLIST-DOC_TYPE = 'RAW'.
    APPEND PACKLIST.
    IF ATTACHMENT_SUBJECT CN SPACE. " if there's an attachment
    attachment into contents
      APPEND LINES OF EMAIL_ATTACHMENT TO CONTENTS.
      DESCRIBE TABLE EMAIL_ATTACHMENT LINES LINES.
      READ TABLE EMAIL_ATTACHMENT INDEX LINES.
      LAST_LINE_LENGTH = STRLEN( EMAIL_ATTACHMENT ).
    header - attachment
      if attachment_header is initial.
        HEADER = 'ATTACH'.
      else.
        header = attachment_header.
        endif.
      APPEND HEADER.
    packing list - row for attachment
      CLEAR PACKLIST.
      case attachment_doc_type.
       when 'XLS'.
         PACKLIST-TRANSF_BIN = 'X'.
        when others.
          PACKLIST-TRANSF_BIN = SPACE.
        endcase.
      PACKLIST-HEAD_START = 2.
      PACKLIST-HEAD_NUM   = 1.
      PACKLIST-BODY_START = NEXT_ROW.
      if not attachment_doc_type is initial.
        packlist-doc_type   = attachment_doc_type.
      else.
        PACKLIST-DOC_TYPE   = 'RAW'.
        endif.
    packlist-doc_type   = 'EXT'.
      PACKLIST-OBJ_DESCR  = ATTACHMENT_SUBJECT.
      PACKLIST-OBJ_NAME   = 'ATTACHMENT'.
      PACKLIST-BODY_NUM   = LINES.
      D_DOC_SIZE = LAST_LINE_LENGTH + ( 255 * ( LINES - 1 ) ).
      PACKLIST-DOC_SIZE   = D_DOC_SIZE.
      APPEND PACKLIST.
      ENDIF. "attachment
    document
    document-obj_name = 'EMAIL'.
    DOCUMENT-OBJ_DESCR = EMAIL_SUBJECT.
    document-obj_langu = sy-langu.
    document-obj_expdat = sy-datum.
    document-sensitivty = 'F'.
    document-obj_prio = 9.
    document-no_change = 'X'.
    document-priority = 9.
    document-expiry_dat = sy-datum.
    ADD 1 TO: DOCUMENT-OBJ_EXPDAT, DOCUMENT-EXPIRY_DAT.
    DESCRIBE TABLE contents LINES lines.
    D_DOC_SIZE = LAST_LINE_LENGTH + ( 255 * ( LINES - 1 ) ).
    document-doc_size = d_doc_size.
    call the mail function
    CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
         EXPORTING
              document_data              = document
            put_in_outbox              = 'X'
              commit_work                = 'X'
         TABLES
              object_header              = header
              packing_list               = packlist
              contents_txt               = contents
              receivers                  = 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.
    IF SY-SUBRC > 0.
      RAISE ERROR_SENDING_MAIL.
      ENDIF.
    ENDFUNCTION.
    Also remember that the SAP user sending the email must have an email address in the user details, so that SAP has something to put in the "From" field when creating the email.
    That's why we use this:
    FUNCTION Z_USER_EMAIL_ADDRESS.
    ""Local interface:
    *"  IMPORTING
    *"     REFERENCE(USER_NAME) TYPE  SYUNAME DEFAULT SY-UNAME
    *"  EXPORTING
    *"     REFERENCE(EMAIL_ADDRESS) TYPE  AD_SMTPADR
    *"  EXCEPTIONS
    *"      UNKNOWN_USER
    *"      NO_ADDRESS_KEY
    *"      NO_ADDRESS_DATA
    *"      NO_EMAIL_ADDRESS
    tables:
      adr6,
      usr21,
      usr02.
    SAP logon data
    select single *
      from usr02
      where bname = user_name.
    if sy-subrc ne 0.
      message i017(ZREP) with
        'SAP user' user_name 'is unknown'
        raising unknown_user.
      endif.
    SAP user address key
    select single *
      from usr21
      where bname = user_name.
    if sy-subrc ne 0.
      message i017(ZREP) with
        'No address data assigned to SAP user' user_name
        raising no_address_key.
      endif.
    SAP user address
    select single *
      from adr6
      where addrnumber = usr21-addrnumber and
            persnumber = usr21-persnumber.
    if sy-subrc ne 0.
      message i017(ZREP) with
        'No address data found for SAP user' user_name
        raising no_address_data.
      endif.
    email_address = adr6-smtp_addr.
    if email_address is initial.
      message i017(ZREP) with
        'No address data found for SAP user' user_name
        raising no_email_address.
      endif.
    ENDFUNCTION.
    John

  • I'm trying to send a jpeg file as an attachment and not embeded in the body of email

    How do I send a jpeg file as an attachment and not embeded in the body of the email.

    In addition to what etresoft says...
    if you prefer not to see the contents of your attachments embedded in your email...
    Open Terminal in Applications>Utilities and paste this in. Then hit return.
    defaults write com.apple.mail DisableInlineAttachmentViewing 1
    To reverse the setting, change the 1 to a 0.

  • Emailing a jpg or pdf file as an attachment

    I have been emailed both a jpg and pdf file that I want to send attached to an email. The email box pops up with the file in the attachment box, then it won't send.

    Have you upgraded to Yosemite?  Then you could send the attachment using Mail Drop.
    You can use Mail Drop to send files that exceed the maximum size allowed by the provider of your email account. Mail Drop uploads the large attachments to iCloud, where they’re encrypted and stored for up to 30 days.
    If you have an iCloud account and you’re signed in to iCloud when you click Send, Mail automatically sends the attachments using Mail Drop. Mail Drop attachments don’t count against your iCloud storage.
    If you don’t have an iCloud account, or if you’re not signed in, Mail asks you whether to use Mail Drop (select “Don’t ask again for this account” to always use Mail Drop).
    If a recipient uses Mail in OS X Yosemite, the attachments are automatically downloaded and included in your message just like any other attachment. For other recipients, your message includes links for downloading the attachments and their expiration date.
    You can turn Mail Drop on or off for an account. Choose Mail > Preferences, click Accounts, select your account, click Advanced, then select or deselect “Send large attachments with Mail Drop.”

  • I opened a PDFs file that was attached to an email message and now it will not close when I press "Done" as it usually does. Does anyone have a solution to suggest? Thanks.

    I opened a pdf file that was attached to an email message I received and now it will not close when I press "Done" as files usually do. Does anyone have a solution to suggest please? Thanks.

    Try double clicking your home button then force close the stuck PDF by swiping upward. Once you've done that just click the home button again to exit.

  • How can I embed a form on my website and set up a submit button so that when people fill out and click Submit, the filled form will be emailed to me as an attached pdf file?

    How can I embed a form on my website and set up a submit button so that when people fill out and click Submit, the filled form will be emailed to me as an attached pdf file?
    Thank you!

    Hi;
    That is not a workflow that is supported by the Adobe forms solutions at this time.
    Thanks,
    Josh

Maybe you are looking for

  • How to connect mac book air toiphone 4s

    Any help out there, without tethering??

  • Can't adust the volume using keyboard and remote control

    Hi i have macbook Pro like two weeks and a strange thing happened today. I just can not adjust volume up or down using the F3 F4 F5 keys, must go to preferences and adjust manually. The apple remote control does not change the volme neither. When pre

  • PSE 10 default program

    I have installed PSE 10 but it does not show up in the default program list in windows 7. I am unable to right click on an image file and go to open with and select elements 10. Would be grateful for any help.

  • Javac not found

    Hi guys, I downloaded Java 2 Platform, standard edition J2SE 1.4.1 software and installed it. I checked for javac in java/j2re1.4.1_06\bin but could not find it. I cannot compile java programs. If anyone knows about this problem, please lemme know. T

  • InDesign CS6 installation issue

    We used the Adobe Download Manager to get a trial of InDesign CS6. After the download completed the user was prompted to restart the computer. We rebooted the system the Adobe Download Manager did not start again but we found the folder where the bit