Creating a PDF-Mail-Attachment via Abap Mapping possible ?

Hi folks,
I am trying to build a szenario like: Getting an Idoc -> sending it to abap mapping -> map a pdf from smartforms in abap -> map the from/to for the mail payload -> come back from abap mapping -> send it with the mail adapter .
But now I am stuck at the point "coming back from abap mapping", because the pdf -data seems to become unreadable because of conversion. I am using Ixml and trying to attach the create pdf (looks hex-right at that point) by method create_simple_element as content-tag of the mail. But after rendering and coming back out of mapping, it seams that that data is not converted from xstring back in the right way. Can someone give a hint ? Is that way by IXML not possible for data including binary-data ? Have I to go another way?
Thanks in advance
Detlef

> as content-tag of the mail.
Sometimes I have to read the request several times to find the issue:
No you cannot put a binary as part of an XML element.
You can only send a plain binary as payload, so the whole mail would be nothing besides the PDF.
In PI 7.1 you can create also an additional attachment out of mapping, but I do not know if this works for ABAP mapping also.
The whole "I want to send an email with attachment out of PI" topic is not supported from PI development in any way.
So you have to write a lot of code (especially Java code) to achieve this.
> Regarding your opinion. Its based on customer requirements to have central focal point in dezentral landscape.
The PI expert has to advise the customer for the scenarios. That is part of the job.

Similar Messages

  • Problem sending xls file in an attachment via ABAP proxy

    Hello,
    I have in tmp directory a xls file, I tranfer such file to a table, and afterwards I send in an attachment via ABAP proxy, here is the code:
         l_attachment        TYPE REF TO if_ai_attachment,
            lt_attach           TYPE prx_attach,
            l_name              TYPE string,
            lx_string           TYPE xstring,
            l_string            TYPE string,
            l_type              TYPE string,
            des                 TYPE string.
      CLASS cl_ai_factory DEFINITION LOAD.
      DATA:    BEGIN OF itab OCCURS 0,
               raw(255) TYPE x,
             END OF itab.
      DATA: l_controller TYPE REF TO if_ai_posting_controller.
      DATA: it TYPE zhcm_mt_segur_out.
      CREATE OBJECT prxy.
      OPEN DATASET orig FOR INPUT IN binary MODE.
      READ DATASET orig INTO itab-raw.
      WHILE sy-subrc = 0.
        APPEND itab.
        READ DATASET orig INTO itab-raw.
      ENDWHILE.
      CLOSE DATASET orig.
      LOOP AT itab.
        CONCATENATE lx_string itab-raw INTO lx_string in byte mode.
      ENDLOOP.
      L_NAME = 'Segur.xls'.
      L_TYPE = CL_AI_ATTACHMENT=>IF_AI_ATTACHMENT~C_MIMETYPE_EXCEL.
      TRY.
          L_ATTACHMENT =
            CL_AI_FACTORY=>CREATE_ATTACHMENT_FROM_binary(
                      P_DATA = LX_STRING
                      P_TYPE = L_TYPE
                      P_NAME = L_NAME ).
          APPEND L_ATTACHMENT TO LT_ATTACH.
          L_CONTROLLER = CL_AI_FACTORY=>CREATE_CONTROLLER( ).
          L_CONTROLLER->SET_ATTACHMENTS( LT_ATTACH ).
          CALL METHOD PRXY->EXECUTE_ASYNCHRONOUS
            EXPORTING
              CONTROLLER = L_CONTROLLER
              OUTPUT     = IT.
          COMMIT WORK.
        CATCH CX_AI_SYSTEM_FAULT .
          DATA FAULT TYPE REF TO CX_AI_SYSTEM_FAULT .
          CREATE OBJECT FAULT.
          WRITE :/ FAULT->ERRORTEXT.
      ENDTRY.
    I am using a Mail receiver channel, I receive a mail, with to attachments, one .xml and the other one .bin, I save it to my computer and I change the extension to .xls and when I try to open it, the file is not valid and can be opened after being repaired. What Im doing wrong? I would like to receive a valid xls file, what i should change?
    Thanks a lot,
    Luis

    Hi,
    yes I know, I have used the MessageTransformBean module, and the PayloadSwapBean module. But which parameter I should use for leaving only one attachement in the e-mail. I did this configuration:
    1
    localejbs/AF_Modules/MessageTransformBean
    Local Enterprise Bean
    <b>trans</b>
    2
    localejbs/AF_Modules/PayloadSwapBean
    Local Enterprise Bean
    <b>swap</b>
    3
    localejbs/AF_Modules/MessageTransformBean
    Local Enterprise Bean
    <b>trans1</b>
    4
    localejbs/sap.com/com.sap.aii.adapter.mail.app/XIMailAdapterBean
    Local Enterprise Bean
    mail
    <i><b>Module configuration</b></i>
    trans
    Transform.ContentDisposition
    inline
    swap
    swap.keyName
    payload-name
    swap
    swap.keyValue
    Segur
    trans1
    Transform.ContentDescription
    Segur
    trans1
    Transform.ContentDisposition
    attachment;filename="Segur.xls"
    trans1
    Transform.ContentType
    application/vnd.ms-excel;name="Segur.xls"
    In the e-mail I get one attachement without name .xml and another one Segur.xsl, and I want only one attachment, the last one. What I should change in my configuration??
    Best regards,
    Luis

  • BExBroadcasting - manipulate pdf mail-attachment filename

    we are broadcasting BW-reports via BExBroadcaster and generated PDFand sending mail-attachements to some BW-users.
    is there any chance to change or manipulate the filename of these generated PDF mail-attachements ?
    e.g.  shorter filename with lower-case Characters (less than 32 char)

    we are broadcasting BW-reports via BExBroadcaster and generated PDFand sending mail-attachements to some BW-users.
    is there any chance to change or manipulate the filename of these generated PDF mail-attachements ?
    e.g.  shorter filename with lower-case Characters (less than 32 char)

  • Create a PDF as attachment in custom module in mail receiver adapter

    I'm trying to create a PDF attachment to an email using a custom module with the following codes. The attachment was created and sent, but when I tried to open it, I got the following error message: the file cannot be read either because a invalid encoding or the file is damaged.
    Anybody knew if I did anything wrong in the way I'm opening and creating the PDF attachment below?
    // add a new pdf attachment to the message
    FileInputStream fi = new FileInputStream("c:/ftmailxi.pdf");
    byte[] attachmentContent = new byte[fi.available()];
    Payload attachmentPDF = msg.createPayload();
    attachmentPDF.setName("ftmailxi.pdf");
    attachmentPDF.setContentType("application/pdf");
    attachmentPDF.setContent(attachmentContent);
    //adding our this pdf as an attachment
    msg.addAttachment(attachmentPDF);
    //provide the XI message for returning
    inputModuleData.setPrincipalData(msg);

    This will surly help u
    /people/sravya.talanki2/blog/2006/11/28/e-mail-xml-messages-in-pdf-format-from-sap-xi
    Check this out
    Mail with attachment.
    Regards,
    Prateek

  • Add Attachment from ABAP Mapping

    Hi Gurus,
    is it possible to add an attachment during a ABAP mapping? Like it is possible for proxy!
    I want to attach a jpg file during the mapping. I found also class interface CL_MAPPING_ATTACHMENTS with a
    few method e.g. SET_ATTACHMENT but it does not wotk.
    Anyone of you knows some solutions or hinds?
    Thanks in advance.

    HI,
    I found an other solution or lets say I found an error in my interface call. IF_MAPPING_ATTACHMENTS -> set_attachment is working, sorry!!!
      TRY.
          CALL METHOD attachments->set_attachment
            EXPORTING
              content_id   = '1.jpg'
              content_type = if_xms_resource=>mimetype_jpeg
              content      = l_data.
        CATCH cx_xms_system_error .
      ENDTRY.
    The Attachment is in the Payload, but now I get an error from the adapter, when I use file or mail receiver adapter! For a little test I used http receiver and there it is working!?
    "com.sap.engine.interfaces.messaging.api.exception.MessagingException: Could not queue receive for message df9cc710-62c9-85f1-b25f-005056c00008(INBOUND). Reason: java.lang.NullPointerException: while trying to invoke the method com.sap.aii.af.sdk.xi.lang.Binary.getBytes() of an object returned from com.sap.aii.af.sdk.xi.mo.xmb.XMBPayload.getContent() "
    I get it in FILE and EMAIL Adapter!? Do you know the reason? I'm still looking for it.
    Edited by: Michael Kulak on Jul 30, 2010 8:50 PM
    Edited by: Michael Kulak on Jul 30, 2010 9:04 PM

  • Creating a PDF file in webdynpro abap.

    Hi friends,
        Can anybody tell me how to create PDF file in webdynpro abap and how to save and edit, copy etc., whatever you can do through normal pdf file?
    I have checked with the standard application WDR_TEST_ADOBE and WDR_TEST_ADOBE_ONLY. But none of the applications are working...
    Could anyone please suggest me how to do this?
    Regards
    Sireesha.

    Hello Sireesha,
    Good places to start are the online help and tutorials, which you can find here:
    <a href="https://www.sdn.sap.comhttp://www.sdn.sap.comhttp://www.sdn.sap.com/irj/sdn/interactiveforms-elearning">https://www.sdn.sap.comhttp://www.sdn.sap.comhttp://www.sdn.sap.com/irj/sdn/interactiveforms-elearning</a>
    <a href="http://help.sap.com/saphelp_erp2005/helpdata/en/2c/241a427ff6db2ce10000000a1550b0/frameset.htm">http://help.sap.com/saphelp_erp2005/helpdata/en/2c/241a427ff6db2ce10000000a1550b0/frameset.htm</a>
    Best regards,
    Thomas

  • Sending a Mail with an appointment attachment via ABAP

    Hi all,
    I am currently trying to send an Outlook appointment as a .VCS file with
    SO_NEW_DOCUMENT_ATT_SEND_API1 by filling the CONTENTS_BIN parameter with the vcs-file contents.
    The email gets sent but in Outlook there is some weird attachment with no name and Outlook thinks it
    is in .msg format when I do "Save as...". The contents look weird too: every single letter is
    followed by a space and the line-feeds are not like i specified them in the code.
    Here's the code I'm using, any help would be greatly appreciated!
    Thanks in advance
    Marcus
    (The code may look a bit chaotic as I'm trying to change things all the time, hope its useful though)
    DATA: OBJPACK LIKE SOPCKLSTI1 OCCURS 2 WITH HEADER LINE.
    DATA: OBJHEAD LIKE SOLISTI1 OCCURS 1 WITH HEADER LINE.
    DATA: OBJBIN TYPE TABLE OF SOLISTI1, " OCCURS 10 WITH HEADER LINE.
    ls_OBJBIN LIKE LINE OF OBJBIN.
    DATA: RECLIST LIKE SOMLRECI1 OCCURS 5 WITH HEADER LINE.
    DATA: DOC_CHNG LIKE SODOCCHGI1.
    DATA: TAB_LINES LIKE SY-TABIX.
    DATA: OBJTXT LIKE SOLISTI1 OCCURS 0 WITH HEADER LINE,
    RECLIST-RECEIVER = '...'.
    RECLIST-REC_TYPE = 'U'.
    APPEND RECLIST.
    DATA: lv_uuid LIKE SYSUUID-C.
    CALL FUNCTION 'SYSTEM_UUID_C_CREATE'
    IMPORTING
    UUID = lv_uuid
    WRITE: 'BEGIN:VCALENDAR' , cl_abap_char_utilities=>cr_lf TO ls_OBJBIN-LINE.
    APPEND ls_OBJBIN TO OBJBIN.
    WRITE: 'PRODID:-//Microsoft Corporation//Outlook 11.0 MIMEDIR//EN', cl_abap_char_utilities=>cr_lf
    TO ls_OBJBIN-LINE.
    APPEND ls_OBJBIN TO OBJBIN.
    WRITE: 'BEGIN:VEVENT' , cl_abap_char_utilities=>cr_lf TO ls_OBJBIN-LINE.
    APPEND ls_OBJBIN TO OBJBIN.
    WRITE: 'DTSTART:20090430T183000Z' , cl_abap_char_utilities=>cr_lf TO ls_OBJBIN-LINE.
    APPEND ls_OBJBIN TO OBJBIN.
    WRITE: 'DTEND:20090430T190000Z' , cl_abap_char_utilities=>cr_lf TO ls_OBJBIN-LINE.
    APPEND ls_OBJBIN TO OBJBIN.
    WRITE: 'LOCATION;ENCODING=QUOTED-PRINTABLE:Test' , cl_abap_char_utilities=>cr_lf TO
    ls_OBJBIN-LINE.
    APPEND ls_OBJBIN TO OBJBIN.
    WRITE: 'UID:040000008200E00074C5B7101A82E0080000000070011ADA9FD6C70100000000000
    00000100' , cl_abap_char_utilities=>cr_lf TO ls_OBJBIN-LINE.
    APPEND ls_OBJBIN TO OBJBIN.
    WRITE: ' 00000', lv_uuid , cl_abap_char_utilities=>cr_lf TO ls_OBJBIN-LINE.
    APPEND ls_OBJBIN TO OBJBIN.
    WRITE: 'DESCRIPTION;ENCODING=QUOTED-PRINTABLE:=09Marcus Testappointment. =0D=0A' ,
    cl_abap_char_utilities=>cr_lf TO ls_OBJBIN-LINE.
    APP
    END ls_OBJBIN TO OBJBIN.
    WRITE: 'SUMMARY;ENCODING=QUOTED-PRINTABLE:Test-Appointment' ,
    cl_abap_char_utilities=>cr_lf TO ls_OBJBIN-LINE.
    APPEND ls_OBJBIN TO OBJBIN.
    WRITE: 'PRIORITY:3' , cl_abap_char_utilities=>cr_lf TO ls_OBJBIN-LINE.
    APPEND ls_OBJBIN TO OBJBIN.
    WRITE: 'END:VEVENT' , cl_abap_char_utilities=>cr_lf TO ls_OBJBIN-LINE.
    APPEND ls_OBJBIN TO OBJBIN.
    WRITE: 'END:VCALENDAR' , cl_abap_char_utilities=>cr_lf TO ls_OBJBIN-LINE.
    APPEND ls_OBJBIN TO OBJBIN.
    OBJTXT = 'Testcontent for email body'.
    APPEND OBJTXT.
    DOC_CHNG-OBJ_NAME = 'TEST'. " seems to have no effect
    DOC_CHNG-OBJ_DESCR = 'TEST'.
    DESCRIBE TABLE OBJTXT LINES TAB_LINES.
    READ TABLE OBJTXT INDEX TAB_LINES.
    DOC_CHNG-DOC_SIZE = ( TAB_LINES - 1 ) * 255 + STRLEN( OBJTXT ).
    " Mail-Body
    CLEAR OBJPACK-TRANSF_BIN.
    OBJPACK-TRANSF_BIN = SPACE.
    OBJPACK-HEAD_START = 1.
    OBJPACK-HEAD_NUM = 0.
    OBJPACK-BODY_START = 1.
    OBJPACK-BODY_NUM = TAB_LINES.
    OBJPACK-DOC_TYPE = 'RAW'.
    "OBJPACK-DOC_TYPE = 'BIN'.
    APPEND OBJPACK.
    " Now the VCS-file
    CLEAR OBJPACK-TRANSF_BIN.
    OBJPACK-TRANSF_BIN = 'X'.
    OBJPACK-HEAD_START = 1.
    OBJPACK-HEAD_NUM = 0.
    OBJPACK-BODY_START = 1.
    OBJPACK-BODY_NUM = 13 * 255.
    OBJPACK-DOC_TYPE = 'VCS'.
    OBJPACK-OBJ_NAME = 'test'.
    OBJPACK-OBJ_DESCR = 'test'.
    APPEND OBJPACK.
    OBJHEAD-LINE = 'test.vcs'.
    APPEND OBJHEAD.
    OBJHEAD-LINE = 'test2.vcs'. " Just to see if it does anything at all
    APPEND OBJHEAD.
    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.
    Edited by: Marcus Müller on May 14, 2009 1:55 PM
    Edited by: Marcus Müller on May 14, 2009 1:57 PM

    Hi Martin, <br />
    <br />
    sure thing! Here it is:<br />
    <br />
    <br />
    * CL_APPOINTMENT<br />
    INCLUDE cntn01." SAP Forums don't take the "<" ">". Surround the cntn01 with them<br />
    TYPE-pools: SCCON.<br />
    DATA: appointment       TYPE REF TO cl_appointment,<br />
          participant       TYPE scspart,<br />
          address           TYPE swc_object,<br />
          address_container LIKE swcont OCCURS 0 WITH HEADER LINE,<br />
          TEXT              TYPE SO_TXTTAB,<br />
          ls_TEXT           LIKE LINE OF TEXT,<br />
          "TITLE             LIKE scsappt-txt_short,<br />
          location          LIKE scsappt-room,<br />
          rule              TYPE REF TO cl_appointment_rule.<br />
    <br />
    * CL_BCS<br />
    DATA: send_request        TYPE REF TO CL_BCS,<br />
          recipient          TYPE REF TO if_recipient_bcs,<br />
          recipient_mail     TYPE ADR6-SMTP_ADDR,<br />
          sender             TYPE REF TO cl_sapuser_bcs,<br />
          sent_to_all        TYPE os_boolean,<br />
          document           TYPE REF TO CL_DOCUMENT_BCS,<br />
          mail_subject       TYPE SO_OBJ_DES.<br />
    <br />
       CLEAR participant.<br />
       swc_create_object address 'ADDRESS' space.<br />
       swc_set_element address_container 'AddressString' 'receiver AT mail.com'.<br />
       swc_set_element address_container 'TypeId' 'U'.<br />
       swc_set_element address_container 'NoAdradmi' 'X'.<br />
       swc_set_element address_container 'NoIntern' 'X'.<br />
       swc_call_method address 'Create' address_container.<br />
       CHECK sy-subrc = 0.<br />
    *    * get key and type of object<br />
       swc_get_object_key address participant-objkey.<br />
       CHECK sy-subrc = 0.<br />
       swc_get_object_type address participant-objtype.<br />
       CHECK sy-subrc = 0.<br />
       MOVE sccon_part_sndmail_with_ans TO participant-send_mail.<br />
       participant-COMM_MODE = 'INT'.<br />
       appointment->add_participant( participant = participant ).<br />
    <br />
    *    set apointment on top of day entries as an all day event<br />
       appointment->set_view_attributes(<br />
         SHOW_LOCAL  = 'X'<br />
         SHOW_ON_TOP = 'X'<br />
         ).<br />
    <br />
      appointment->set_busy_value( sccon_busy_busy ).<br />
    <br />
      appointment->SET_LOCATION_STRING( 'Office' ).<br />
      appointment->SET_ORGANIZER( SY-UNAME ).<br />
      appointment->set_text( 'How much wood would a woodchuck chuck if a woodchuck could chuck wood?' ).<br />
    <br />
    * Important to set this one to space. Otherwise SAP will send a not user-friendly e-mail <br />
      appointment->save( SEND_INVITATION = SPACE ).<br />
    <br />
    * Now that we have the appointment, we can send a good one for outlook by switching to BCS<br />
      send_request = appointment->CREATE_SEND_REQUEST( ).<br />
      recipient_mail = 'receiver AT mail.com'.<br />
      recipient = cl_cam_address_bcs=>create_internet_address( recipient_mail ).<br />
      send_request->add_recipient( i_recipient  = recipient i_express = 'X').<br />
      sender = cl_sapuser_bcs=>create( sy-uname ).<br />
      send_request->set_sender( i_sender = sender ).<br />
    <br />
    * Change the mail subject<br />
      document ?= send_request->document( ).<br />
      mail_subject = 'My custom subject'.<br />
      document->SET_SUBJECT( mail_subject ).<br />
    <br />
    * Send it to the world \o/<br />
      sent_to_all = send_request->send( i_with_error_screen = 'X' ).<br />
    <br />
      COMMIT WORK AND WAIT.<br />
    <br />
    <br />
    When you finally got it working it seems so simple ;)<br />
    <br />
    Best regards from Germany<br />
    Marcus

  • Using the Mail content and Mail Attachment in the mapping

    Hi,
    I have a requirement in which I need to read a file from the mail server and I am using the sender mail adapter for this. I have to convert the attachment of the mail in to the payload. To do this I am using the payload swap bean and mail transform bean. Now the issue is I have to get the information from both attachment and the mail content and need to map it to the target message. Please let me know how to do this.
    Thanks!
    ~Vaas

    Not sure if there is a staright forward way to achieve this.
    But I can think of a work around for your scenario.
    >>To do this I am using the payload swap bean and mail transform bean.
    Instead of doing it this way, try
    1. Message Transform bean that will transform the payload(content of the mail) to XML.
    2. PayloadSwapBean to switch Payload and Attachment.
    3. Message Transform bean to transform the attachment to XML.
    4. Custom adapter module to read the attachment, contnet and create your own desired XML.
    Alternatively, step 4 could be replaced by a Java mapping doing the same operation.
    Regards
    Jai

  • Envio de e-mail B2B via Abap - erro na visualização do XML

    Boa tarde,
    Em virtude da minha versão (GRC 10.0 e NW 7.11), apenas poderia implementar a solução de B2B dinâmico, caso utilizasse Java Mapping. Como meu conhecimento em Java é pequeno, optei por enviar o e-mail a partir do Abap do GRC.
    O XML que estou gerando está com erro na tag <ns1:Transforms>. As tags acima desta estão ok.
    Comparei com o XML original e os códigos-fontes são EXATAMENTE iguais.
    O erro é "Página XML não pode ser exibida". Na instrução, aparece a seguinte informação: "Não é possível exibir a entrada XML usando a folha de estilos XSL".
    Alguém pode me ajudar?
    Se julgarem que, apesar de meu processo ser de NFe, preciso abrir a thread em outro tópico, basta avisar.
    Obrigado.
    Abraços,
    Flavio.
    Edited by: fgalmeida on Oct 6, 2011 7:09 PM

    Resolvido.
    Olhando o fonte do XML, verifiquei que ao final do arquivo haviam espaços em branco.
    A solução foi passar o tamanho do xstring no parâmetro i_attachment_size do método add_attachment da função cl_document_bcs, conforme abaixo:
    DATA lv_size TYPE so_obj_len.
      lv_size = xstrlen( lv_content_xml ) .
      CALL METHOD document->add_attachment
        EXPORTING
         i_attachment_size    = lv_size
          i_attachment_type    = 'xml'
          i_attachment_subject = 'XML NFe'
          i_att_content_hex    = lt_content_hex.
    Obrigado.
    Flavio.

  • PDF Mail Attachement HypeText Link

    Hello,
    It seems that you can't activate a hypertext link in a pdf document via Iphone Email Reader (3GS/4 ios5.11).
    As i open it in IBooks, the Hypertext Links are activated and do operate.
    Is that "normal" ?
    Thanks for your help,
    Regards,
    Philip.

    Oli,
    I can't find any reference to a similar bug, and I've never seen this before. However, 3.0 is now a desupported version, so the best advice I can give would be to move to 6i, apply the latest patch, and if you still see the issue then contact support.
    Regards,
    Danny

  • Unable to save a mail attachment via applescript

    I am attempting to use the following script as rule in mail to save attachments. It appears to do everything correctly except saving attachments. Advice / help most welcome. Thank you.
    using terms from application "Mail"
              on perform mail action with messages theselectedMessages
                             tell application "Mail"
                                            repeat with theMessage in theselectedMessages
                                                           set senderName to extract name from theMessage's sender
                                                           repeat with theAttachment in theMessage's mail attachments
                                                                          set originalName to name of theAttachment
                                                                          set folder_path to "/Users/xxxxx/Documents/Temp/" & senderName & " - " & originalName
                           set file_path to (folder_path)
                                                                          try
                                save theAttachment in file (file_path)
                                                                          end try
                       end repeat
                                            end repeat
                             end tell
              end perform mail action with messages
    end using terms from

    The saved files need to be uniquely named. See:
    http://www.macosxtips.co.uk/index_files/automatically-save-mail-attachments-usin g-applescript.php
    my latest version:
    (* While this script worked, it didn't run reliably in Tiger 10.4.11.  Mail would crash at randomn times. *)
    using terms from application "Mail"
        on perform mail action with messages theselectedMessages
            display dialog "we have arrived in mail save...." giving up after 4
            try
                tell application "Mail"
                    repeat with theMessage in theselectedMessages
                        set senderName to (extract name from theMessage's sender)
                        repeat with theAttachment in theMessage's mail attachments
                            set originalName to name of theAttachment
                            set oName to originalName as string
                            set sName to senderName as string
                            set folderPath to (path to documents folder) as string
                            display dialog "we have initial class " & class of folderPath & " with " & folderPath giving up after 4
                            set folderPath to folderPath & "Temp:" & sName & " - " & oName
                            display dialog "we have class " & class of folderPath & " with " & folderPath giving up after 4
                            try
                                display dialog "saving " giving up after 4
                                -- Please note the saved files need to have a unique name else you
                                -- will get an error message "NSInternalScriptError"
                                save theAttachment in folderPath
                                display dialog "We saved the file!" giving up after 10
                            on error errorCode
                                display dialog "mail save received an error. " & errorCode
                            end try
                        end repeat
                    end repeat
                end tell
            on error errorCode
                display dialog "mail save app received an error. " & errorCode
            end try
            set rc to 0 -- make sure to return a zero return code
            -- Applescript returns whatever was last set.
        end perform mail action with messages
    end using terms from

  • Create a pdf with no background, is it possible?

    I'm trying to have some t shirts made up for my company, with a simple text on the front.  I used Pages, saved as a pdf then converted the file to a jpeg.  The problem is that when I upload the file I get a white block rather than just the text.  I had assumed that if I didn't have a background there would be, well, no background.  Like when making web sites, right?
    Clearly that isn't the case here and I wondered if anyone knew if it is possible to create a few lines of text in pages and only save the text rather than the page it's printed on.
    I don't have other programs for this or know how to use other programs, like Photoshop or stuff like that, though I do have Word. 
    I can't use the t shirt company's text feature because I have particular line and letter spacing I need.
    Any help would be appreciated, even it's just to tell me it can't be done.
    Thanks!
    Mark

    As Peggy has pointed out jpegs do not have transparent background. A png file will pixelate your text but can have a transparent background.
    Best is to make a transparent background pdf by creating the text to your liking in a TextBox in Pages which by default has a transparent background, then click on the text box and copy it.
    Switch to Preview.app and go command n, then save that Preview file as a pdf.
    That has a transparent background.
    Do Not export or print to pdf from Pages itself, which has a white background behind all objects.
    Peter

  • PDF force download via jsp not possible in IE ??????????????

    Hi guys,
              I am providing a jsp page which when displayed will prompt the user to Open or Save or Cancel on a PDF file. For some reason, the code is not working in Internet Explorer. Its working in Opera, Mozilla, Mozilla Firefox. But not working in IE. However, in my organisation, only IE is used. Therefore its paramount that it works in IE. Pls help me.
              Im attatching the snnipet of code that i am using.
              <%@ page language="java"%>
              <%@ page import="java.io.*"%>
              <%
              File file = new File ("C:\\Documents\\List.pdf");
              response.setContentType ("application/pdf");
              response.setHeader ("Content-disposition", "attachment; filename=List.pdf");
              BufferedInputStream in = new BufferedInputStream(new FileInputStream(file));
              ServletOutputStream outs = response.getOutputStream();
              byte bytes[] = new byte[4096];
              int i = 0;
              try
              while ((i = in.read(bytes,0,4096)) != -1)
              outs.write(bytes,0,i);
              catch (IOException ioe)
              ioe.printStackTrace();
              in.close();
              outs.flush();
              outs.close();
              %>
              The problem is as follows:
              The name of the jpf that forwards the requet to the jsp is DownloadPDFController.jsp and the url in IE comes as http://localhost:8053/downloads/DownloadPDFController.jpf
              Now, when this jpf runs and the control comes to the jsp, the pop-up box comes with three options Open, Save and Cancel. But the name of the file to be saved is not the PDF file but the jpf file that is displaying the file.
              This means that what actually is happening is that , the pop download box is coming with the name DownloadPDFController.jpf. I cant understand why its trying to save the JPF.
              The funny bit is that this happens only in IE and not in any other browser.
              Please help !!
              Thanks guys,
              Nikhil

    Put this at start:
              out.clear();
              if it does not work then... are you using post or get... use Post if you are using get...

  • Create Attachment within Graphical Mapping using UDF

    Hi!
    We want to create an attachment witihn a graphical mapping using an UDF function.
    I use that function:
    public String addAttachment(String filename, String mimeType, String content, Container container) throws StreamTransformationException{
         BASE64Decoder decoder=new BASE64Decoder();
         try {
              GlobalContainer globalContainer = container.getGlobalContainer();
              OutputAttachments outputAttachments = globalContainer.getOutputAttachments();
              Attachment attachments = outputAttachments.create(filename, mimeType,decoder.decodeBuffer(content));
              outputAttachments.setAttachment(attachments);
              return "Adde1: "+filename;
         } catch (Exception e) {
              return e.toString();
    (SDN helped me much in creating that
    This function has no compiling errors, anything workes fine:
    It takes 3 input-parameters, see also: http://help.sap.com/javadocs/pi/SP3/xpi/com/sap/aii/mapping/api/OutputAttachments.html
    filename (ok, more or less contentID)
    mimeType (more or less contentType)
    content: Base64-encoded String which should be set as content
    In my sample I use the following constants for that function:
    filename = "fn1.txt"
    mimeType="application/xml"
    content = "UG9seWZvbiB6d2l0c2NoZXJuZCBhw59lbiBNw6R4Y2hlbnMgVsO2Z2VsIFLDvGJlbiwgSm9naHVydCB1bmQgUXVhcms=" --> cames directly from http://de.wikipedia.org/wiki/Base64
    When using the message, I got this error within SXMB_MONI:
    <SAP:AdditionalText>com.sap.engine.interfaces.messaging.api.exception.MessagingException: Could not queue receive for
    message 0022642d-b106-02df-8e8c-f41c243bd112(INBOUND). Reason: java.lang.NullPointerException: while trying to
    invoke the method com.sap.aii.af.sdk.xi.lang.Binary.getBytes() of an object returned from
    com.sap.aii.af.sdk.xi.mo.xmb.XMBPayload.getContent()</SAP:AdditionalText>
    This looks pretty much the same as Add Attachment from ABAP Mapping but this tread is also not answered.
    Adding attachment from PI level looks also in that direction, again, no answer.
    So, I was wondering if someone has solved such problem?

    Hi Divyesh!
    We did it that way:
    1. Choosing the XML-Mailstructure as Destination as described in Configuring the Receiver Mail Adapter - Advanced Adapter Engine - SAP Library -  Example (XI payload with mail package)
    2. now we have created a UDF for creating the "content"
    public void getContent(String[] text, String[] attFname, String[] attType, String[] attContent, ResultList result, Container container) throws StreamTransformationException{
    // vergleich ob alle att-Arrays selbe anzahl haben
    if (attFname.length!=attType.length || attFname.length!=attContent.length) {
        result.addValue(Integer.parseInt("Fehler: alle Attachment-Eingänge müssen die selbe Anzahl an Elementen haben!"));
        String CRLF = "\r\n";
        String output="This is a multi-part message in MIME format."+CRLF+CRLF+
        "--"+getBoundary(container)+CRLF+
        "Content-Type: text/plain; charset=UTF-8"+CRLF+
        "Content-Disposition: inline" + CRLF + CRLF +
        text[0]+CRLF;
    for (int i=0;i<attFname.length;i++) {
        output+="--"+getBoundary(container)+CRLF+
        "Content-Type: "+attType[i]+"; name="+((char)34)+attFname[i]+((char)34)+CRLF+
        "Content-Disposition: attachment; filename="+((char)34)+attFname[i]+((char)34)+CRLF+
        "Content-Transfer-Encoding: Base64"+CRLF+CRLF+attContent[i]+CRLF;
    output+="--"+getBoundary(container)+CRLF;
    result.addValue(output);
    This UDF is configured as "QUEUE"
    We have configured this input-structure
    The Content itself is allready base64.
    So we can call this mapping and it creates a Multipart-Mail for us.

  • How to run 2 reports to send 1 PDF e-mail attachment instead of 2 e-mails.

    I used 9i Reports to create 2 reports in a PDF format. I run these reports from a 9i form using the web.show_document command. XML is used to send the 2 e-mails with the reports.
    Is there a way I can combine the running of the reports to make one PDF to created 1 e-mail attachment or run the reports at the same time and attach 2 PDF files to 1 e-mail.
    I have no problems running 1 report and sending 1 e-mail attacment!
    This is example of the XML used in creating the e-mail:
    - <destinations>
    - <foreach>
    - <file id="Test" name="REPORT_1.pdf" format="pdf" instance="XXXX">
    <include src="report" />
    </file>
    </foreach>
    - <!-- Send a mail with an attachment
    -->
    - <mail id="ex1" to="&DESNAME" from="&DESNAME" subject="&DESNAME;*;&p_postal_number: was submitted for
    approval on &p_postal_date">
    <body srcType="text">This is to notify you of a new submission that requires an approval before being
    sent to out. Please use the URL link below to review the information as soon as possible.
    https://xxxx.aaaa.sss.com:234/web_html/static.html AAAA Administrator</body>
    - <attach format="pdf" name="Report_1&.pdf" srcType="report">
    <include src="mainSection" />
    </attach>
    </mail>
    </destinations>

    You can use iText to combine two PDF files into one.

Maybe you are looking for