Sort incoming XML message

Hi
Is there a standard way in PI to sort the incoming XML message within the message mapping before doing the mapping itself?
The scenario would be an incoming Flat file with header and item data records, and we will be mapping it in PI to create IDOC messages based on the same Header segment. So for the same Header Data I would like to create a single IDOC. But the incoming file would be unsorted, so I would need to sort it first based on the header segment some way.
Ideally, we would like to do all of the mapping in the graphical mapping tool and not use a UDF.
Thanks
Edited by: MxG on Nov 20, 2008 5:04 PM

I already tried Sort, but it doesnt work the way I want.
Say I have inbound XML as
<hdr1>
<hdr2>
<itm1>
<itm2>
<itm3>
it needs to be mapped to an IDOC as
<hdrsegment>
<itmsegment>
I mapped XML header data to IDOC after sorting, and that works fine. The issue comes on assigning the inbound XML Item data to IDOC Item segment. It is creating the correct Number of segments, but when assiging the fields to IDOC fields, it is using unsorted data ie the data as received, not the sorted one which I did for IDOC Node, and for Header fields.
What I really want is to sort the data once, and then use that in the mapping.

Similar Messages

  • Ignore DTD declaration in incoming XML message

    Hi,
    I have an issue where I am receiving an incoming XML message which starts with a DTD declaration.
    This causes an issue with the XML parser step in the mapping because the parser attempts to resolve the DTD location. However this location is external and the PI server cannot access it.
    The location for reference is http://dtd.bibit.com/paymentService_v1.dtd
    Therefore I am investigating options to ignore the DTD declaration or removing it altogether prior to the XML parser step.
    I would hope I could use either XSLT or Java mapping but do not really know where to start.
    Can anyone please provide a method of doing this ? I would prefer to use XSLT but am open to other options.
    I have no control over the DTD declaration as it is supplied by a 3rd party application. 
    Thanks
    Colin.

    Hi Russell,
    The XSLT sample you have provided does not work.
    I still get the message below in the trace file:
    <Trace level="2" type="T">Call XSLT processor with stylsheet BIBIT_PaymentResponse.xsl.</Trace>
      <Trace level="2" type="T">resolveEntity systemId = 'http://dtd.bibit.com/paymentService_v1.dtd' (publicId = '-//Bibit//DTD Bibit PaymentService v1//EN').</Trace>
      <Trace level="3" type="T">Search http://dtd.bibit.com/paymentService_v1.dtd (urn:com-dg-ng:crm:paycardauth, -1) in swcv 703fadc0-858c-11dd-971b-f2400a20801e.</Trace>
      <Trace level="3" type="T">Search http://dtd.bibit.com/paymentService_v1.dtd (-1) in swcv 703fadc0-858c-11dd-971b-f2400a20801e without namespace.</Trace>
      <Trace level="1" type="T">Resource not found: http://dtd.bibit.com/paymentService_v1.dtd Thrown: com.sap.aii.ib.server.mapping.execution.MappingClassNotFoundException: http://dtd.bibit.com/paymentService_v1.dtd at com.sap.aii.ib.server.mapping.execution.InternalMappingFinder.getInputStream(InternalMappingFinder.java:119) at com.sap.aii.ib.server.mapping.execution.InternalMappingFinder.readFile(InternalMappingFinder.java:62) at com.sap.aii.ib.server.mapping.execution.MappingLoader.getResourceAsStream(MappingLoader.java:131) at com.sap.aii.ib.server.mapping.execution.AbstractMappingTransformer$MappingEntityResolver.resolveEntity(AbstractMappingTransformer.java:328) at com.sap.engine.lib.xml.parser.XMLParser.scanDTD(XMLParser.java:1272) at com.sap.engine.lib.xml.parser.XMLParser.scanProlog(XMLParser.java:2804) at com.sap.engine.lib.xml.parser.XMLParser.scanDocument(XMLParser.java:2839) at com.sap.engine.lib.xml.parser.XMLParser.parse0(XMLParser.java:229) at com.sap.engine.lib.xml.parser.AbstractXMLParser.parseAndCatchException(AbstractXMLParser.java:145) at com.sap.engine.lib.xml.parser.AbstractXMLParser.parse(AbstractXMLParser.java:160) at com.sap.engine.lib.xml.parser.AbstractXMLParser.parse(AbstractXMLParser.java:261) at com.sap.engine.lib.xml.parser.Parser.parse_DTDValidation(Parser.java:282) at com.sap.engine.lib.xml.parser.Parser.parse(Parser.java:293) at com.sap.engine.lib.xml.parser.SAXParser.parse(SAXParser.java:126) at com.sap.aii.ib.server.mapping.execution.jaxpfactories.MappingXMLReader.parse(MappingXMLReader.java:102) at com.sap.engine.lib.jaxp.TransformerImpl.transformWithStylesheet(TransformerImpl.java:387) at com.sap.engine.lib.jaxp.TransformerImpl.transform(TransformerImpl.java:240) at com.sap.aii.ib.server.mapping.execution.AbstractMappingTransformer.transform(AbstractMappingTransformer.java:174) at com.sap.aii.ib.server.mapping.execution.XSLTMapping.executeStep(XSLTMapping.java:79) at com.sap.aii.ib.server.mapping.execution.Mapping.execute(Mapping.java:60) at com.sap.aii.ib.server.mapping.execution.SequenceMapping.executeStep(SequenceMapping.java:40) at com.sap.aii.ib.server.mapping.execution.Mapping.execute(Mapping.java:60) at com.sap.aii.ib.server.mapping.execution.MappingHandler.map(MappingHandler.java:87) at com.sap.aii.ib.server.mapping.execution.MappingHandler.map(MappingHandler.java:71) at com.sap.aii.ibrun.sbeans.mapping.MappingRequestHandler.handleMappingRequest(MappingRequestHandler.java:119) at com.sap.aii.ibrun.sbeans.mapping.MappingRequestHandler.handleRequest(MappingRequestHandler.java:72) at com.sap.aii.ibrun.sbeans.mapping.MappingServiceImpl.processFunction(MappingServiceImpl.java:79) at sun.reflect.GeneratedMethodAccessor310.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:585) at com.sap.engine.services.ejb3.runtime.impl.RequestInvocationContext.proceedFinal(RequestInvocationContext.java:43) at com.sap.engine.services.ejb3.runtime.impl.AbstractInvocationContext.proceed(AbstractInvocationContext.java:166) at com.sap.engine.services.ejb3.runtime.impl.Interceptors_StatesTransition.invoke(Interceptors_StatesTransition.java:19) at com.sap.engine.services.ejb3.runtime.impl.AbstractInvocationContext.proceed(AbstractInvocationContext.java:177) at com.sap.engine.services.ejb3.runtime.impl.Interceptors_Resource.invoke(Interceptors_Resource.java:71) at com.sap.engine.services.ejb3.runtime.impl.AbstractInvocationContext.proceed(AbstractInvocationContext.java:177) at com.sap.engine.services.ejb3.runtime.impl.Interceptors_Transaction.doWorkWithAttribute(Interceptors_Transaction.java:38) at com.sap.engine.services.ejb3.runtime.impl.Interceptors_Transaction.invoke(Interceptors_Transaction.java:22) at com.sap.engine.services.ejb3.runtime.impl.AbstractInvocationContext.proceed(AbstractInvocationContext.java:177) at com.sap.engine.services.ejb3.runtime.impl.AbstractInvocationContext.proceed(AbstractInvocationContext.java:189) at com.sap.engine.services.ejb3.runtime.impl.Interceptors_StatelessInstanceGetter.invoke(Interceptors_StatelessInstanceGetter.java:16) at com.sap.engine.services.ejb3.runtime.impl.AbstractInvocationContext.proceed(AbstractInvocationContext.java:177) at com.sap.engine.services.ejb3.runtime.impl.Interceptors_SecurityCheck.invoke(Interceptors_SecurityCheck.java:21) at com.sap.engine.services.ejb3.runtime.impl.AbstractInvocationContext.proceed(AbstractInvocationContext.java:177) at com.sap.engine.services.ejb3.runtime.impl.Interceptors_ExceptionTracer.invoke(Interceptors_ExceptionTracer.java:16) at com.sap.engine.services.ejb3.runtime.impl.AbstractInvocationContext.proceed(AbstractInvocationContext.java:177) at com.sap.engine.services.ejb3.runtime.impl.DefaultInvocationChainsManager.startChain(DefaultInvocationChainsManager.java:133) at com.sap.engine.services.ejb3.runtime.impl.DefaultEJBProxyInvocationHandler.invoke(DefaultEJBProxyInvocationHandler.java:164) at $Proxy544.processFunction(Unknown Source) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:585) at com.sap.engine.services.rfcengine.RFCDefaultRequestHandler.handleRequest(RFCDefaultRequestHandler.java:183) at com.sap.engine.services.rfcengine.RFCJCOServer$J2EEApplicationRunnable.run(RFCJCOServer.java:269) at com.sap.engine.core.thread.impl3.ActionObject.run(ActionObject.java:37) at java.security.AccessController.doPrivileged(Native Method) at com.sap.engine.core.thread.impl3.SingleThread.execute(SingleThread.java:152) at com.sap.engine.core.thread.impl3.SingleThread.run(SingleThread.java:247)</Trace>
    I will try your Java mapping next and get back to you if I get success with this.
    Cheers for your help.
    Colin.

  • What table stores incoming XML message

    Hi Gurus,
    Can anyone tell me which is the table where the XML of incoming messages are stored in integration broker. I am aware of the tables like PSAPMSGSUBCON,etc mainly give only the status and other information about the message; but I am interested in knowing where exactly is the actual XML stored in the database.
    -Sudripta

    OK. I did some testing with the data in PSAPMSGPUBDATA. Base64 is not involved anywhere. I did this against PT 8.50. I think PT 8.48 to PT 8.50 (the current version) would be the same. I looked at some code I wrote for PT 8.45 and it was very similar. The table and fields were different, but the compression, etc was the same.
    It appears that the data in the MIMEDATALONG field is compressed only (no base64, etc). I don't know the compression algorithm used. I used the java.util.zip.Inflater class to "inflate" the contents.
    About concatenating the "pieces"... I didn't have any large enough messages to see data chunking. From my testing, I saw that SUBSEGMENTNO of 0 contained the JMS header and IBInfo. SUBSEGMENTN0 of 1 had the XML message. It seems that the DATASEQNO field would contain an index for chunked data, but I didn't have any messages large enough to verify. For each SUBSEGMENTNO, I inflated them separately, not concatenated. I don't know if chunked data is zipped and then chunked, or chunked and then zipped. This will determine whether you concatenate data and then inflate or inflate and then concatenate.
    Here is my test code:
    import java.io.UnsupportedEncodingException;
    import java.sql.Connection;
    import java.sql.DriverManager;
    import java.sql.ResultSet;
    import java.sql.SQLException;
    import java.sql.Statement;
    import java.util.zip.DataFormatException;
    import java.util.zip.Inflater;
    public class MessageDownloader {
      public MessageDownloader() {
        super();
      public static void main(String[] args) throws SQLException,
                                                    DataFormatException,
                                                    UnsupportedEncodingException {
        Connection conn =
          DriverManager.getConnection("jdbc:oracle:thin:@your.db.server:1521:YOURSID",
                                      "username", "password");
        Statement stmt = conn.createStatement();
        ResultSet rs =
          stmt.executeQuery("SELECT IBTRANSACTIONID, IB_SEGMENTINDEX, SEGMENTNO, SUBSEGMENTNO, UNCOMPMIMEDATALEN, MIMEDATALONG\n" +
            "  FROM PSAPMSGPUBDATA\n" +
            //" WHERE IBTRANSACTIONID = 'GUID-GOES-HERE'\n" +
            " ORDER BY IBTRANSACTIONID, IB_SEGMENTINDEX, SEGMENTNO, SUBSEGMENTNO, DATASEQNO\n");
        String id = "";
        while (rs.next()) {
          if(!id.equals(rs.getString("IBTRANSACTIONID"))) {
            id = rs.getString("IBTRANSACTIONID");
            System.out.println("----------------------------------------------------");
            System.out.println("******  " + id + "  ******");
          String segment = rs.getInt("IB_SEGMENTINDEX") + "-" +
                         rs.getInt("SEGMENTNO") + "-" +
                         rs.getInt("SUBSEGMENTNO");
          Inflater inflater = new Inflater();
          byte[] result = new byte[rs.getInt("UNCOMPMIMEDATALEN")];
          inflater.setInput(rs.getBytes("MIMEDATALONG"));
          int length = inflater.inflate(result);
          System.out.println("Segment: " + segment);
          System.out.println(new String(result, 0, length, "UTF-8"));
          System.out.println();
          System.out.println("--");
          System.out.println();
          inflater.end();
    }

  • Multiple lines in a Output XML message

    Hi all,
         I am currently implimenting a simple scenario of creating a file in a particular format using XI.The working scenario is that we get an XML message from BO which will be mapped to the required format of the file.But for testing we are using an hardcoded XML file as the incoming message to XI.
         But there is a problem I am facing. The incoming XML message will contain multiple information and this has to be mapped to a header information followed by items.Like for example I have a payment document which has paid some 5 invoices.The incoming XML message will have this information and what I need in the output is to have the invoice information in 5 different lines.
    For eg - Assume I have the following structure for incoming message
    REGUH
    REGUP
    ....and so on
    Here for every REGUH entry we can have mulitple REGUP and also we can have multiple REGUH.
    Say my target structure is -
    Header Info
    Record Info
    so for every REGUH and corresponding REGUP combination I will have a Header Info and Record Info.For the next REGUH and corresponding REGUP I will have another Header and Record Info.
         I tried testing this in message mapping by duplicating the node REGUH and REGUP but it does not work.I also tried by having the occurances as 1 to n on both sides.It did not seem to work.
    Can you guys give some feedback on this.
    Thanks..
    Sandeep

    Manish,
        Thanks for the information.But this was a simple case which works.But in my case I have something like -
    one field in REGUH will appear once in the file while some other fields will appear multiple times.Also I have a lot other structures which are something like this.
    I assume that occurence for both sides should be 1 to n.
    But it does not seem to work for me.Its a bit complicated target structure.

  • Osb: Proxy Messaging Service retrieve only xml message that have the proper

    Hi All.
    I have a Proxy Service with Messaging Service type which read xml messages from a queue.
    The Request Message Type in the proxy is xml and I have provided the type information by declaring (in the element and type field) the XML schema type of the XML document exchanged.
    I need the proxy service to retrieve from the queue only the xml messages that have the proper schema.
    But when the proxy retrieves any xml msg in the queue regardless of their schema definition .
    Appreciate your input.
    Thx,
    Ross
    Edited by: user6677631 on Feb 25, 2013 9:52 AM
    Edited by: user6677631 on Feb 25, 2013 10:02 AM

    Selecting the XML schema for request type in a messaging proxy does not ensure the validation of incoming XML message against schema. Similarly if you create a WSDL based proxy the validation against WSDL definition will not happen automatically. Choosing XML as the type of message will only ensure that any malformed XMLs will be rejected before entering the message flow. For validating against schema you will need to explicitly add a validate action within the proxy message flow, if validation fails raise an error and roll back the message to the Queue or log the errored message and commit the message/publish to an error queue.

  • Incoming XML validation for SOAP adapter request

    Hi,
    Does anyone know of a method to validate incoming XML request against the relevant XSD definition and return a SOAP fault message to the calling application ?
    I guess this would involve BPM unless there is some sort of module that can be used.
    Please advise.
    Kind regards
    Colin.

    Hi Michal,
    Would you suggest a simple BPM or an adapter module ?
    I would hope a simple BPM would be the way it could be done.
    Cheers
    Colin.

  • Unable to Execute a Report to send PAN XML messages out of SNC

    Hi All,
    We are unable to Execute a Report /SCA/DM_TIMESERIES_OUT to send Product Activity Notifications in the form of XML messages out of SNC. We have manitained some Planned Reciepts data in SNC and would like to transfer it out to ECC.
    Could anyone help in understanding if we have to maintain mandatory settings before executing this report.
    Thanks & Regards,
    Sadiq

    Hi Pravin,
    As per the documentation(http://help.sap.com/saphelp_snc70/helpdata/EN/48/6bdb4767a431cbe10000000a42189d/frameset.htm), we have tried both the manual and automatic features to configure the output from SNC in the form of XML messages.
    The manual method gave a message "Time series data for selection is empty" and the Automated method could trigger the XML messages on every incoming message from ECC but we are unable to see the Planned Receipts in that XML messages.
    Was just wondering if we can see the Planned Receipt info by changing the settings of this report or by using any other simillar report as the PR info is very important for our development.
    Thanks & Regards,
    Sadiq

  • View is not retuning data when creating XML message through workflow

    Hi All,
    This is a very critical problem for me. I am trying to send an XML message (outbound) through XML gateway. This is done from a custom workflow. The message creation is done from the standard procedure ecx_document.sendDirect. The data for the XML file is taken from two views (whcih are created in a custom schema and have synonym in apps). One view for header and another one for line information (I am creating an XML for a purchase order).
    The problem is when the workflow try the first time to create a message, the views are not returning data. So message creation fails. Now, if we restart the workflow after some time, it will work and the message is created. What could be the reason for this sort of a behaviour ?
    I am using business events to trigger the workflow. The data in the table/view will be updated by standard POAPPRV workflow activities. The custom workflow is subscribed to a business event raised from POAPPRV workflow, at a certain point. So this will execute when this event is raised from POAPPRV wf. The subscription has a phase value of 99.
    Any help on this regard will be much appreciated, as this is a critical issue.
    Thanks in advance,
    Arun
    PS : One more thing : this is happening mostly in the production instance where the number of messages is very high (freqency).

    Hello,
    With the BAPI_EQUI_CREATE you can only create PM equipments not IS-U devices that why there is no IS Tab .
    You have to use the dialog transactions IQ01, IQ04 or the MM transaction, where you can create devices through a movement.
    There is objecttype DEVICE (SWO1) with the following methods:
    -> Device.CreateFromData (Create Equipment Master Record)
    -> Device.Create (Create Equipment Master Record)
    -> Device.CreateISU (Create IS-U: Modification for IS-U)
    Please check whether you can use method Device.CreateISU for your requirement.
    Regards
    Olivia

  • Converting Delimited string to XML message

    Hi,
    We are trying to convert pipe delimited string into a xml schema using a XSD and BPEL funtion. Consider a scenario in which message has 5 fields with last as 2 optional fields. So the incoming string message can be like "1|2|3" or "1|2|3|4|5". In this case how the XSD should look like, since for each field we have to give "terminatedby" option in the XSD. So the issue is coming for element 3 where the delimiter can be "|" or "eol" (end of line). How to specify that ? Is there any option to use like "optionally terminated by?"
    Any help will be appreciated.
    Thanks,
    Ramesh
    Edited by: rameshchandra85 on 2 Aug, 2010 10:00 AM

    Hi Ramesh,
    You can use below XSD for input file of kind
    1|2|3
    1|2|3|4|5
    1|2|3|4
    1|2|3|4|5|6
    <?xml version="1.0" encoding="UTF-8" ?>
    <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
                xmlns:nxsd="http://xmlns.oracle.com/pcbpel/nxsd"
                targetNamespace="http://TargetNamespace.com/InboundService"
                xmlns:tns="http://TargetNamespace.com/InboundService"
                elementFormDefault="qualified"
                attributeFormDefault="unqualified" nxsd:encoding="ASCII" nxsd:stream="chars" nxsd:version="NXSD">
      <xsd:element name="Root-Element">
        <xsd:complexType>
          <xsd:choice minOccurs="1" maxOccurs="unbounded" nxsd:choiceCondition="terminated" nxsd:terminatedBy="|">
            <xsd:element name="RECORD1" nxsd:conditionValue="1">
              <xsd:complexType>
                <xsd:sequence>
                  <xsd:element name="C2" type="xsd:int" nxsd:style="terminated" nxsd:terminatedBy="|" nxsd:quotedBy="&quot;">
                  </xsd:element>
                  <xsd:element name="C3" type="xsd:int" nxsd:style="terminated" nxsd:terminatedBy="${eol}" nxsd:quotedBy="&quot;">
                  </xsd:element>
                </xsd:sequence>
              </xsd:complexType>
            </xsd:element>
            <xsd:element name="RECORD2" nxsd:conditionValue="2">
              <xsd:complexType>
                <xsd:sequence>
                  <xsd:element name="C2" type="xsd:int" nxsd:style="terminated" nxsd:terminatedBy="|" nxsd:quotedBy="&quot;">
                  </xsd:element>
                  <xsd:element name="C3" type="xsd:int" nxsd:style="terminated" nxsd:terminatedBy="|" nxsd:quotedBy="&quot;">
                  </xsd:element>
                  <xsd:element name="C4" type="xsd:int" nxsd:style="terminated" nxsd:terminatedBy="|" nxsd:quotedBy="&quot;">
                  </xsd:element>
                  <xsd:element name="C5" type="xsd:int" nxsd:style="terminated" nxsd:terminatedBy="${eol}" nxsd:quotedBy="&quot;">
                  </xsd:element>
                </xsd:sequence>
              </xsd:complexType>
            </xsd:element>
            <xsd:element name="RECORD3" nxsd:conditionValue="3">
              <xsd:complexType>
                <xsd:sequence>
                  <xsd:element name="C2" type="xsd:int" nxsd:style="terminated" nxsd:terminatedBy="|" nxsd:quotedBy="&quot;">
                  </xsd:element>
                  <xsd:element name="C3" type="xsd:int" nxsd:style="terminated" nxsd:terminatedBy="|" nxsd:quotedBy="&quot;">
                  </xsd:element>
                  <xsd:element name="C4" type="xsd:int" nxsd:style="terminated" nxsd:terminatedBy="${eol}" nxsd:quotedBy="&quot;">
                  </xsd:element>
                </xsd:sequence>
              </xsd:complexType>
            </xsd:element>
            <xsd:element name="RECORD4" nxsd:conditionValue="4">
              <xsd:complexType>
                <xsd:sequence>
                  <xsd:element name="C2" type="xsd:int" nxsd:style="terminated" nxsd:terminatedBy="|" nxsd:quotedBy="&quot;">
                  </xsd:element>
                  <xsd:element name="C3" type="xsd:int" nxsd:style="terminated" nxsd:terminatedBy="|" nxsd:quotedBy="&quot;">
                  </xsd:element>
                  <xsd:element name="C4" type="xsd:int" nxsd:style="terminated" nxsd:terminatedBy="|" nxsd:quotedBy="&quot;">
                  </xsd:element>
                  <xsd:element name="C5" type="xsd:int" nxsd:style="terminated" nxsd:terminatedBy="|" nxsd:quotedBy="&quot;">
                  </xsd:element>
                  <xsd:element name="C6" type="xsd:int" nxsd:style="terminated" nxsd:terminatedBy="${eol}" nxsd:quotedBy="&quot;">
                  </xsd:element>
                </xsd:sequence>
              </xsd:complexType>
            </xsd:element>
          </xsd:choice>
        </xsd:complexType>
      </xsd:element>
    </xsd:schema>
    <!--NXSDWIZ:D:\DBIN\ReadFile.txt:-->
    <!--USE-HEADER:false:-->But in your case if you are getting 5 elements instead of 3 elements in some other file....Use the same and maipulate the last element afterwards.
    I think we can not have an element definition for two scenarios.
    Update you if i get any..
    Regards
    PavanKumar.M

  • How to use XmlModify to sort the XML Data?

    Hello,
    I saw some examples explain how to use XmlModify in BDB XML package. I want to sort the XML data by several elements but my Java program could not work correctly.
    <CustomerData>
    <Transaction>
    <DLSFIELDS>
    <ADR_PST_CD>12345</ADR_PST_CD>
    <CLT_IRD_NBR>002</CLT_IRD_NBR>
    </DLSFIELDS>
    </Transaction>
    <Transaction>
    <DLSFIELDS>
    <ADR_PST_CD>12345</ADR_PST_CD>
    <CLT_IRD_NBR>102</CLT_IRD_NBR>
    </DLSFIELDS>
    </Transaction>
    // many nodes like transaction ...
    </CustomerData>
    My XQuery script was executed successfully in the shell. The script looks as follows:
    "for $i in collection('sample.dbxml')/CustomerData/Transaction order by xs:decimal($i//ADR_PST_CD), xs:decimal($i//CLT_IRD_NBR) return $i".
    The Java code :
    // create XmlManager
    XmlManager manager = // ...;
    // open XmlContainer
    XmlContainer container = // ...;
    XmlQueryContext context = manager.createQueryContext(XmlQueryContext.LiveValues, XmlQueryContext.Eager);
    XmlQueryExpression expression = manager.prepare("for $i in collection('sample.dbxml')/CustomerData/Transaction order by xs:decimal($i//ADR_PST_CD),xs:decimal($i//CLT_IRD_NBR) return $i", context);
    XmlModify modify = manager.createModify();
    XmlUpdateContext uc = manager.createUpdateContext();
    XmlDocument xmldoc = container.getDocument("sample.xml");
    XmlValue value = new XmlValue(xmldoc);
    long numMod = modify.execute(value, context, uc);
    System.out.println("Peformed " + numMod     + " modification operations");
    Could you point out the errors above or offer some suggestion?
    Thanks.

    I have other question of the sorting issue. Here are a large XML need to sort so I have to split it to multiple small XML files. After importing these files, I will use the XmlModify and XQuery to sort them. I'm not clear on the multiple XML files processing.
    1. Can the BDB XML ensure that all these XML files were sorted or how to update all documents with same logic.
    2. If I want export all these sorted documents, how can I ensure these files processed in sequence? Which document needs process first?
    The export method:
    public void export(String outputfile)throws Exception{
    final int BLOCK_SIZE = 5 * 1024 * 1024; // 5Mb
    try{
    File theFile = new File(outputfile);
    FileOutputStream fos = new FileOutputStream(theFile);
    byte[] buff= new byte[BLOCK_SIZE];                         
    XmlResults rs = container.getAllDocuments(new XmlDocumentConfig());               
    while(rs.hasNext()){
         XmlDocument xmlDoc = rs.next().asDocument();
         XmlInputStream inputStream = xmlDoc.getContentAsXmlInputStream();                    
         long read=0;
         while(true){
         read = inputStream.readBytes(buff, BLOCK_SIZE);
    fos.write(buff,0,(int)read);                    
         if(read < BLOCK_SIZE) break;
    inputStream.delete();
    xmlDoc.delete();
    rs.delete();
    //MUST CLOSE!
    fos.close();               
    catch(Exception e){
    System.err.println("Error exporting file from container " + container);
    System.err.println(" Message: " + e.getMessage());
    Thanks.

  • File is picked up but never show the XML message in SXMB_MONI

    All,
    I am working on the file to SAP integration scenario issue. High level interface design is,
    File Adapter picks the file from XI application server and send the data to SAP Application system(in this case ECC) to post data as per the business requirement. The scenario is working perfect since long time and we don't have any issues as yesterday.
    This morning, I noticed File adapter picks the file and moved the file to archive folder (based on settings in communication channel) but XML message never shown in SXMB_MONI. I had a look into the RWB to check status of the communication channel. every thing looks fine from communication channel monitoring.
    Did any one come across this scenario? What else to be checked to move forward on this issue?
    Thank you..
    Anil

    Hi Kumar,
    The error message indicates the URL the adapter engine is using to send the data to the integration engine is wrong. The last part of it has somehow become truncated: "type=ent" should read "type=entry".
    In the SLD lookup the XI technical system, under the integration tab check the setting for the "Pipeline URL" field, you should see something like: http://HOST:PORT/sap/xi/engine?type=entry  if not, you can correct it.
    Then go to the XI ABAP client using SAPGUI and in transaction: SXMB_ADM, option "Integration Engine Configuration", check that Corresponding Integ. Server has the same URL, if it has something of the sort of: "dest://...." check in transaction SM59 for that RFC destination name, it should have the correct URL.  Also in the specific configuration (using the same transaction), check the RUNTIME->IS_URL parameter value.
    Hope that helps.
    -Sam.

  • Xml message validation or CSV validaion in PI 7.0

    Hi Gurus,
    I need to validate the incoming XML file (source format) in PI 7.0 and if the message is not valid I need to send an email to the sender that the message is invalid.
    I know there is a feature in PI 7.1 XML schema validation done by IE or AAE but is there is any validation feature or do we need write any logic in the mapping editor to validate the incoming XML file.
    Any help appreciated.
    Thanks,
    Jay

    You have to wite JAVA Mapping for the same to validate XML message in PI7.0.
    Refer below link
    http://wiki.sdn.sap.com/wiki/display/XI/XIschemavalidationusingDOMparserviaJavacode
    Regards,
    Raj

  • How to send incoming XML as mail-attachment

    Hi Experts,
    I have the following scenario: an incoming XML-file should be send as attachment of a mail. Now, I have defined incoming message with the structure of the xml-message and outgoing message as mail-package. In the message mapping I fill the nessesary mail-fields. In my receiver comm.channel (mailadapter) I checked "Use mail package" and "Keep attachment".
    Result is that the mail is created and send ok, but without attachment....what am I doing wrong here?
    Regards,
    William

    Hi JWD,
    You should configure the mail adapter with 'use the mail adpater' and 'keep attachments'.
    Create an XML file conform the XML structure provide by SAP
    The mail package should look like this:
    <?xml version="1.0" encoding="utf-8"?>
    <ns:MT_Mail_Sent xmlns:xi="http://sap.com/xi/XI/Mail/30">
    <xi:Mail>
    <Subject>Item</Subject>
    <From>MAIL ADDRESS</From>
    <To>MAIL ADRESS</To>
    <Content_Type>multipart/mixed; boundary="AaBb--984dfgeSSd3532"</Content_Type>
    <Content_Disposition>attachment</Content_Disposition>
    <Content>
    AaBb984dfgeSSd3532
    Content-Type: text/plain
    this is sample data.
    AaBb984dfgeSSd3532
    Content-Type: text/plain;name="CSV_data.csv"
    Order number;Item number;description<xsl:text> </xsl:text>
    <xsl:for-each select="Article_line">
    <xsl:value-of select="Ord_nmbr"/>;<xsl:value-of select="Item_nmbr"/>;<xsl:value-of select="Description<xsl:text>
    </xsl:text></xsl:for-each>
    AaBb984dfgeSSd3532
    Content-Type: text/plain;name="TXT_data.txt"
    Order number;Item number;description<xsl:text> </xsl:text>
    <xsl:for-each select="Article_line">
    <xsl:value-of select="Ord_nmbr"/>;<xsl:value-of select="Item_nmbr"/>;<xsl:value-of select="Description<xsl:text> </xsl:text></xsl:for-each>
    AaBb984dfgeSSd3532
    </Content>
    </xi:Mail>
    </ns:MT_Mail_Sent>
    In the above example you should have some content and 2 attachments (1 csv file and 1 txt file).
    After each break (AaBb984dfgeSSd3532) specify again the 'Content-Type'.
    *When you want to send a message payload as described, you have to set in the mail receiver channel the parameter Content Encoding to None and uncheck Keep Attachments.
    The last boundary AaBb984dfgeSSd3532 should be omitted, as the mail adapter sets that border itself (tested with SP16)*
    Reward points if this helps
    Regards
    Pragathi.

  • Receiver determination based on the filename of the incoming xml file

    hi folks,
    is it possible to base the receiver determination from the filename (pattern) of the incoming xml file?
    suppose, if the filename is partner1.xml, then the receiver determination has a condition of partner1.  in this case, the message is received by partner1.
    any advise please?
    thanks!
    -lex

    Hi Lex,
    You can use Enhanced Receiver Determination for this. Do your normal mapping from source to target. And another mapping for the receiver determination. In that mapping you can use the UDF for Dynamic Configuration and set the filename as the receiver service name.
    Use the following blog for Enhanced Receiver Determination:
    /people/venkataramanan.parameswaran/blog/2006/03/17/illustration-of-enhanced-receiver-determination--sp16
    This blog explains the usage of Dynamic Configuration:
    /people/michal.krawczyk2/blog/2005/11/10/xi-the-same-filename-from-a-sender-to-a-receiver-file-adapter--sp14
    Regards,
    Sanjeev.

  • Canonical Form on XML Message

    Is there a way of producing a canonical form of an XML message from Java?
    Also, does anyone know of a good tutorial about canonical form. I have tried reading the W3C paper on it and found it completely illegible.
    Thanks in advance,
    Adrian

    Thanks for the reply. Yeah, I did post on Javaranch too, trying to catch the widest cross section of people in the hope of an answer to this problem.
    You have a very good point about the attribute order. I must admit I hadn't thought of that. You are right, one of the things the canonical form requires is for the attributes to be in alphabetical order.
    I still find it hard to believe that there isn't a Sun library that does this. There is a javax package to support the other two steps in signing a message (MessageDigest and Signature) so it seems odd that there isn't one for this. Unless I'm simply missing it.
    I'm not entirely sure what you mean by an XML serializer, sorry I'm not that experienced in the whole XML, XSLT, etc firld yet. Is it the sort of thing that is Java uses when a Document is produced from a string containing XML?
    Thanks again for your help,
    Adrian

Maybe you are looking for