Regarding PDF attachment in Mail

Hi ,
I have requirement like, Generate the XBRL file in to XHTML and convert it to PDF then send to mail as attachement as .pdf file.
I have done upto PDF generating but i am sturck up to send a mail as attachement.
main thing is i am not stored in local,if i do store local the i can manage it but i a not suppose to store in local.
my code look like
  DocumentBuilder builder;
                    try {
                        builder = dbf.newDocumentBuilder();
                    } catch (ParserConfigurationException e) {
                        return returnMsg;
                    //builder.setEntityResolver(new CatalogResolver());
                    Document doc;
                    try {
                        doc = builder.parse(new ByteArrayInputStream(newHTML.toByteArray()));
                    } catch (SAXException e) {
                        return returnMsg;
                    ITextRenderer renderer = new ITextRenderer();          
                    renderer.setDocument(doc, null);
                     outputfile = <<myfile name>>;
                     os= new FileOutputStream(outputfile);
                     renderer.layout();
                    renderer.createPDF(os);
} This code will store in local with specified name.
after this i need sendthe mail as attachement in fly with <<name>.pdf file
i can able send the mail attahement if the file stored in local.
I am using mail.jar and activation.jar files for email functionality.
Could any body help out me on this ?
Thanks,
Madhava
Edited by: EJP on 23/03/2013 14:14: added {noformat}{noformat} tags: please use them.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

Hi Thanks for u'r reply.
so far i am developed the code for email functionality to attache the local stored PDF files as atttache the mail.
here i am struck up to attach the file in mail with out storing the the PDF in local directory.
I am tried in some ways but the some exceptions are getting.since today is week end i am unable to upload those.
Frankly saying the i am excepting the some code samples to read the PDF file after converting the XHTML to PDF.
Thanks,
Madhava

Similar Messages

  • Sending Cheque as PDF attachment in Mail using F110.

    Hi all,
    We have a requirement to send the cheque as as PDF attachment in Mail while printing it through transaction F110.Mail has to be triggered when the payment run is done through F110.Is there any config setting to do this without doing any changes to Print program RFFOUS_C.
    Thanks and Regards
    Kiran

    Hi,
    check below link
    https://www.sdn.sap.com/irj/sdn/wiki?path=/display/snippets/email%2bfrom%2bsap 
    Regards,
    Madhu

  • Sending SAP Script output as a PDF attachment through mail

    Dear Guru,
    I am using SAP 4.0B version, DATABASE Oracle 8i, OS is sun solaris 7.5.
    I want to send SAP script output as a
    PDF attachement through mail.Please suggest a solution.
    Regards,
    Rajesh

    Hi Rajesh,
    In your print program, while calling OPEN_FORM, pass options-TDGETOTF = 'X'. This is used for returning print output in OTF format.
    Then in CLOSE_FORM, get the table OTFDATA returned from the function module. for example
    DATA: OTF_DATA LIKE ITCOO OCCURS 0 WITH HEADER LINE.
        CALL FUNCTION 'CLOSE_FORM'
          IMPORTING
            RESULT  = RESULT
          TABLES
            OTFDATA = OTF_DATA.
    now you can convert this OTF data to PDF using function module CONVERT_OTF
    Then send this data as attachment to a mail using function module SO_NEW_DOCUMENT_ATT_SEND_API1
    Regards,
    Komal.

  • I am unable to open my PDF attachment in mail.

    I cannot open my PDF attachment in mail. I am able to on all of my other apple products but not my air. Is there a setting that i might have wrong?

    If it is your own pdf and you are unsure of your password, you are out of luck. You will need to create a new file from the original documents. I suggest using password managers, if you need to create many different documents with different passwords.

  • Pdf attachment from mail to ibooks?

    hmm, how do you 'import' pdf attachment from mail into ibooks 1.1? i hit downloaded on iphone mail, it loaded with img, not even a pdf. flip back to ibooks, hit pdf tab, its not there. am i missing something here?
    thanks guys
    Message was edited by: Tran Hoang Long

    I have the latest version of iTunes with iBooks, and it doesn't have anywhere to drag PDF files into iTunes. Where are you seeing this? I tried every imaginable PDF, include a text document, I printed to PDF from textedit, then dragging it into the pane of grayed out books in iTunes.
    What gives?
    Here's a screenshot:
    http://drp.ly/1eMh5M

  • How to send pdf attachment through mail using Webdynpro-Java

    How can i send the Adobe Interactive Form with data involved as a PDF attachment to mail? using Webdynpro-Java.
    Is there any Adobe API or jar file for generating pdf?
    Helpful answer is highly appreciable and rewarded with points.!

    Hi Sankar,
    try [Offline Interactive PDF Form Using E-Mail|/docs/DOC-8061#49]
    Michal

  • Naming of the PDF attachment when mailing from Bursting engine

    Hi,
    We have a xml publisher report for which we have implemented Bursting Engine to archive the and burst the PDF output.
    We have a requirement now to send the PDF output as attachment to external email ids(to suppliers).I am trying to test using e the below control file to send the PDFs as attachments but the name of the PDF attachment in the mail is numeric '3','6','9' etc...
    I would like to know how do we name the PDF output attachment of the bursting engine.
    -------------------------Burst Control File------------------------------------------
    <xapi:requestset xmlns:xapi="http://xmlns.oracle.com/oxp/xapi" type="bursting">
    <xapi:globalData location="stream">
    </xapi:globalData >
    <xapi:request select="/XXX_XMLPUB_ARINV/LIST_G_INVOICES/G_INVOICES">
    <xapi:delivery>
    <xapi:email server="127.0.0.1"
    port="25"
    from="[email protected]"
    reply-to="[email protected]"
    >
    <xapi:message id="123"
    to="${PURCHASE_ORDER_NUM}"
    bcc=""[email protected]""
    attachment="true"
    subject="${TRX_NUMBER}"
    >
    <html><body>test</body></html>
    </xapi:message>
    </xapi:email>
    </xapi:delivery>
    <xapi:document output-type="pdf" delivery="123">
    <xapi:template type="rtf" location="${XMLPUB_RTF_TEMPLATE}" filter=".//G_INVOICES[PRINTING_COUNT='0']">
    </xapi:template>
    </xapi:document>
    </xapi:request>
    </xapi:requestset>
    Thanks,
    Krishnan
    Edited by: Krishnan-Apps on Dec 23, 2009 2:30 AM

    Hi,
    I seriously doubt your control file is a working one. Can you upload your working/correctly formatted file?
    Or check this working sample below. Hope this helps.
    <?xml version="1.0" encoding="UTF-8"?>
    <xapi:requestset xmlns:xapi="http://xmlns.oracle.com/oxp/xapi">
    <xapi:request select="/">
         <xapi:delivery>
           <xapi:email server="xxmail.mail.com" port="25" from="[email protected]" reply-to ="[email protected]">
             <xapi:message id="${TRX_NUMBER}" to="[email protected]" cc="" bcc=""
              attachment="true" content-type="text/html" subject="${TRX_TYPE_NAME} Number ${TRX_NUMBER}">
           </xapi:message>
           </xapi:email>
         </xapi:delivery>
         <xapi:document output="Invoice_Number_${TRX_NUMBER}" output-type="pdf" delivery="${TRX_NUMBER}">
           <xapi:template type="rtf" location="xdo://AR.XXRAXINV_SEL.en.US/?getSource=true" filter="">
           </xapi:template>
         </xapi:document>
    </xapi:request>
    </xapi:requestset>regards,
    Rownald

  • PDF attachment in mail adapter

    Hi
    I am reading mailbox using mail adapter. But i cannot read the PDF attachment in that mail. I use "PayloadSwapBean" in the module, but it is packing the mailbody to the text file, but they is no sign of PDF attachment. How to read the attachment.
    Regards
    Andy

    Hi Anandan,
    You can use Java/ABAP proxies to do this job for you..
    Java Proxy >> will read the mail(with the attachments) with the help of Java APIs and send the message into XI ABAP Proxy >> for this you will have to first convert the attachment into a message and then you can proceed in the regular fashion.
    Not all adapters can process attachments, I'm not sure why you are having trouble with using module processor in the mail adapter. Just check if the service pack that you are using supports this feature.
    If you are on WAS 6.10 and above you can achieve this and there is an excellent weblog by Thomas Jung on this topic at
    /people/thomas.jung3/blog/2004/09/09/receiving-e-mail-and-processing-it-with-abap--version-610-and-higher

  • PDF attachment in mail

    Hi All,
    I am able to send the PDF file in mail attachment, but the problem is the logo is not getting displayed correctly. Pls find my code below
    REPORT  ztestmail.
    DATA: objpack LIKE sopcklsti1 OCCURS  2 WITH HEADER LINE.
    DATA: objhead LIKE solisti1   OCCURS  1 WITH HEADER LINE.
    DATA: objbin  LIKE solisti1   OCCURS 45 WITH HEADER LINE.
    DATA: objtxt  LIKE solisti1   OCCURS 10 WITH HEADER LINE.
    DATA: reclist LIKE somlreci1  OCCURS  5 WITH HEADER LINE.
    DATA: doc_chng LIKE sodocchgi1.
    DATA: tab_lines LIKE sy-tabix.
    DATA : it_lines TYPE STANDARD TABLE OF tline,
           it_line TYPE tline.
    Creating the document to be sent
    doc_chng-obj_name = 'Invoice'.
    doc_chng-obj_descr = 'Invoice'.
    objtxt = 'Invoice as Attachment'.
    APPEND objtxt.
    DESCRIBE TABLE objtxt LINES tab_lines.
    READ TABLE objtxt INDEX tab_lines.
    doc_chng-doc_size = ( tab_lines - 1 ) * 255 + STRLEN( objtxt ).
    Creating the entry for the compressed document
    CLEAR objpack-transf_bin.
    objpack-head_start = 1.
    objpack-head_num   = 0.
    objpack-body_start = 1.
    objpack-body_num   = tab_lines.
    objpack-doc_type   = 'RAW'.
    APPEND objpack.
    CALL FUNCTION 'GUI_UPLOAD'
      EXPORTING
        filename                      = 'U:\PDF\2.PDF'
        filetype                      = 'BIN'
      TABLES
        data_tab                      = it_lines
    EXCEPTIONS
       FILE_OPEN_ERROR               = 1
       FILE_READ_ERROR               = 2
       NO_BATCH                      = 3
       GUI_REFUSE_FILETRANSFER       = 4
       INVALID_TYPE                  = 5
       NO_AUTHORITY                  = 6
       UNKNOWN_ERROR                 = 7
       BAD_DATA_FORMAT               = 8
       HEADER_NOT_ALLOWED            = 9
       SEPARATOR_NOT_ALLOWED         = 10
       HEADER_TOO_LONG               = 11
       UNKNOWN_DP_ERROR              = 12
       ACCESS_DENIED                 = 13
       DP_OUT_OF_MEMORY              = 14
       DISK_FULL                     = 15
       DP_TIMEOUT                    = 16
       OTHERS                        = 17.
    IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    DATA : gd_buffer TYPE string.
    LOOP AT it_lines INTO it_line.
      TRANSLATE it_line USING ' ~'.
      CONCATENATE gd_buffer it_line INTO gd_buffer.
    ENDLOOP.
    TRANSLATE gd_buffer USING '~ '.
    DO.
      objbin = gd_buffer.
      APPEND objbin.
      SHIFT gd_buffer LEFT BY 255 PLACES.
      IF gd_buffer IS INITIAL.
        EXIT.
      ENDIF.
    ENDDO.
    objhead = 'Invoice.PDF'. APPEND objhead.
    Creating the entry for the compressed attachment
    objpack-transf_bin = 'X'.
    objpack-head_start = 1.
    objpack-head_num   = 1.
    objpack-body_start = 1.
    DESCRIBE TABLE objbin LINES tab_lines.
    READ TABLE objbin INDEX tab_lines.
    objpack-doc_size   = tab_lines * 255.
    objpack-body_num   = tab_lines.
    objpack-doc_type   = 'EXT'.
    objpack-obj_name   = 'ATTACHMENT'.
    objpack-obj_descr = 'Reproduction object 138'.
    APPEND objpack..
    Entering names in the distribution list
    reclist-receiver = 'mail address'.
    reclist-rec_type = 'U'.
    APPEND reclist.
    * sending the document
    CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
      EXPORTING
        document_data              = doc_chng
        put_in_outbox              = 'X'
        commit_work                = 'X'
      TABLES
        packing_list               = objpack
        object_header              = objhead
        contents_bin               = objbin
        contents_txt               = objtxt
        receivers                  = reclist
      EXCEPTIONS
        too_many_receivers         = 1
        document_not_sent          = 2
        operation_no_authorization = 4
        OTHERS                     = 99.
    Thanks,
    Raju

    Hi Raj008,
    When you create post or reply, on right hand side all the markups are given...how to format text and all,
    for code to be seen in readable format,
    simply type the lines between  
    <open brace bracket > <the word 'code'> <closing brace bracket>
    program lines
    <open brace bracket > <the word 'code'> <closing brace bracket>
    hope that helps you
    sorry cant actually type the bracket, as it shows in code format
    Please try replying again to 1 of the replies and check on right hand side of the editor.
    Regards,
    Radhika

  • Need to sent alv output as html or as pdf attachment in mail

    +Hello
    I want to send an ALV output as attachement in html or as pdf format. how to do that? line size is greater than 600(nearly 40 fields).
    +please help me in this query.
    Regards
    Guruvayurappan
    Moderator Message: Please search before posting your question. Thread locked.
    Edited by: Suhas Saha on Dec 29, 2011 4:57 PM

    Hi,
    For sending the ALV output as PDF attachment, you can create a spool (proper page size in print parameters) and convert the spool to PDF using the FM CONVERT_ABAPSPOOLJOB_2_PDF and then send the same as attachment in mail.
    For send the data as HTML attachment, try the below FMs
    WWW_ITAB_TO_HTML_HEADERS & WWW_ITAB_TO_HTML_LAYOUT to create the HTML layout
    WWW_ITAB_TO_HTML to create the HTML for the actual data.
    Hope this helps you.
    Regards,
    Sachinkumar Mehta

  • To send the Payload as PDF Attachment in mail in PI 7.1

    Hi All,
    I have to send a file as PDF attachment using a mail adapter. I gave the Content_Type as 'application.pdf'. I am receiving the mail, but I am unable to open the PDF. It says 'Could not open because the type is not supported or unable to decode'. How do I resolve this?
    Thanks,
    Geetha

    Hi,
    You need to perform the conversion usign the PayloadSwapBean in the  Module tab.
    Please refer to the following link
    /people/sravya.talanki2/blog/2006/11/28/e-mail-xml-messages-in-pdf-format-from-sap-xi
    http://help.sap.com/saphelp_nw04/helpdata/en/2e/bf37423cf7ab04e10000000a1550b0/frameset.htm
    http://help.sap.com/saphelp_nw70ehp1/helpdata/en/cd/5af7c0c994e24fb0d0088443513de2/content.htm
    http://help.sap.com/saphelp_nw70ehp1/helpdata/en/57/0b2c4142aef623e10000000a155106/frameset.htm
    hope this helps,
    Regards,
    Bhanu
    Edited by: nanduri bhanu on May 21, 2009 5:21 AM

  • Sending smartform as pdf attachment through mail

    Dear All,
    Can anyone suggest me sample code of how an sap smartform output is sent as pdf attachment to a receipients email address?
    Thanks
    M A

    hi,
    chk this sample code.
    * Internal Table declarations
    DATA: i_otf TYPE itcoo OCCURS 0 WITH HEADER LINE,
          i_tline TYPE TABLE OF tline WITH HEADER LINE,
          i_receivers TYPE TABLE OF somlreci1 WITH HEADER LINE,
          i_record LIKE solisti1 OCCURS 0 WITH HEADER LINE,
    * Objects to send mail.
          i_objpack LIKE sopcklsti1 OCCURS 0 WITH HEADER LINE,
          i_objtxt LIKE solisti1 OCCURS 0 WITH HEADER LINE,
          i_objbin LIKE solisti1 OCCURS 0 WITH HEADER LINE,
          i_reclist LIKE somlreci1 OCCURS 0 WITH HEADER LINE,
    * Work Area declarations
          wa_objhead TYPE soli_tab,
          w_ctrlop TYPE ssfctrlop,
          w_compop TYPE ssfcompop,
          w_return TYPE ssfcrescl,
          wa_doc_chng typE sodocchgi1,
          w_data TYPE sodocchgi1,
          wa_buffer TYPE string,"To convert from 132 to 255
    * Variables declarations
          v_form_name TYPE rs38l_fnam,
          v_len_in LIKE sood-objlen,
          v_len_out LIKE sood-objlen,
          v_len_outn TYPE i,
          v_lines_txt TYPE i,
          v_lines_bin TYPE i.
    call function 'SSF_FUNCTION_MODULE_NAME'
         exporting
              formname           = 'ZZZ_TEST1'
         importing
              fm_name            = v_form_name
         exceptions
              no_form            = 1
              no_function_module = 2
              others             = 3.
    IF sy-subrc <> 0.
      MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
              WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
    ENDIF.
    w_ctrlop-getotf = 'X'.
    w_ctrlop-no_dialog = 'X'.
    w_compop-tdnoprev = 'X'.
    CALL FUNCTION v_form_name
         EXPORTING
              control_parameters = w_ctrlop
              output_options     = w_compop
              user_settings      = 'X'
         IMPORTING
              job_output_info    = w_return
         EXCEPTIONS
              formatting_error   = 1
              internal_error     = 2
              send_error         = 3
              user_canceled      = 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.
    ENDIF.
    i_otf[] = w_return-otfdata[].
    call function 'CONVERT_OTF'
           EXPORTING
                format                = 'PDF'
                max_linewidth         = 132
           IMPORTING
                bin_filesize          = v_len_in
           TABLES
                otf                   = i_otf
                lines                 = i_tline
           EXCEPTIONS
                err_max_linewidth     = 1
                err_format            = 2
                err_conv_not_possible = 3
                others                = 4.
    *   Fehlerhandling
      if sy-subrc <> 0.
      endif.
      loop at i_tline.
        translate i_tline using '~'.
        concatenate wa_buffer i_tline into wa_buffer.
      endloop.
      translate wa_buffer using '~'.
      do.
        i_record = wa_buffer.
        append i_record.
        shift wa_buffer left by 255 places.
        if wa_buffer is initial.
          exit.
        endif.
      enddo.
    * Attachment
      refresh:
        i_reclist,
        i_objtxt,
        i_objbin,
        i_objpack.
      clear wa_objhead.
      i_objbin[] = i_record[].
    ******* Create Message Body
    **** Title and Description
      i_objtxt = 'test with pdf-Attachment!'.
      append i_objtxt.
      describe table i_objtxt lines v_lines_txt.
      read table i_objtxt index v_lines_txt.
      wa_doc_chng-obj_name = 'smartform'.
      wa_doc_chng-expiry_dat = sy-datum + 10.
      wa_doc_chng-obj_descr = 'smartform'.
      wa_doc_chng-sensitivty = 'F'.
      wa_doc_chng-doc_size = v_lines_txt * 255.
    **** Main Text
    *  wa_doc_chng-doc_size = ( v_lines_txt - 1 ) * 255 + strlen( i_objtxt )
      clear i_objpack-transf_bin.
      i_objpack-head_start = 1.
      i_objpack-head_num = 0.
      i_objpack-body_start = 1.
      i_objpack-body_num = v_lines_txt.
      i_objpack-doc_type = 'RAW'.
      append i_objpack.
    **** Attachment
    * (pdf-Attachment)
      i_objpack-transf_bin = 'X'.
      i_objpack-head_start = 1.
      i_objpack-head_num = 0.
      i_objpack-body_start = 1.
    * Länge des Attachment ermitteln
      describe table i_objbin lines v_lines_bin.
      read table i_objbin index v_lines_bin.
      i_objpack-doc_size =  v_lines_bin * 255 .
      i_objpack-body_num = v_lines_bin.
      i_objpack-doc_type = 'PDF'.
      i_objpack-obj_name = 'smart'.
      i_objpack-obj_descr = 'test'.
      append i_objpack.
      clear i_reclist.
      i_reclist-receiver = '[email protected]'.
      i_reclist-rec_type = 'U'.
      append i_reclist.
        call function 'SO_NEW_DOCUMENT_ATT_SEND_API1'
             EXPORTING
                  document_data              = wa_doc_chng
                  put_in_outbox              = 'X'
             TABLES
                  packing_list               = i_objpack
                  object_header              = wa_objhead
                  CONTENTS_BIN               = i_objbin
                  contents_txt               = i_objtxt
                  receivers                  = i_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.
    Regards
    Anver

  • My Form generate no pdf attachment in mail

    Hello all.
    I as newbe have designed an form in livecycle 8.
    My problem is that as i submit by mail i get no warning wich emailclient has te be used.
    But my hotmail wil start up and the form will amke a email with everting in it exept te pdf attachement.
    I did try everting what i could find here on the forum but noting works.
    Olso with a other form in PDF what i not designed, works evertyting well.
    Please help.
    Marcel

    Hello all.
    I as newbe have designed an form in livecycle 8.
    My problem is that as i submit by mail i get no warning wich emailclient has te be used.
    But my hotmail wil start up and the form will amke a email with everting in it exept te pdf attachement.
    I did try everting what i could find here on the forum but noting works.
    Olso with a other form in PDF what i not designed, works evertyting well.
    Please help.
    Marcel

  • Sending PDF attachment in mail

    My requirement is to send PDF as attachment in mail. Also require to password protect it. I've searced a lot in the forums and found many threads, but no solid solution... Has anyone worked on it lately, and found any solution? Thanks in advance.

    Hi,
    use this FM 'SO_NEW_DOCUMENT_ATT_SEND_API1'. and pass the required values.
    z_send_email_fax_global
    FUNCTION-POOL z_gfaian_mail_fax. "MESSAGE-ID ..
    WORK TABLE AREAS
    TABLES: tsp01.
    INTERNAL TABLES
    DATA: lt_rec_tab LIKE STANDARD TABLE OF soos1 WITH HEADER LINE,
    lt_note_text LIKE STANDARD TABLE OF soli WITH HEADER LINE,
    lt_attachments LIKE STANDARD TABLE OF sood5 WITH HEADER LINE.
    DATA: lt_objcont LIKE STANDARD TABLE OF soli WITH HEADER LINE,
    lt_objhead LIKE STANDARD TABLE OF soli WITH HEADER LINE.
    DATA: pdf_format LIKE STANDARD TABLE OF tline WITH HEADER LINE.
    TYPES: BEGIN OF y_files,
    file(60) TYPE c,
    END OF y_files.
    DATA: lt_files TYPE STANDARD TABLE OF y_files WITH HEADER LINE.
    DATA: l_objcont LIKE soli OCCURS 0 WITH HEADER LINE.
    DATA: l_objhead LIKE soli OCCURS 0 WITH HEADER LINE.
    STRUCTURES
    DATA: folder_id LIKE soodk,
    object_id LIKE soodk,
    link_folder_id LIKE soodk,
    g_document LIKE sood4,
    g_header_data LIKE sood2,
    g_folmem_data LIKE sofm2,
    g_header_data LIKE sood2,
    g_receive_data LIKE soos6,
    g_ref_document LIKE sood4,
    g_new_parent LIKE soodk,
    l_folder_id LIKE sofdk,
    v_email(50).
    DATA: hd_dat like sood1.
    VARIABLES
    DATA: client LIKE tst01-dclient,
    name LIKE tst01-dname,
    objtype LIKE rststype-type,
    type LIKE rststype-type.
    DATA: numbytes TYPE i,
    arc_idx LIKE toa_dara,
    pdfspoolid LIKE tsp01-rqident,
    jobname LIKE tbtcjob-jobname,
    jobcount LIKE tbtcjob-jobcount,
    is_otf.
    DATA: outbox_flag LIKE sonv-flag VALUE 'X',
    store_flag LIKE sonv-flag,
    delete_flag LIKE sonv-flag,
    owner LIKE soud-usrnam,
    on LIKE sonv-flag VALUE 'X',
    sent_to_all LIKE sonv-flag,
    g_authority LIKE sofa-usracc,
    w_objdes LIKE sood4-objdes.
    DATA: c_file LIKE rlgrap-filename,
    n_spool(6) TYPE n.
    DATA: cancel.
    DATA: desired_type LIKE sood-objtp,
    real_type LIKE sood-objtp,
    attach_type LIKE sood-objtp,
    otf LIKE sood-objtp VALUE 'OTF', " SAPscript Ausgabeformat
    ali LIKE sood-objtp VALUE 'ALI'. " ABAP lists
    CONSTANTS
    CONSTANTS: ou_fol LIKE sofh-folrg VALUE 'O',
    c_objtp LIKE g_document-objtp VALUE 'RAW',
    c_file_ext LIKE g_document-file_ext VALUE 'TXT'.
    =================================================================================
    z_send_email_fax2
    FUNCTION z_faian_mail_fax2.
    ""Interface local:
    *" IMPORTING
    *" REFERENCE(SRC_SPOOLID) LIKE TSP01-RQIDENT
    *" REFERENCE(FAX_MAIL_NUMBER) TYPE SO_NAME
    *" REFERENCE(HEADER_MAIL) TYPE SO_OBJ_DES
    *" REFERENCE(OBJECT_TYPE) TYPE SO_ESCAPE
    *" TABLES
    *" LT_BODY_EMAIL STRUCTURE SOLI
    *" EXCEPTIONS
    *" ERR_NO_ABAP_SPOOLJOB
    Fist part: Verify if the spool really exists
    SELECT SINGLE * FROM tsp01 WHERE rqident = src_spoolid.
    IF sy-subrc NE 0.
    RAISE err_no_abap_spooljob. "doesn't exist
    ELSE.
    client = tsp01-rqclient.
    name = tsp01-rqo1name.
    CALL FUNCTION 'RSTS_GET_ATTRIBUTES'
    EXPORTING
    authority = 'SP01'
    client = client
    name = name
    part = 1
    IMPORTING
    type = type
    objtype = objtype
    EXCEPTIONS
    fb_error = 1
    fb_rsts_other = 2
    no_object = 3
    no_permission = 4
    OTHERS = 5.
    IF objtype(3) = 'OTF'.
    desired_type = otf.
    ELSE.
    desired_type = ali.
    ENDIF.
    CALL FUNCTION 'RSPO_RETURN_SPOOLJOB'
    EXPORTING
    rqident = src_spoolid
    desired_type = desired_type
    IMPORTING
    real_type = real_type
    TABLES
    buffer = l_objcont
    EXCEPTIONS
    no_such_job = 14
    type_no_match = 94
    job_contains_no_data = 54
    no_permission = 21
    can_not_access = 21
    read_error = 54.
    IF sy-subrc EQ 0.
    attach_type = real_type.
    ENDIF.
    CALL FUNCTION 'SO_FOLDER_ROOT_ID_GET'
    EXPORTING
    owner = sy-uname
    region = ou_fol
    IMPORTING
    folder_id = l_folder_id
    EXCEPTIONS
    OTHERS = 5.
    fill out informations about the header of the email
    CLEAR: g_document.
    g_document-foltp = l_folder_id-foltp.
    g_document-folyr = l_folder_id-folyr.
    g_document-folno = l_folder_id-folno.
    g_document-objtp = c_objtp.
    g_document-objdes = header_mail.
    g_document-file_ext = c_file_ext.
    g_header_data-objdes = header_mail.
    CALL FUNCTION 'SO_DOCUMENT_REPOSITORY_MANAGER'
    EXPORTING
    method = 'SAVE'
    office_user = sy-uname
    IMPORTING
    authority = g_authority
    TABLES
    objcont = lt_body_email
    attachments = lt_attachments
    CHANGING
    document = g_document
    header_data = g_header_data
    EXCEPTIONS
    OTHERS = 1.
    folder_id-objtp = l_folder_id-foltp.
    folder_id-objyr = l_folder_id-folyr.
    folder_id-objno = l_folder_id-folno.
    object_id-objtp = c_objtp.
    object_id-objyr = g_document-objyr.
    object_id-objno = g_document-objno.
    link_folder_id-objtp = l_folder_id-foltp.
    link_folder_id-objyr = l_folder_id-folyr.
    link_folder_id-objno = l_folder_id-folno.
    REFRESH lt_rec_tab.
    CLEAR lt_rec_tab.
    lt_rec_tab-sel = 'X'.
    lt_rec_tab-recesc = object_type. "This field for FAX/MAIL
    lt_rec_tab-recnam = 'U-'.
    lt_rec_tab-deliver = 'X'.
    lt_rec_tab-not_deli = 'X'.
    lt_rec_tab-read = 'X'.
    lt_rec_tab-mailstatus = 'E'.
    lt_rec_tab-adr_name = fax_mail_number.
    lt_rec_tab-sortfield = fax_mail_number.
    lt_rec_tab-recextnam = fax_mail_number.
    lt_rec_tab-sortclass = '5'.
    APPEND lt_rec_tab.
    lt_rec_tab-recextnam = fax_mail_number.
    lt_rec_tab-recesc = object_type.
    lt_rec_tab-sndart = 'INT'.
    lt_rec_tab-sndpri = 1.
    APPEND lt_rec_tab.
    lt_files-file = c_file.
    APPEND lt_files.
    begin of insertion by faianf01
    hd_dat-objdes = header_mail.
    CALL FUNCTION 'SO_ATTACHMENT_INSERT'
    EXPORTING
    object_id = object_id
    attach_type = attach_type
    object_hd_change = hd_dat
    owner = sy-uname
    TABLES
    objcont = l_objcont
    objhead = l_objhead
    EXCEPTIONS
    active_user_not_exist = 35
    communication_failure = 71
    object_type_not_exist = 17
    operation_no_authorization = 21
    owner_not_exist = 22
    parameter_error = 23
    substitute_not_active = 31
    substitute_not_defined = 32
    system_failure = 72
    x_error = 1000.
    IF sy-subrc > 0.
    ENDIF.
    end of insertion by faianf01
    send email from SAPOFFICE
    CALL FUNCTION 'SO_OBJECT_SEND'
    EXPORTING
    folder_id = folder_id
    object_id = object_id
    outbox_flag = outbox_flag
    link_folder_id = link_folder_id
    owner = sy-uname
    check_send_authority = 'X'
    TABLES
    receivers = lt_rec_tab
    note_text = lt_note_text
    EXCEPTIONS
    active_user_not_exist = 35
    communication_failure = 71
    component_not_available = 1
    folder_no_authorization = 5
    folder_not_exist = 6
    forwarder_not_exist = 8
    object_no_authorization = 13
    object_not_exist = 14
    object_not_sent = 15
    operation_no_authorization = 21
    owner_not_exist = 22
    parameter_error = 23
    substitute_not_active = 31
    substitute_not_defined = 32
    system_failure = 72
    too_much_receivers = 73
    user_not_exist = 35.
    ENDIF.
    ENDFUNCTION.
    =================================================================================
    z_send_email_fax
    FUNCTION ZCBFS_SEND_MAIL.
    ""Interface local:
    *" IMPORTING
    *" REFERENCE(SRC_SPOOLID) LIKE TSP01-RQIDENT
    *" REFERENCE(HEADER_MAIL) TYPE SO_OBJ_DES
    *" TABLES
    *" LIST_FAX_MAIL_NUMBER STRUCTURE SOLI
    *" EXCEPTIONS
    *" ERR_NO_ABAP_SPOOLJOB
    DATA: vg_achou(1) TYPE n.
    Fist part: Verify if the spool really exists
    vg_achou = 1.
    DO 60 TIMES.
    SELECT SINGLE * FROM tsp01 WHERE rqident = src_spoolid.
    IF sy-subrc IS INITIAL.
    CLEAR vg_achou.
    EXIT.
    ELSE.
    WAIT UP TO 1 SECONDS.
    ENDIF.
    ENDDO.
    IF vg_achou = 1.
    RAISE err_no_abap_spooljob. "doesn't exist
    ENDIF.
    client = tsp01-rqclient.
    name = tsp01-rqo1name.
    CALL FUNCTION 'RSTS_GET_ATTRIBUTES'
    EXPORTING
    authority = 'SP01'
    client = client
    name = name
    part = 1
    IMPORTING
    type = type
    objtype = objtype
    EXCEPTIONS
    fb_error = 1
    fb_rsts_other = 2
    no_object = 3
    no_permission = 4
    OTHERS = 5.
    IF objtype(3) = 'OTF'.
    desired_type = otf.
    ELSE.
    desired_type = ali.
    ENDIF.
    CALL FUNCTION 'RSPO_RETURN_SPOOLJOB'
    EXPORTING
    rqident = src_spoolid
    desired_type = desired_type
    IMPORTING
    real_type = real_type
    TABLES
    buffer = l_objcont
    EXCEPTIONS
    no_such_job = 14
    type_no_match = 94
    job_contains_no_data = 54
    no_permission = 21
    can_not_access = 21
    read_error = 54.
    IF sy-subrc EQ 0.
    attach_type = real_type.
    ENDIF.
    CALL FUNCTION 'SO_FOLDER_ROOT_ID_GET'
    EXPORTING
    owner = sy-uname
    region = ou_fol
    IMPORTING
    folder_id = l_folder_id
    EXCEPTIONS
    OTHERS = 5.
    fill out informations about the header of the email
    CLEAR: g_document.
    g_document-foltp = l_folder_id-foltp.
    g_document-folyr = l_folder_id-folyr.
    g_document-folno = l_folder_id-folno.
    g_document-objtp = c_objtp.
    g_document-objdes = header_mail.
    g_document-file_ext = c_file_ext.
    g_header_data-objdes = header_mail.
    CALL FUNCTION 'SO_DOCUMENT_REPOSITORY_MANAGER'
    EXPORTING
    method = 'SAVE'
    office_user = sy-uname
    IMPORTING
    authority = g_authority
    TABLES
    attachments = lt_attachments
    CHANGING
    document = g_document
    header_data = g_header_data
    EXCEPTIONS
    OTHERS = 1.
    folder_id-objtp = l_folder_id-foltp.
    folder_id-objyr = l_folder_id-folyr.
    folder_id-objno = l_folder_id-folno.
    object_id-objtp = c_objtp.
    object_id-objyr = g_document-objyr.
    object_id-objno = g_document-objno.
    link_folder_id-objtp = l_folder_id-foltp.
    link_folder_id-objyr = l_folder_id-folyr.
    link_folder_id-objno = l_folder_id-folno.
    REFRESH lt_rec_tab.
    LOOP AT LIST_FAX_MAIL_NUMBER.
    lt_rec_tab-recextnam = LIST_FAX_MAIL_NUMBER-LINE.
    lt_rec_tab-recesc = 'U'.
    lt_rec_tab-sndart = 'INT'.
    lt_rec_tab-sndpri = 1.
    APPEND lt_rec_tab.
    ENDLOOP.
    lt_files-file = c_file.
    APPEND lt_files.
    hd_dat-objdes = header_mail.
    CALL FUNCTION 'SO_ATTACHMENT_INSERT'
    EXPORTING
    object_id = object_id
    attach_type = attach_type
    object_hd_change = hd_dat
    owner = sy-uname
    TABLES
    objcont = l_objcont
    objhead = l_objhead
    EXCEPTIONS
    active_user_not_exist = 35
    communication_failure = 71
    object_type_not_exist = 17
    operation_no_authorization = 21
    owner_not_exist = 22
    parameter_error = 23
    substitute_not_active = 31
    substitute_not_defined = 32
    system_failure = 72
    x_error = 1000.
    IF sy-subrc > 0.
    ENDIF.
    send email from SAPOFFICE
    CALL FUNCTION 'SO_OBJECT_SEND'
    EXPORTING
    folder_id = folder_id
    object_id = object_id
    outbox_flag = outbox_flag
    link_folder_id = link_folder_id
    owner = sy-uname
    TABLES
    receivers = lt_rec_tab
    note_text = lt_note_text
    EXCEPTIONS
    active_user_not_exist = 35
    communication_failure = 71
    component_not_available = 1
    folder_no_authorization = 5
    folder_not_exist = 6
    forwarder_not_exist = 8
    object_no_authorization = 13
    object_not_exist = 14
    object_not_sent = 15
    operation_no_authorization = 21
    owner_not_exist = 22
    parameter_error = 23
    substitute_not_active = 31
    substitute_not_defined = 32
    system_failure = 72
    too_much_receivers = 73
    user_not_exist = 35.
    ENDFUNCTION.
    Edited by: katigiri linganna on Jul 31, 2009 8:56 AM

  • PDF attached in Mail changes suffix

    This is a really strange problem. When sending PDF files attached per Mail, the suffix will be automatically changed from .pdf into .pdf0, .pdff and so on. It happens randomly. What can be done here, has someone observed the same issue in his Mails?!

    I have not experienced the problem, but others have. It appears to relate to special characters (such as umlauts) that are used in the filename - combined with a mail format that is text only.
    This post is helpful: http://discussions.apple.com/message.jspa?messageID=7358148#7358148
    Solutions thus appear to be:
    1) Avoid special characters in filenames (not practical in some languages), or
    2) Use HTML elements in every email (the preference alone is not enough), or
    3) Use a program other than Mail for sending emails.
    Cheers,
    Rodney

Maybe you are looking for