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

Similar Messages

  • How to send pdf files from local dir through emails attachments

    I have some pdf documents in some directory, I want to send those pdf's as an attachment throu emails to the concerned person.
    Please let me know how to attach the files and send through email.
    Thanks.

    You are using Forms 4.5, which is a client/server configuration. When you create a pdf file, the file has to be written to a directory that is accessible from your PC. D:\ is acessible, /tmp/ not (that is a directory on some Unix server). If you want to write files to a Unix server, you have to set up Samba and map a drive from your PC to he Unix directory.
    Since you are creating multiple pdf files, you will have to wait until all reports are finished and mail them afterwards. You can create a batch script to mail the files.

  • How to send a file as an attachment using mailx

    Hi
    Can any one tel me how to send a file as an attachment using mailx command in shell script.
    Thanks,
    Suman.

    Wrong forum where to ask such questions.
    Check this one link:
    http://www.unix.com/shell-programming-scripting/18370-sending-email-text-attachment-using-mailx.html?t=18370#post70254

  • How do I scan a photo to a file and then send the file as an attachment via email.

    How do I scan a photo to a file and then send the file as an attachment  via email.

    All of this depends largely on what printer /software you have, which Email client you use and to some extent which OS you are running.
    Most HP printers have HP Solution Center which is used to set up scanning,choosing where to save,etc. Once a file/photo is scanned and saved to the folder, open the folder.Select the file and at the top of the window should be the option to 'Email'.
    ******Clicking the Thumbs-Up button is a way to say -Thanks!.******
    **Click Accept as Solution on a Reply that solves your issue to help others**

  • How to Sender PDF file as attachment in Payload?

    Hi Experts,
         After I done some of PI scenarios, I'm stuck with one of my requirement... In requirement, "Web service" will send request to "SAP ECC 6" in order to get PO document print out in PDF file by call smartform or any form printing as usual.
         In my understand, I'm using SOAP adapter as sender and RFC adapter in receiver side, in  RFC function, I will call form and generate PDF file by using normal ABAP function, but here, how can I send PDF file as response message of SYNC call from web service.
         I try to search and read some of document and blog, some said I can attach file as Payload attachment, but no clear solution or guide to do so.
        Here is example blog that I found, I really useful
           /people/michal.krawczyk2/blog/2006/04/19/xi-rfc-or-abap-proxy-abap-proxies-with-attachments
        Please suggest me in my case,
    Thanks in advance...
    Cheers,
    Terry

    Hi,
    >>In my understand, I'm using SOAP adapter as sender and RFC adapter in receiver side, in RFC function, I will call form and generate PDF file by using normal ABAP function, but here, how can I send PDF file as response message of SYNC call from web service.
    as per my blog you can attach PDF to a message only if you use abap proxy on ECC and not RFC
    the code is just copy and paste from my blog:
    /people/michal.krawczyk2/blog/2006/04/19/xi-rfc-or-abap-proxy-abap-proxies-with-attachments
    so there is nothing spectacular there
    Regards,
    Michal Krawczyk

  • How to send csv file as an attachment

    Hi,
    I am able to create a csv file in this directory as "test.scv" using utl_file and some select statements.
    Now I need to send this csv file as an attachment in email.
    we have smtp installed on our server.
    Please help me on this .
    Thanks
    Kind Regards

    The first link takes in a filename (this would be the csv file you have already created) so nothing should be hard coded; it's just the parameters you pass in.
    Doing a little more research (from the asktom article I posted previously) links to this [http://www.oracle.com/technology/sample_code/tech/pl_sql/htdocs/Utl_Smtp_Sample.html] which the real gold is at [http://www.oracle.com/technology/sample_code/tech/pl_sql/htdocs/maildemo_sql.txt]:
    with examples how to use it at [http://www.oracle.com/technology/sample_code/tech/pl_sql/htdocs/mailexample_sql.txt].
    To get the attachments working from a PL/sql application you will require one of the packages or a large amount of code.
    here's the coded example for attaching files from the packages listed in maildemo_sql.txt from Oracle's website
    REM Send an email with 2 attachments.
    DECLARE
      conn      utl_smtp.connection;
      req       utl_http.req; 
      resp      utl_http.resp;
      data      RAW(200);
    BEGIN
      conn := demo_mail.begin_mail(
        sender     => 'Me <[email protected]>',
        recipients => 'Someone <[email protected]>',
        subject    => 'Attachment Test',
        mime_type  => demo_mail.MULTIPART_MIME_TYPE);
      demo_mail.attach_text(
        conn      => conn,
        data      => '<h1>Hi! This is a test.</h1>',
        mime_type => 'text/html');
      demo_mail.begin_attachment(
        conn         => conn,
        mime_type    => 'image/gif',
        inline       => TRUE,
        filename     => 'image.gif',
        transfer_enc => 'base64');
      -- In writing Base-64 encoded text following the MIME format below,
      -- the MIME format requires that a long piece of data must be splitted
      -- into multiple lines and each line of encoded data cannot exceed
      -- 80 characters, including the new-line characters. Also, when
      -- splitting the original data into pieces, the length of each chunk
      -- of data before encoding must be a multiple of 3, except for the
      -- last chunk. The constant demo_mail.MAX_BASE64_LINE_WIDTH
      -- (76 / 4 * 3 = 57) is the maximum length (in bytes) of each chunk
      -- of data before encoding.
      req := utl_http.begin_request('http://www.some-company.com/image.gif');
      resp := utl_http.get_response(req);
      BEGIN
        LOOP
          utl_http.read_raw(resp, data, demo_mail.MAX_BASE64_LINE_WIDTH);
          demo_mail.write_raw(
            conn    => conn,
            message => utl_encode.base64_encode(data));
        END LOOP;
      EXCEPTION
        WHEN utl_http.end_of_body THEN
          utl_http.end_response(resp);
      END;
      demo_mail.end_attachment( conn => conn );
      demo_mail.attach_text(
        conn      => conn,
        data      => '<h1>This is a HTML report.</h1>',
        mime_type => 'text/html',
        inline    => FALSE,
        filename  => 'report.htm',
        last      => TRUE);
      demo_mail.end_mail( conn => conn );
    END;
    /Edited by: tanging on Dec 18, 2009 10:58 AM

  • How to send PDF file to XI

    Hi All:
    I need to send <b>pdf</b> file to SAP XI, can I achive it using FILE adapter??
    If not with File adapter then please let me know how I can send it to XI?
    Thanks
    Aditya

    Hey
    do you wnat to do some mapping in XI or simple transfer the file to the receiver system?
    if its simple transfer then do a bypass scenario without any IR objects
    /people/william.li/blog/2006/09/08/how-to-send-any-data-even-binary-through-xi-without-using-the-integration-repository
    Thanx
    Ahmad
    Message was edited by:
            Ahmad

  • Send PDF file as an attachement en an email (only 1 st page send?)

    Hi all !
    I have a requirement to send a spool job as an .PDF attachement via email for my client.
    I was using the FM CONVERT_ABAPSPOOLJOB_2_PDF to convert a spool into a PDF file
    Then Convert PDF from 132 to 255 characters.
    Then I use the following code from the forum to send the attachment to email
    Document information.
              W_DOC_CHNG-OBJ_NAME = 'ATTACHMENT'.
              W_DOC_CHNG-EXPIRY_DAT = SY-DATUM + 10.
              CONCATENATE TEXT-T07 PN-PABRP PN-PABRJ INTO W_DOC_CHNG-OBJ_DESCR separated by space.
              W_DOC_CHNG-SENSITIVTY = 'F'. "Functional object
             W_DOC_CHNG-DOC_SIZE = V_LINES_TXT * 255.
              W_DOC_CHNG-DOC_SIZE = V_LINES_BIN * 255.
    Pack to main body as RAW.
    Obj. to be transported not in binary form
             CLEAR I_OBJPACK-TRANSF_BIN.
              I_OBJPACK-TRANSF_BIN = ''.
    Start line of object header in transport packet
              I_OBJPACK-HEAD_START = 1.
    Number of lines of an object header in object packet
              I_OBJPACK-HEAD_NUM = 0.
    Start line of object contents in an object packet
              I_OBJPACK-BODY_START = 1.
    Number of lines of the object contents in an object packet
              I_OBJPACK-BODY_NUM = V_LINES_TXT.
    Code for document class
              I_OBJPACK-DOC_TYPE = 'RAW'.
              I_OBJPACK-OBJ_NAME = 'ATTACHMENT'.
              APPEND I_OBJPACK.
    Packing as PDF.
              I_OBJPACK-TRANSF_BIN = 'X'.
              I_OBJPACK-HEAD_START = 1.
              I_OBJPACK-HEAD_NUM = 1.
              I_OBJPACK-BODY_START = 1.
              I_OBJPACK-BODY_NUM = V_LINES_BIN.
              I_OBJPACK-DOC_TYPE = 'PDF'.
              I_OBJPACK-OBJ_NAME = 'ATTACHMENT'.
              CONCATENATE 'Remuneration_Statements_' PN-PABRP '_' PN-PABRJ  '.pdf'
              INTO I_OBJPACK-OBJ_DESCR.
              I_OBJPACK-DOC_SIZE = V_LINES_BIN * 255.
              APPEND I_OBJPACK.
              clear I_OBJPACK.
    Document information.
              CLEAR I_RECLIST.
    e-mail receivers.
              read table it_pernr into wa_pernr
                  with key pernr = pernr-pernr binary search.
              if sy-subrc eq 0.
                I_RECLIST-RECEIVER = wa_pernr-usrid.
              endif.
              I_RECLIST-COM_TYPE = 'INT'.                   "Internet Email
    *I_RECLIST-notif_del  = 'X'.
    *I_RECLIST-notif_ndel = 'X'.
              I_RECLIST-EXPRESS = 'X'.
              I_RECLIST-REC_TYPE = 'U'. "Internet address
              APPEND I_RECLIST.
              CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
                  DOCUMENT_DATA                    = W_DOC_CHNG
              PUT_IN_OUTBOX                    = ' '
                  COMMIT_WORK                      = 'X'
            IMPORTING
              SENT_TO_ALL                      =
              NEW_OBJECT_ID                    =
              TABLES
                 PACKING_LIST                     = I_OBJPACK
       OBJECT_HEADER                    = W_OBJHEAD
           CONTENTS_BIN                     = I_OBJBIN
           CONTENTS_TXT                     = I_OBJTXT
      CONTENTS_HEX                     =
      OBJECT_PARA                      =
      OBJECT_PARB                      =
            RECEIVERS                        = I_RECLIST
    The email did succesfully send to the receipents but only the first page of the PDF attachement file was sent not the 2nd page.
    Can any body help ?
    Thanks a lot

    Hi all !
    I have a requirement to send a spool job as an .PDF attachement via email for my client.
    I was using the FM CONVERT_ABAPSPOOLJOB_2_PDF to convert a spool into a PDF file
    Then Convert PDF from 132 to 255 characters.
    Then I use the following code from the forum to send the attachment to email
    Document information.
              W_DOC_CHNG-OBJ_NAME = 'ATTACHMENT'.
              W_DOC_CHNG-EXPIRY_DAT = SY-DATUM + 10.
              CONCATENATE TEXT-T07 PN-PABRP PN-PABRJ INTO W_DOC_CHNG-OBJ_DESCR separated by space.
              W_DOC_CHNG-SENSITIVTY = 'F'. "Functional object
             W_DOC_CHNG-DOC_SIZE = V_LINES_TXT * 255.
              W_DOC_CHNG-DOC_SIZE = V_LINES_BIN * 255.
    Pack to main body as RAW.
    Obj. to be transported not in binary form
             CLEAR I_OBJPACK-TRANSF_BIN.
              I_OBJPACK-TRANSF_BIN = ''.
    Start line of object header in transport packet
              I_OBJPACK-HEAD_START = 1.
    Number of lines of an object header in object packet
              I_OBJPACK-HEAD_NUM = 0.
    Start line of object contents in an object packet
              I_OBJPACK-BODY_START = 1.
    Number of lines of the object contents in an object packet
              I_OBJPACK-BODY_NUM = V_LINES_TXT.
    Code for document class
              I_OBJPACK-DOC_TYPE = 'RAW'.
              I_OBJPACK-OBJ_NAME = 'ATTACHMENT'.
              APPEND I_OBJPACK.
    Packing as PDF.
              I_OBJPACK-TRANSF_BIN = 'X'.
              I_OBJPACK-HEAD_START = 1.
              I_OBJPACK-HEAD_NUM = 1.
              I_OBJPACK-BODY_START = 1.
              I_OBJPACK-BODY_NUM = V_LINES_BIN.
              I_OBJPACK-DOC_TYPE = 'PDF'.
              I_OBJPACK-OBJ_NAME = 'ATTACHMENT'.
              CONCATENATE 'Remuneration_Statements_' PN-PABRP '_' PN-PABRJ  '.pdf'
              INTO I_OBJPACK-OBJ_DESCR.
              I_OBJPACK-DOC_SIZE = V_LINES_BIN * 255.
              APPEND I_OBJPACK.
              clear I_OBJPACK.
    Document information.
              CLEAR I_RECLIST.
    e-mail receivers.
              read table it_pernr into wa_pernr
                  with key pernr = pernr-pernr binary search.
              if sy-subrc eq 0.
                I_RECLIST-RECEIVER = wa_pernr-usrid.
              endif.
              I_RECLIST-COM_TYPE = 'INT'.                   "Internet Email
    *I_RECLIST-notif_del  = 'X'.
    *I_RECLIST-notif_ndel = 'X'.
              I_RECLIST-EXPRESS = 'X'.
              I_RECLIST-REC_TYPE = 'U'. "Internet address
              APPEND I_RECLIST.
              CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
                  DOCUMENT_DATA                    = W_DOC_CHNG
              PUT_IN_OUTBOX                    = ' '
                  COMMIT_WORK                      = 'X'
            IMPORTING
              SENT_TO_ALL                      =
              NEW_OBJECT_ID                    =
              TABLES
                 PACKING_LIST                     = I_OBJPACK
       OBJECT_HEADER                    = W_OBJHEAD
           CONTENTS_BIN                     = I_OBJBIN
           CONTENTS_TXT                     = I_OBJTXT
      CONTENTS_HEX                     =
      OBJECT_PARA                      =
      OBJECT_PARB                      =
            RECEIVERS                        = I_RECLIST
    The email did succesfully send to the receipents but only the first page of the PDF attachement file was sent not the 2nd page.
    Can any body help ?
    Thanks a lot

  • I am unable to send pdf files as an attachment using Adobe Send.

    Adobe Send opens Entourage for my email which I no longer use and is in fact defunct, consequently I keep getting "Error" message from Adobe.
    I want Adobe Send to use Outlook but cannot find how I can make Adobe Send choose Outlook instead of Entourage.
    Please assist.
    Danonj

    I don't know if this is any help I have had a problem where the pdf files were not opening correctly which I think was the problem here. I spent hours of head scratching and have now found out what the problem is. Right click on the Adobe Reader Icon on the desktop. Select properties and then the compatibility tab. You will see the uppermost section in this screen is Compatibility mode. I have Windows 7 and mine was set to Windows XP. I changed that to Windows 7 and now the problem is resolved. In short use the above instructions to check you are using the right compatibility mode for the version of Windows you are using and your troubles should be over!!

  • How  to send text file as an attachment to exteral mail

    hi ,
    Can any one tell me how to send an internal table as a textfile attachment  to the external mail.
    regards
    kishore

    hi,
    i am assuming txt fie attachment means you want notepad attachment
    recently i struggled on this and i achieved success by doing as below
    remember to keep packlist as RAW type like below:
    t_packing_list-doc_type = 'RAW'.
    do like this
    CALL FUNCTION 'SO_SOLITAB_TO_SOLIXTAB'
        EXPORTING
          ip_solitab        = t_attachment[]
       IMPORTING
         EP_SOLIXTAB       = xtext[].
      CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
        EXPORTING
          document_data                    = w_doc_data
         PUT_IN_OUTBOX                    = 'X'
        COMMIT_WORK                      = 'X'
        tables
          packing_list                     = t_packing_list
        OBJECT_HEADER                    =
        CONTENTS_BIN                     = objbin
         CONTENTS_TXT                     = it_message
         CONTENTS_HEX                     = xtext
        OBJECT_PARA                      =
        OBJECT_PARB                      =
          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

  • How to send pdf files to ipad on os x mavericks?

    Hi,
    Before uploading to Mavericks and having ibooks on my iMac I used to manage all my pdf files on iTunes and then put them on my iPad. It was all very simple and the same as music files management.
    Now the tag books was remove from itunes and with ibooks i cannot manage my pdf and send them to my ipad.
    1. I cannot manage the info on the pdfs I put on ibooks like I used to do on iTunes. I cannot change name, author, genre, etc...
    2. I cannot put them on the ibooks of my ipad.
    Thus I will have to stop using ibooks...
    Any ideas?

    Hi,
    the link in your post is broken, the trailing "a" should be removed. The correct URL is: https://discussions.apple.com/docs/DOC-3083
    I followed the instructions there and when navigating to "http://<your local host>/" I  get "It Works". However, when attempting to access my local user directory, I get a 403 Forbidden error:
    Forbidden
    You don't have permission to access /~<short user name>/index.html on this server.
    Of course I replaced <short user name> with my actual short user name. I'd reply there but I don't seem to be able to.
    The other link in your post relates to OS X Server, which I don't have, I'm running plain OS X 10.9.4. Any ideas?

  • How to send PDF file to fax number

    Hi
    I am using
    COLDFUSION 8," I have a  small screen to take the fax number and want to fax the PDF file  to that fax number from my system using  ColdFusion".
    I have no idea to implement this. Any help will be appriciated.
    Thanks

    I think you owe Paul a big ol' beer there, on your behalf he's managed to type "fax coldfusion" into Google.
    Did you even try this yourself? Or did you just want someone else to do it for you? Seriously, I don't know what it is on here lately but enough with everyone being too lazy to do their own jobs.
    Credit to Paul for bothering to reply.

  • 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

  • Sending an input pdf file as an attachement via EMAIL adapter in PI

    Hi XI Experts,
    Kindly request you to help in the below issue:
    I have a File to EMAIL interface in which the file  channel would pick up a file "Test.pdf".
    This file should be sent as an attachment to a number of receipients as it is without any formatting of the content.
    In other words, XI should pick the file and attach it as it is as an EMAIL.
    There is no need of any mapping changes.
    We are giving the receipients during runtime hence, we have done dynamic configuration.
    Kindly suggest how to attach the file as it is in the EMAIL.
    Thank you.
    Regards,
    Subbu

    Hi Subbu,
    Read this guide which explains about sending attachments via email.
    http://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/9e6c7911-0d01-0010-1aa3-8e1bb1551f05
    Regards
    Krish

Maybe you are looking for