Read attachment content in Mapping

Hi,
In PI 7.1 there is one option to read attachment content inside mapping using the api: "com.sap.aii.mapping.api".
To do that in operation mapping we have to check the option "ReadAttachments", to get the attachments in addition to the payload. If I check the Readattachments check box, message goes into the queue and the queue status is running.
Please help me to read the attachment content in mapping.
Thanks & Regards,
Yuga

Hi,
That issue has been solved,the problem is with the syntax.
Now I was able to get the attachment details,but i was not able to read the content of the attachment.
Here is my code:
String Content = "";
String AttachmentID ="";
GlobalContainer globalContainer = container.getGlobalContainer();
InputAttachments inputAttachments = globalContainer.getInputAttachments();
if(inputAttachments.areAttachmentsAvailable())
     Collection<String> CollectionIDs = inputAttachments.getAllContentIds(true);
     Object[] arrayObj = CollectionIDs.toArray();
     int attachmentCount = arrayObj.length;
     for(int i =0;i<attachmentCount;i++)
            AttachmentID =(String) arrayObj<i>;
              Attachment attachments =inputAttachments.getAttachment(AttachmentID);
          Content = Content + attachments.getContent().toString();
return Content;
My requirement is to read all the attachment's.Attachment has XML content, so after reading I need to parse the xml content inside graphical mapping itself is there is any option to do like this.
Thanks & Regards,
Yuga

Similar Messages

  • How to read attachment data in mapping

    Hi,
    In my scenario I receive an XML file with another file as attachment. I need to map both the content of the XML file and the attachment to the target which will be sent as an attachment in a mail.
    I have used JavaMapping and I'm now able to send the mail with the attachment. But i'm not sure how to  read the contents of the attachment in the mapping.
    Any help would be appreciated.
    Thanks,
    Bhargav
    Edited by: Bhargav Srinadh Gundabolu on Feb 12, 2009 10:03 PM

    Hello Bhargav,
    It depends on the version of SAP PI you have,
    Prior to Version 7.1 there was no support to access attachments in a Mapping Programm, so in that
    case the only way to handle it is e.g. to access it in an adapter module (dependent on your scenario).
    In SAP PI 7.1 you can easily access an attachment within a mapping.
    Within a Java mapping program this can be done with the TransformationInput Class, calling the method getInputAttachments() which will give you all available attachments.
    Also see the SAP PI 7.1 javadocs (com.sap.aii.mapping.api):
    https://help.sap.com/javadocs/pi/SP3/xpi/index.html
    In a graphical mapping you can access attachments within a UDF through the GlobalContainer parameter:
    GlobalContainer globalContainer = container.getGlobalContainer();
    InputAttachments inputAttachments = globalContainer.getInputAttachments();
    With best regards
                Sebastian

  • How to read attachment content of activity in crm

    Hi, experts
      I want read a excel content into internal table who is
      attachment of activity in crm, but it is not successful.
      I use the class 'CL_CRM_DOCUMENTS'.
      Thanks you for your help!

    Hi, experts
      This issue is very urgent!
      Who can help me?
      Thanks you very much!

  • How to read the contents of attached files

    Hi,
    I am designing a Form using LiveCycle Designer 8.0
    Scenario:
    User can attach the file through "Attachments" facility provided on Adobe  Reader.
    The requirement is to attach 3 documents and post it to SAP system using Web services.
    I am using the following code(which i got from this forum only) to find the number of files user has attached.
    d = event.target.dataObjects;
    n =  d.length;
    xfa.host.messageBox("Number  of Attachments: "+n);
    //Displaying  the names of the Attached files
    for( i =  0; i < n; i++ )
    xfa.host.messageBox("Name  of the file: "+d[i].name);
    My problem: is how to read the contents of the attached files so that I post it to SAP using Web services
    Thanks in advance!!
    Taha Ahmed

    In order to read the content of the Redo Log files, you should use Logminer Utility
    Please refer to the documentation for more information:
    [Using LogMiner to Analyze Redo Log Files|http://download.oracle.com/docs/cd/B19306_01/server.102/b14215/logminer.htm#SUTIL019]
    Kamran Agayev A. (10g OCP)
    http://kamranagayev.wordpress.com
    [Step by Step install Oracle on Linux and Automate the installation using Shell Script |http://kamranagayev.wordpress.com/2009/05/01/step-by-step-installing-oracle-database-10g-release-2-on-linux-centos-and-automate-the-installation-using-linux-shell-script/]

  • Reading attachment in SOAP message with ABAP mapping

    I am searching an ABAP code to read attachment in sender SOAP message..
    I am using PI 7.3, I can read by java mapping but I get another error after reading the attachment.. So I try to abap mapping..
    That's it..
    Thanx ..

    Hello Mark,
    1. My Soap Sender Adapter, I checked the Keep Attachment option
    2. I am getting the WSDL file from the SOAP Sender Agreement.. it is like http(s)://host:port/XISOAPAdapter/MessageServlet?channel=p:s:c? as you said.
    I used the user-defined function, it works when <inc:Include href="cid:test.jpg" xmlns:inc="http://www.w3.org/2004/08/xop/include" /> is deleted in the message.
    If the coming message includes <inc:Include href="cid:test.jpg" xmlns:inc="http://www.w3.org/2004/08/xop/include" />,
    the <null> error occurs.
    Thanx for your reply..

  • Read the content of a file attached to a document

    Hi,
    I have a requirement to read the content of the file attached to the document and send in the body of the email. The original get stored in the KPRO server. Can anyone suggest how can i read the content of the file stored in the KPRO server. HTTp is used to save the file in KPRO server.
    thanks
    Papiya

    Dear Papiya,
    if I got your problem correctly you are looking for some report to get the originals files from the content server and then send it via e-mail?
    In this case the report DMS_KPRO_READ may be useful for you. You can start this report in transaction SE38. You just need to enter the document data and then all attached originals will be listed with the corresponding PHIO- and LOIO-ID. Further there is also a small grenn download button to get this file on your PC.
    Best regards,
    Christoph
    P.S.: Please reward points for useful information.

  • 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.

  • 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.

  • Issue with reading attachment in sender mail adapter

    Hi, I am working on Email to file scenario, where I have to connect to exchange server and take the attachment of the email (xml file) and save it on to PI server. I have configured sender mail communication channel with following details:
    Protocol: POP3
    Message protocol: XIPAYLOAD
    Mail attributes: keep attachments
    Module:
    1     localejbs/AF_Modules/PayloadSwapBean     Local Enterprise Bean     1
    2     localejbs/sap.com/com.sap.aii.adapter.mail.app/XIMailAdapterBean     Local Enterprise Bean     mail
    1     swap.keyName     Content-Description
    1     swap.keyName     Content-Description
    1     swap.keyValue     attachment,filename="MailAttachment-1.xml"
    1     swap.keyValue     MailAttachment-1
    Also, configured receiver file adapter.
    Since I donu2019t have to read mail content , I havenu2019t created any design components in ESR. I have just refrred to dummy namespace, interface (both sender and receiver). in receiver determination, interface determination, sender agreement and receiver agreements.
    It was working fine, not sure what changes happened. Now I could see the attachment payload in message monitor.
    Under Inbound message->payloads->
    MailMessage ( text/xml;charset=utf-8 )
    MailAttachment-1 ( text/xml;name="****************")
    But the fille that is getting created doesnu2019t have the contents of the attachment (xml file) .  It has some other information, shown below:
    Directory:  ******
    Name:       ********.xml
          =NextPart_002_01CB2C5B.B033B325#
    content-type:text/plain;charset="us-ascii"#
    content-length:30#
    content-transfer-encoding:quoted-printable#
    <<**********.xml>>=20#
          =NextPart_002_01CB2C5B.B033B325#
    content-type:text/html;charset="us-ascii"#
    content-length:#
    content-transfer-encoding:quoted-printable#
          =NextPart_002_01CB2C5B.B033B325  #
    Can you please let me know what is going wrong here.

    using following parameters in module resolved my problem:
    MOdule name                                                                           Type                                                            Module Key
    AF_Modules/PayloadSwapBean                                            Local Enterprise Bean                                      transform sap.com/com.sap.aii.adapter.mail.app/XIMailAdapterBean     Local Enterprise Bean                                      mail
    Module Key                                    Parameter Name                              Parameter value
    transform                                        swap.keyName                                Payload-Name
    transform                                        swap.keyName                                 MailAttachment-1

  • How to read attachment via function module??

    Hi All,
    I have to Read the content of attachment of standard task TS00407864.
    For that i have used a function module SAP_WAPI_GET_ATTACHMENTS.
    and i got this.
    OBJECT_ID                                SOFM      FOL32000000000004RAW340
    DESCRIPT                       Office Document
    SHORTTEXT                      Office Document
    DEF_ATTRIB                     Document Not as per Accounting Stantard
    OBJECT_TYP                     AT
    Now i have to read it in internal table which function i should use and how can i pass the value to it.
    Please Help!
    Regards,
    Purvesh Patel.

    Hi,
    use method cl_swf_utl_convert_por=>convert_bor_to_ibf( ). Also properly defined structures will parse data without need of offset reading/parsing.
    Example:
         data:
             lt_attachment         type  swrtobject,
             lt_wapi_message       type  swr_msgtab,
             ls_docid              type  soentryi1,
             lv_subrc              type  sy-subrc,
             lv_doc_id             type  sofolenti1-doc_id
         field-symbols:
             <ls_attachment>       type  swr_object
         call function 'SAP_WAPI_GET_ATTACHMENTS'
             exporting
                 workitem_id     = me->mv_workitem_id
                 user            = me->mv_username
                 language        = me->mv_language
             importing
                 return_code     = lv_subrc
             tables
                 attachments     = lt_attachment
                 message_struct  = lt_wapi_message
         if ( lv_subrc <> 0 ).
             "! Handle error / messages
         endif.
         loop at       lt_attachment
             assigning <ls_attachment>
             lv_doc_id = cl_swf_utl_convert_por=>convert_bor_to_ibf( i_bor_por = <ls_attachment>-object_id ).
             ls_docid  = lv_doc_id.
         endloop.

  • How to read the content of .msg file type with attachments in SAP crm?

    Hi All,
    Need to develop a RFC FM which will take any BP number as input
    Read the attachments in the BP and identify the attachment which is an email( .msg).
    Identify by the mime type and file extension
    Scan through the email to get the attachments of that email read the content of the
    attachment as a binary file and return that binary file with file name, size
    etc.
    I need to read the data (in binary format) attachment of an attachment of .msg file type .
    I have done till step 2 .
    Please help me on step 3.
    Thanks&Regards,
    Pratap Naik

    Can any one help me on this ?
    Thanks in advance.
    Regards,
    Pratap Naik

  • Help on how to read the content of an XML file from the payload

    I have a receiver channel / mail adapter, that sends e-mails with a XML attachment.
    I’m trying to write a Bean, that should make it possible to rename the attached XML file dynamically.
    In the Bean I want to read the content of the attached XML file, it could be the “order number”.
    The filename should then be “Order number”.XML.
    <u><i>Can anyone help me with how to read the content of the XML file from the payload.</i></u>
    <i><b>Frank</b></i>

    hi,
    check this: http://jakarta.apache.org/poi/

  • How to read the content of this excel file in LV

    Hi could you please let me know how can I read the content of this excel file using the Read From Speardsheet function. It contains text and numbers
    Thanks
    The excel file is attached
    Attachments:
    Datalogging.zip ‏307 KB

    Check attached VI.
    I am not allergic to Kudos, in fact I love Kudos.
     Make your LabVIEW experience more CONVENIENT.
    Attachments:
    ReadFromExcel.vi ‏27 KB

  • Read attachment in the email adapter in PI 7.11

    Hello Experts
    I am working on as scenario where I would be receiving source payload as an attachment in the email, and I need to read the attached payload and map it to the target structure
    please let me know how can i read the attachment as part of the payload
    Thanks
    PR

    Hi,
    have a look at my article:
    The specified item was not found.
    Regards,
    Michal Krawczyk

  • Ifilter does not update Outlook to search for attachment content

    We are using Windows 7 and Outlook 2014, 64 bit
    I installed the iFilter application (9 for 64-bit platforms).
    I can now search attachment content (PDF) using Windows explorer.
    But, i cannot search attachment content in Outlook.
    I did follow instructions on Adobe website in installation and setting up the envirnoment variable.  NOt sure why it works in Windows explorer but not Outlook.
    Does it needs to be installed on the Exchange server as well?

    I would recommend starting over and migrate using your Time Capsule backup however DO NOT do it wirelessly, connect using an Ethernet Connection. If you upgraded to Lion from Snow Leopard then follow the instructions in this video, the kid is annoying but he knows what he's doing. Clean Install Of Snow Leopard video. Once you have installed and updated Snow Leopard then update using the 10.6.8 Update Combo, then log into the Mac App Store and re-install Lion and all it's updates. My guess this is an afternoons work.

Maybe you are looking for

  • How to create a separate sheet listing specific contents of another?

    Here's the context: There's a recording studio complex containing three seperate studios; studio 1, studio 2 and studio 3. I have created a Numbers document with a Main sheet listing ALL of the equipment in the complex. The table in this sheet detail

  • Problem with SapGui Font

    Hi; we are using Suse Linux Enterprise Desktop SP2 10.1, we installed Sapgui and make the connection to SAP a works ok. The only problem is the type of font the SAPGUI use, it is fuzzy, is not clear, we need to change the type of font the SAPGUI use

  • Decimal place in accounting document

    Hi, For my client for all the accounting document decimal place is set to 2. Can any one tell me where is the configuration for setting this decimal place. I guess this is not in general settings for currency. How this decimal place for accounting do

  • Have Window Media Player 11, but with Firefox as browser radio station does not come on

    Have Windows Media Player 11, but the Firefox browser does not allow the radio station to come on. Previously had Internet Explorer as browser which allowed the radio station to come on. What is stopping the station to play now since I changed browse

  • ODBC database access

    Can we access a 'remote' ODBC compliant database through a JSP page being served by Weblogic? I know that the bridge cannot be used as it is not threadsafe but has that changed or is there any other way? Also, can we link in libraries within Weblogic