Java mapping and no content conversion

Hi all,
I have a file to idoc scenario. The file is in flat idoc format and I've made my own java mapping that gets the flat file and converts it to idoc xml format.
I don't use content conversion in the sender file adapter because I don't wan't the file to be converted to xml before the java mapping processes it. But with this configuration my scenario fails in the interface determination step, as it doesn't find an xml to apply the java mapping.
Is there a way to make it work as I want? (with my java mapping and not applying content conversion?) If not, is there a way to put all the file in a single xml tag using content conversion?
I mean something like this:
<FILE>
</FILE>
This way it would be easy for my java mapping to remove the tags and work with the flat file as it does now.
Thanks in advance.

Thanks Stephan for your answer.
In fact I have the defined that interface, as well as a dummy data type and message type that uses it. I still get the error though. My guess is that, as I don't use content conversion in file adapter (message protocol is file) the outbound message is in fact not in xml format, and it cannot identify it in interface determination. That's my guess but perhaps I'm wrong?
This is the error I'm getting:
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
- <!--  Interface Determination
  -->
- <SAP:Error xmlns:SAP="http://sap.com/xi/XI/Message/30" xmlns:SOAP="http://schemas.xmlsoap.org/soap/envelope/" SOAP:mustUnderstand="">
  <SAP:Category>XIServer</SAP:Category>
  <SAP:Code area="IF_DETERMINATION">CX_ID_PLSRV</SAP:Code>
  <SAP:P1>No interface determination found for outbound interface http://********.****/EDELIVERY.SI_OUT_A_0596_RECADV: Error while determining root tag of XML: BOM / charset detection failed</SAP:P1>
  <SAP:P2 />
  <SAP:P3 />
  <SAP:P4 />
  <SAP:AdditionalText />
  <SAP:Stack>Error when determining the inbound interface: No interface determination found for outbound interface http://********.****/EDELIVERY.SI_OUT_A_0596_RECADV: Error while determining root tag of XML: BOM / charset detection failed No interface determination found for outbound interface http://********.****/EDELIVERY.SI_OUT_A_0596_RECADV: Error while determining root tag of XML: BOM / charset detection failed Error while determining root tag of XML: BOM / charset detection failed Error while parsing an XML stream: 'BOM / charset detection failed'.</SAP:Stack>
  <SAP:Retry>M</SAP:Retry>
  </SAP:Error>
Any idea?

Similar Messages

  • Multi mapping and File Content Conversion

    Hi,
    I've created a similar interface to the the one in this blog
    /people/jin.shin/blog/2006/02/07/multi-mapping-without-bpm--yes-it146s-possible
    In the Config, I receive a CSV and use FCC in the File Adapter to build the XML file. Because of the multimapping, XI adds the following to my Message Mapping
    <ns0:Messages xmlns:ns0="http://sap.com/xi/XI/SplitAndMerge">
       <ns0:Message1>
    Do I need to add this XML to the FCC??

    No,you dont need to add extra tags.
    Those tags are only for XI internal processing.
    Thanx
    Aamir

  • Java Mapping  and Graphical Mapping

    Hi All,
    Could any one clarifies the situation where we need to write in a same interface ,
    Both Java mapping and Graphical mapping.
    Regards,
    venu.

    Hi,
       Here is a scenario where you might need to use both graphical and user defined functions.
    source: <fname> <lname> <filename>
    target: <name> <filetype>
    Suppose, you need to concatenate fname and lname into the target <name> tag, you could use the normal graphical mapping using the concat function.
    <fname>\
    concat <name>
    <lname>/
    next, if we need to extract only the filetype from the filename, for example, if we have filename.txt... and we want only the value .txt, we need to write a user defined function which would achieve this for u, since there are no inbuilt function which can solve this for you in graphical mapping.
    Further XSLT mapping comes into picture when we need to create the entire target xml structure. Again, graphical mapping would not be useful here.
    Regards,
    Smitha.

  • About Java mapping and java proxy

    Hi
    Iam new to Xi and basically iam an ABAPER.When iam dooing mappinps or proxies i cant able to understand the java pari cant (javamapping and java proxies) .I need some notes on java mapping and java proxy which is easy to do.And why do we use this java mapping or java proxy particularly when we r having abap mappipng and abap proxy.
    thanks in advance

    Hi,
    refer
    Java Mapping
    SAP Network Blog: Java Mapping (Part I)
    /people/prasad.ulagappan2/blog/2005/06/29/java-mapping-part-i
    Java Mapping in XI
    https://www.sdn.sap.com/irj/sdn/advancedsearch?cat=sdn_all&query=java+mapping&adv=false&sortby=cm_rnd_rankvalue#
    Runtime Environment (Java Mappings) (SAP Library - Partner Connectivity Kit)
    http://help.sap.com/saphelp_nw04/helpdata/en/bd/c91241c738f423e10000000a155106/frameset.htm
    Java Mapping (SAP Library - Partner Connectivity Kit)
    http://help.sap.com/saphelp_nw04/helpdata/en/e2/e13fcd80fe47768df001a558ed10b6/frameset.htm
    SAP Network Blog: Testing and Debugging Java Mapping
    /people/stefan.grube/blog/2006/10/23/testing-and-debugging-java-mapping-in-developer-studio
    SAP Network Blog: Implementing a Java Mapping in SAP PI
    /people/carlosivan.prietorubio/blog/2007/12/21/implementing-a-java-mapping-in-sap-pi
    "JAVA MAPPING", an alternate way of reading a CSV file
    /people/rahul.nawale2/blog/2006/07/18/java-mapping-an-alternate-way-of-reading-a-csv-file
    SAP Network Blog: XI Java Mapping Helper (DOM)
    /people/alessandro.guarneri/blog/2007/03/25/xi-java-mapping-helper-dom
    Java Proxy
    Java Proxy Objects (SAP Library - SAP Exchange Infrastructure)
    http://help.sap.com/saphelp_nw04/helpdata/en/c5/7d5e3c754e476ee10000000a11405a/frameset.htm
    Accessing Active Directory through Java Proxy on SAP Exchange Infrastructure 3.0
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/10716e9f-23d7-2a10-8c8c-d2665615f8fc
    Thanks
    Swarup

  • XI 7.0 passing attributes between java mapping and message mapping

    Hi all,
    Here's a newbie question. There is a scenario where an interface mapping has several stages of java mapping and message mapping
    I would like to know how to set attributes in the java mapping so that it can be accessed in a message map (or vice versa). What I intend to do is pass some information from one mapping to the other so that action can be taken based on the values passed.
    Thank you!

    Another option is storing the values in the message header in the same way as the Adapter-Specific Message Attributes:
    http://help.sap.com/saphelp_nw04/helpdata/en/43/09b16006526e72e10000000a422035/frameset.htm
    Just use your own name/namespace combination, which is not used in any adapter.
    If possible use the way that Sandro proposed and add the information which you need to additional tags in the payload.
    Regards
    Stefan

  • Throw exception in Java mapping and handle this in BPM

    Hi,
    I'll use a Java mapping in a BPM transform step. Is it possible to throw an exception inside this Java mapping and handle this in a BPM exception handler?
    thanks and regards
    Verena

    Hi Verena,
    In a BPM transformation step, I think you can throw exceptions only for system errors.
    Let me explain with an example, one of the ways to handle your scenario:
    Lets assume your Java Mapping fails then you can trap that exception in your Java mapping and compose an XML message which indicates that an error has occurred.
    say for e.g.
    <intermediateStructure>
    <SatusDocument>
    <StatusCode>ERROR</StatusCode>
    <ErrCode>123</ErrCode>
    <ErrDesc><!populate the thrown exception details></ErrDesc>
    </StatusDocument>
    <Payload>
    <!contains actual XML message with data>
    </Payload>
    </intermediateStructure>
    if Java mapping is Successful, you can compose the XML message as follows:
    <intermediateStructure>
    <SatusDocument>
    <StatusCode>SUCCESS</StatusCode>
    <ErrCode>0</ErrCode>
    <ErrDesc></ErrDesc>
    </StatusDocument>
    <Payload>
    <!contains actual XML message with data>
    </Payload>
    </intermediateStructure>
    You can use BPM switch operation to switch to different processing branches say for e.g. "error" branch or "success" branch by examining the value of <StatusCode> tag.
    Hope it helps !
    Regards,
    Sridhar

  • Purpose of message protocol file and file content conversion

    hi
       i am currently working in idoc to file scenario, 
          In what cases we will go file and file content conversion in message protocol for file adapter.
    can anyone specify the real significance of it? bcoz this may help me and continue my scenario in its suitable path.
    Regards
    Saravanakumar PK

    Hi,
    In XI (internal) all XML message are based on the XI Message Protocol.
    See: http://help.sap.com/saphelp_nw70/helpdata/en/b6/0b733cb7d61952e10000000a11405a/frameset.htm
    XI Protocol is nothing but an SAP XI extension of SOAP protocol and SOAP protocol is nothing but a SOAP request in a HTTP protocol. SOAP request is nothing but SOAP extension of an XML message. Hence finally it drill downs to the fact that XI message is in fact an XML message with some extra information in the header which are SAP specific like the SAP Runtime, SAP Hoplist, etc...
    File Content Conversion
    Integration Engine understands only XML messages.Now if u r handling normal text file such as 'tab separated' file,'# separated' file, or a CSV file, you need to convert the content of the file to XML and File Content Conversion mechanism helps to do this job.This File Content conversion mechanism(option)is present with the File Adapters.both Sender and Receiver.
    How to do FCC:
    http://help.sap.com/saphelp_nw04/helpdata/en/2c/181077dd7d6b4ea6a8029b20bf7e55/content.htm
    /people/arpit.seth/blog/2005/06/02/file-receiver-with-content-conversion
    /people/venkat.donela/blog/2005/06/08/how-to-send-a-flat-file-with-various-field-lengths-and-variable-substructures-to-xi-30
    /people/arpit.seth/blog/2005/06/02/file-receiver-with-content-conversion
    /people/anish.abraham2/blog/2005/06/08/content-conversion-patternrandom-content-in-input-file
    /people/arpit.seth/blog/2005/06/02/file-receiver-with-content-conversion
    /people/anish.abraham2/blog/2005/06/08/content-conversion-patternrandom-content-in-input-file
    /people/shabarish.vijayakumar/blog/2006/04/03/xi-in-the-role-of-a-ftp
    Thanks
    Swarup

  • Mail Adapter and File content conversion.

    I have a scenario to send data from SAP to 4 different boards. I have used a Multi mapping for this scenario. I am using Proxy for SAP to xi and SOAP, File and Mail adapter for the external connections.
    Questions:
    1) I need to send a mail in CSV or Excell format in one scenario. I have used AF_StrictXml2Plain Module but its not working? any thoughts?
    2) In the file adapter I have to add the YYYYMMDD (current Date) to the file name? when I use timestamp i get the time too, any way of getting only date? I cant use the Variable substitution as i dont have date in my payload.
    3) Receiver File content conversion:
    My Message Type Looks like this
    MT_XX_XX
         Row
            title
            xxx
    I have used these parameters:
    Recordset Structure:  Row
    Row.addHeaderLine : 0
    Row.fieldSeparator : ,
    Row.endSeparator: 'nl'
    am I doing something worng, the file content conversion doesnt work.
    Please let me know
    Thanks in advance

    Hi,
    Make sure u are using the bean before the mail adapter bean.
    Before using the file content conversion make sure that there are no substructures in it , in order to use addheader line as 0. else use addheaderline 3 and give the headerline as comma seperated values
    for e.g if this is the type then addheader line= 0
    Type 1  :
    Record_Mt
         Row
             field1
             field2
    else if this the type then addheaderline = 3
    *Type 2: *
    Record_Mt
         Row1
             field1
             field2
         Row2
             field1
             field2
    add module like this
    localejbs/sap.com/AF_Modules/StrictXml2PlainBean
    with the module key e.g. key
    for type 1 struct (as above )add parameter- key as singleRecordType  and value as Row with comma seperated value. (remember header line is 0)
    for type 2 structure (as above )add parameter- key as recordTypes  and value as Row1, Row2 with comma seperated value. (remember header line is 3)

  • Mapping issue after Content Conversion in PI 7.1

    Hi Experts
    I am working on a File (Fixed format) to proxy , Data is getting converted in the File Content and conversion and passing to mapping as xml data , But the when the mapping happens no values are being returned on the  target side
    When I load the data (xml ) file from sxmb_moni on the sender side all nodes  shows in red color though file content happened without issues
    please provide the inputs how to map with the values
    Thanks
    PR

    A couple of checkpoints for you:
    1. When you load the XML from SXMB_MONI in the test tab of message mapping it turns red..this means the constructed XML (from CC content conversion) doesnt match the one (XSD) defined in your ESR/IR. In this case you have to check again thoroughly the file content conversion fields values/field length in the sender Communication chaneel.
    2. Once you rectify the error above then you can test the mapping in ESR message mapping.

  • Regarding Java mapping and ABAP Mapping

    Hello,
         If I suppose to do Java mapping or ABAP mapping, Is there any pre requisite to perform these two mappings?
    If exist what they are?
    How to perform them?
    Thank you

    Hello jyotsna,
    Java mapping can be used when you have complex mapping structures.
    We can do most of the times for our requirements through Graphical mapping.
    When the structures are very complex to build you can go for SAX (Simple API for XML) or DOM (Document Object Model) parsers.
    Message mapping internally generates DOM parser.
    Java Mapping in XI
    https://www.sdn.sap.com/irj/sdn/advancedsearch?cat=sdn_all&query=java+mapping&adv=false&sortby=cm_rnd_rankvalue#
    SAP Network Blog: Implementing a Java Mapping in SAP PI
    /people/carlosivan.prietorubio/blog/2007/12/21/implementing-a-java-mapping-in-sap-pi
    Java Mapping (SAP Library - Partner Connectivity Kit)
    http://help.sap.com/saphelp_nw04/helpdata/en/e2/e13fcd80fe47768df001a558ed10b6/frameset.htm
    SAP Network Blog: XI Java Mapping Helper (DOM)
    /people/alessandro.guarneri/blog/2007/03/25/xi-java-mapping-helper-dom
    SAP Network Blog: Testing and Debugging Java Mapping
    /people/stefan.grube/blog/2006/10/23/testing-and-debugging-java-mapping-in-developer-studio
    Binary Conversion in XI - Java Mapping - Code Gallery - Wiki
    https://www.sdn.sap.com/irj/sdn/wiki?path=/display/snippets/binary%2bconversion%2bin%2bxi%2b-%2bjava%2bmapping
    SAP Network Blog: "JAVA MAPPING", an alternate way of reading a CSV file
    /people/rahul.nawale2/blog/2006/07/18/java-mapping-an-alternate-way-of-reading-a-csv-file
    ABAP mappings run on ABAP Stack and are developed in the ABAP workbench of the Integration Server.
    You normally do not need to use the ABAP mappings and is preferable for someone with ABAP programming background. I should say JAVA functions would suffice any complex scenarios.
    refer step by step guides for ABAP Mapping
    ABAP Mapping
    https://www.sdn.sap.com/irj/sdn/advancedsearch?cat=sdn_all&query=abap+mapping&adv=false&sortby=cm_rnd_rankvalue#
    How to Use ABAP Mapping in Exchange Infrastructure 3.0 (NW2004)
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/5c46ab90-0201-0010-42bd-9d0302591383
    SAP Network Blog: Testing ABAP Mapping
    /people/sameer.shadab/blog/2005/09/29/testing-abap-mapping
    SAP Network Blog: How to call XI ABAP Mapping via RFC
    /people/ricardoandres.maienza/blog/2007/04/06/how-to-call-xi-abap-mapping-via-rfc
    SAP Network Blog: XI: ABAP mapping logs - more standard = better visibility
    /people/michal.krawczyk2/blog/2006/09/20/xi-abap-mapping-logs--more-standard-better-visibility
    SAP Network Blog: Dynamically sending a mail to the PO creator using XSLT- ABAP Mapping
    /people/rahul.nawale2/blog/2006/11/01/dynamically-sending-a-mail-to-the-po-creator-using-xslt-abap-mapping
    You need to provide the name of your mapping program maually , you see it is an input box.
    just provide the name of abap mapping program it will work.
    and one more thing you cannot test abap mapping program in integration builer you need to test in abap only.
    use tcode: SXI_MAPPING_TEST for testing abap mapping
    Thanks,
    Satya
    Reward points if it is useful..

  • Proxy - ABAP mapping - file with content conversion

    Scenario goes from ECC (proxy) to XI then I do ABAP mapping.  I have tested the ABAP mapping with SXI_mapping_test transaction.  My ABAP mapping puts the payload back into XML and then the data goes to a file adapter where I also use content conversion.  If I do not do the content conversion the data comes out correct in XML.  When I change to content conversion I get 20 blank lines.  Is it possible to do content conversion from ABAP mapping?
    Any help would be greatly appreciated.
    Thanks
    Skip Ford

    Hi,
    Have you checked whether the blank lines you got in the XML files are from the blank nodes or elements which you created in ABAP mapping?
    If it is, then just create your elements or nodes whenever there are corresponding values in your ABAP mapping.
    e.g.
    If  l_sender_service is NOT initial.
      elementsender = odocument->create_simple_element(
                                   name = 'SenderService'
                                   value = l_sender_service
                                   parent = msgtype ).
    endif.
    Regards,
    Lim...

  • Error in Java Mapping for Single XML conversion

    We are working on ABAP Proxy --> SAP PI 7.1 --> SOAP (Synchronous Scenario).
    (ECC -> PI -> Legacy CRM)
    Client has provided a WSDL with Single Node of XML and asking us to pass the whole structure as an single string along with all the nodes of data structure. To perform mapping we are using Java Mapping.
    Message which we are getting after Java Mapping:
    Input
    <?xml version="1.0" encoding="UTF-8"?>
    <ns0:MT_SOReject_Sender xmlns:ns0="http://MTSINDIA/TC/SalesOrderReject">
       <ITEM>
          <sSlsOrderCode>1001</sSlsOrderCode>
          <sDlrCode>A250</sDlrCode>
          <sRejectReason>Z2</sRejectReason>
          <nCircleCode>2</nCircleCode>
       </ITEM>
    </ns0:MT_SOReject_Sender>
    Output
    <?xml version="1.0" encoding="UTF-8"?><MT_Trg xmlns:ns="urn:Test_File_to_File"><stringinp>&lt;?xml version="1.0" encoding="UTF-8"?&gt;&lt;ns0:MT_SOReject_Sender xmlns:ns0="http://MTSINDIA/TC/SalesOrderReject"&gt;&lt;ITEM&gt;&lt;sSlsOrderCode&gt;1001&lt;/sSlsOrderCode&gt;&lt;sDlrCode&gt;A250&lt;/sDlrCode&gt;&lt;sRejectReason&gt;Insufficient Stock Balance&lt;/sRejectReason&gt;&lt;nCircleCode&gt;2&lt;/nCircleCode&gt;&lt;/ITEM&gt;&lt;/ns0:MT_SOReject_Sender&gt;</stringinp></MT_Trg>
    Is ther any way from which we can convert &gt; as u201C>u201D and &lt; as u201C<u201D.  Required result is as follows
    Required Output
    <?xml version="1.0" encoding="UTF-8"?><MT_Trg xmlns:ns="urn:Test_File_to_File"><stringinp><?xml version="1.0" encoding="UTF-8"?><ns0:MT_SOReject_Sender xmlns:ns0="http://MTSINDIA/TC/SalesOrderReject"><ITEM><sSlsOrderCode>1001</sSlsOrderCode><sDlrCode>A250</sDlrCode><sRejectReason>Insufficient Stock Balance</sRejectReason><nCircleCode>2</nCircleCode></ITEM></ns0:MT_SOReject_Sender></stringinp></MT_Trg>
    We are using following Java Code for the same.
    import java.io.BufferedReader;
              import java.io.FileInputStream;
              import java.io.FileOutputStream;
              import java.io.InputStream;
              import java.io.InputStreamReader;
              import java.io.OutputStream;
              import java.util.Map;
              import javax.xml.parsers.DocumentBuilder;
              import javax.xml.parsers.DocumentBuilderFactory;
              import javax.xml.transform.Transformer;
              import javax.xml.transform.TransformerFactory;
              import javax.xml.transform.dom.DOMSource;
              import javax.xml.transform.stream.StreamResult;
              import org.w3c.dom.Element;
              import org.w3c.dom.Document;
              import org.w3c.dom.Text;
              import com.sap.aii.mapping.api.*;
              import com.sap.aii.mapping.api.StreamTransformation;
    public class SingleStr implements StreamTransformation{
          * @author user
          * To change the template for this generated type comment go to
          * Window&gt;Preferences&gt;Java&gt;Code Generation&gt;Code and Comments
                    public static void main(String args[]) throws Exception {
                FileInputStream inFile =
                 new FileInputStream("C:/Documents and Settings/user.HR0102WILT00033/Desktop/Input.XML");
                FileOutputStream outFile =
                 new FileOutputStream("C:/Documents and Settings/user.HR0102WILT00033/Desktop/Output.XML");
                 SingleStr xml = new SingleStr();
                xml.execute(inFile, outFile);
                System.out.println("Success");
               public void setParameter(Map param) {
                Map map = param;
               public void execute(InputStream in, OutputStream out)
                throws com.sap.aii.mapping.api.StreamTransformationException {
                try {
                 //************************Code To Generate The XML Parsing Objects*****************************//    
                 DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
                 DocumentBuilder db = dbf.newDocumentBuilder();
                 TransformerFactory tf = TransformerFactory.newInstance();
                 Transformer transform = tf.newTransformer();
                 //Document doc = db.parse(in);
                 Document docout = db.newDocument();
                 Element root = docout.createElement("MT_Trg");
                 root.setAttribute("xmlns:ns","urn:Test_File_to_File");
                 docout.appendChild(root);
                 Element stringinp = docout.createElement("stringinp");
                 root.appendChild(stringinp);
                 BufferedReader inpxml = new BufferedReader(new InputStreamReader(in));
                 StringBuffer buffer = new StringBuffer();
                 String line="";
                 while ((line = inpxml.readLine()) != null)
                 buffer.append(line);
                 String inptxml=buffer.toString();
                 Text srcxml = docout.createTextNode(inptxml);
                 stringinp.appendChild(srcxml);
                 DOMSource domS = new DOMSource(docout);
                 transform.transform((domS), new StreamResult(out));
                 } catch (Exception e) {
                   System.out.print("Problem parsing the file: " + e.getMessage());
                   e.printStackTrace();
    Please help!!

    We are using following Java Code for the same.
    import java.io.BufferedReader;
              import java.io.FileInputStream;
              import java.io.FileOutputStream;
              import java.io.InputStream;
              import java.io.InputStreamReader;
              import java.io.OutputStream;
              import java.util.Map;
              import javax.xml.parsers.DocumentBuilder;
              import javax.xml.parsers.DocumentBuilderFactory;
              import javax.xml.transform.Transformer;
              import javax.xml.transform.TransformerFactory;
              import javax.xml.transform.dom.DOMSource;
              import javax.xml.transform.stream.StreamResult;
              import org.w3c.dom.Element;
              import org.w3c.dom.Document;
              import org.w3c.dom.Text;
              import com.sap.aii.mapping.api.*;
              import com.sap.aii.mapping.api.StreamTransformation;
    public class SingleStr implements StreamTransformation{
               public static void main(String args[]) throws Exception {
                FileInputStream inFile =
                 new FileInputStream("C:/Documents and Settings/user.HR0102WILT00033/Desktop/Input.XML");
                FileOutputStream outFile =
                 new FileOutputStream("C:/Documents and Settings/user.HR0102WILT00033/Desktop/Output.XML");
                 SingleStr xml = new SingleStr();
                xml.execute(inFile, outFile);
                System.out.println("Success");
               public void setParameter(Map param) {
                Map map = param;
               public void execute(InputStream in, OutputStream out)
                throws com.sap.aii.mapping.api.StreamTransformationException {
                try {
                 DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
                 DocumentBuilder db = dbf.newDocumentBuilder();
                 TransformerFactory tf = TransformerFactory.newInstance();
                 Transformer transform = tf.newTransformer();
                 //Document doc = db.parse(in);
                 Document docout = db.newDocument();
                 Element root = docout.createElement("MT_Trg");
                 root.setAttribute("xmlns:ns","urn:Test_File_to_File");
                 docout.appendChild(root);
                 Element stringinp = docout.createElement("stringinp");
                 root.appendChild(stringinp);
                 BufferedReader inpxml = new BufferedReader(new InputStreamReader(in));
                 StringBuffer buffer = new StringBuffer();
                 String line="";
                 while ((line = inpxml.readLine()) != null)
                 buffer.append(line);
                 String inptxml=buffer.toString();
                 Text srcxml = docout.createTextNode(inptxml);
                 stringinp.appendChild(srcxml);
                 DOMSource domS = new DOMSource(docout);
                 transform.transform((domS), new StreamResult(out));
                 } catch (Exception e) {
                   System.out.print("Problem parsing the file: " + e.getMessage());
                   e.printStackTrace();
    Please help!!

  • Message splitting using java mapping and BPM

    Hi all,
    I have a PLAIN FILE to IDOC Scenario.
    We decide to use javamapping instead of message mapping because we have several hierachical structures.
    We has more than one IDOC for file. And the mapping it's unable to detect the another header and create it at XI.
    I had seen:
    /people/michal.krawczyk2/blog/2005/12/04/xi-idoc-bundling--the-trick-with-the-occurance-change
    "XI: IDOC bundling - the "trick" with the occurance change"
    But the problem it's we doesn't use mapping programs, so we can't apply to this case.
    So now i need to create a BPM scenario for resolve this issue. Anyone knows any example for split the income message and send any idocs to destination?
    Thanks in advance,

    IT WORKED !!!!
    The only thing it's at out code line we must improve it in another way.
    For everyone who needs to resolve, i copy the code line of the java mapping program.
    The relationship is from the specific mapping for every scenary calling GenToHierMap.
    0.0.0.0.0.0.0.0.0.0.0.0.1. GENERIC PACKAGE (GenToHierMap)
    0.0.0.0.0.0.0.0.0.0.0.0.2.
    package com.sap.javaMapping;
    import java.io.FileInputStream;
    import java.io.FileOutputStream;
    import java.io.InputStream;
    import java.io.OutputStream;
    import java.util.Map;
    import java.util.Vector;
    import javax.xml.parsers.DocumentBuilder;
    import javax.xml.parsers.DocumentBuilderFactory;
    import javax.xml.transform.Transformer;
    import javax.xml.transform.TransformerFactory;
    import javax.xml.transform.dom.DOMSource;
    import javax.xml.transform.stream.StreamResult;
    import org.w3c.dom.Document;
    import org.w3c.dom.Element;
    import org.w3c.dom.Node;
    import org.w3c.dom.NodeList;
    import org.w3c.dom.Text;
    import com.sap.aii.mapping.api.StreamTransformation;
    public class GenToHierMap
         private Element root, idoc;
         private Element nodeArrayRef[];
         private String nodeArrayTagName[];
         private Relation  rel ;
         private int  stack_count ;
         private String nameSpace;
         private String separator="#!";
         protected String msgName;
         GenToHierMap(InputStream in, OutputStream out,Vector v1,String msgName1,String nameSpace1)
         msgName = msgName1;
         nameSpace = nameSpace1;
         rel = new Relation(v1);
         execute(in,out);
        public void execute(InputStream in, OutputStream out)
              Element e ;
              Relation cur_rel;
              DOMSource domS = null;
              Element keyNodeParent;
              //int numdocs;
              try
                           DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
                           factory.setNamespaceAware(true);
                             TransformerFactory tf = TransformerFactory.newInstance();
                             Transformer transform = tf.newTransformer();
                             // Create DOM structure from input XML
                             DocumentBuilder builderel = factory.newDocumentBuilder();
                             Document docIn = builderel.parse(in);
                            NodeList rows = docIn.getElementsByTagName("ROW");
                            nodeArrayTagName = new String[rows.getLength() + 1];
                            nodeArrayRef = new Element[rows.getLength() + 1];
                             Document docOut = builderel.newDocument();
                             root = docOut.createElement(msgName);
                             docOut.appendChild(root);
                             //idoc = docOut.createElement("IDOC");
                             //root.appendChild(idoc);     
                            //Número de documents inicialitzat a 0
                            //numdocs=0;
                            //Per cada filera ROW
                       for (int count=0;count<rows.getLength();count++)
                                  String dataRecord = "";
                                  Node node = rows.item(count);
                                  node = node.getFirstChild();
                                  dataRecord = node.getNodeValue();
                                  String fieldValue [] = dataRecord.split(separator);
                                  //Cada cop que es troba una nova capçalera es crea un nou document.
                                  //Això permet que hi hagi més d'un IDOC per missatge processat.
                                  if (Integer.valueOf(fieldValue[0]).intValue()==1){
                                       //numdocs = numdocs + 1;
                                       //if (numdocs > 1){
                                            //Es dona sortida al document anterior abans de crear-ne un de nou - BE AWARE BECAUSE IN THE NEXT LINES WE DEFINE THE UNBOUNDED IDOC ATTRIBUTE, WITH BEGIN = 1 ****
                                            //transform.transform((domS),new StreamResult(out));
                                            //docOut = builderel.newDocument();
                                            //root = docOut.createElement(msgName);
                                            //docOut.appendChild(root);
                                            idoc = docOut.createElement("IDOC");
                                            idoc.setAttribute("BEGIN","1");
                                            root.appendChild(idoc);     
                                  cur_rel = (Relation) rel.v.get(Integer.valueOf(fieldValue[0]).intValue());                    
                                  String keyId = cur_rel.node;
                                  keyNodeParent = searchNode(keyId);
                                  nodeArrayTagName[count] = keyId;
                               e = docOut.createElement(keyId);
                                  e.setAttribute("SEGMENT",fieldValue[0]);
                               nodeArrayRef[count]= e;
                              keyNodeParent.appendChild(e);
                              createXmlTree(docOut,e,keyId,fieldValue);
                              domS = new DOMSource(docOut);
                              stack_count = stack_count + 1;
                         transform.transform((domS),new StreamResult(out));
           catch (Exception t)
                  t.printStackTrace();
    return;
    //returns the parent of the given node
    private Element searchNode(String keyId)
         Relation cur_rel;
         for (int i=0;i<rel.v.size();i++)
              cur_rel = (Relation) rel.v.get(i);
              if (cur_rel.node.equals(keyId))
                     for (int j=0;j<cur_rel.parents.length;j++)
                              if (cur_rel.parents[j].equals("NULL")) return root;
                              if (cur_rel.parents[j].equals("IDOC")) return idoc;
                               for (int k=(stack_count-1);k>=0;k--)
                                   for (int p=0;p<cur_rel.parents.length;p++)
                                       if (nodeArrayTagName[k].equals(cur_rel.parents[p]))
                                       return nodeArrayRef[k];
    return null;
    //Creates all the elements of the given node
    private void createXmlTree(Document docOut,Element node,String keyId, String fieldValue[])
          Element tagName;
          Text tagValue;
          Relation cur_rel;
          for (int i=0;i<rel.v.size();i++)
                     cur_rel = (Relation) rel.v.get(i);
                     if (cur_rel.node.equals(keyId))
                        for (int j=1;j<cur_rel.elements.length;j++)
                           tagName = docOut.createElement(cur_rel.elements[j]);
                           node.appendChild(tagName);
                           if ( j < fieldValue.length  && fieldValue[j].length() != 0 )
                           if ( fieldValue[j].substring(0,1).equals("""))
                           if ( fieldValue[j].length() > 2 )
                           fieldValue[j] = fieldValue[j].substring(1,( fieldValue[j].length() - 1 ));
                           else
                           fieldValue[j] = new String ();
                           if ( j >= fieldValue.length )
                           tagValue = docOut.createTextNode(new String());
                           else
                           tagValue = docOut.createTextNode(fieldValue[j]);
                           tagName.appendChild(tagValue);
                        return;
    //Main thread of execution
    0.0.0.0.0.0.0.0.0.0.0.0.1. SPECIFIC ONE
    0.0.0.0.0.0.0.0.0.0.0.0.2.
    package com.sap.javaMapping;
    * Mapping Program to Convert NOM IDOC Master Structure to the Generic structure Expected by
    * the FTP Receiver adapter
    import com.sap.aii.mapping.api.*;
    import java.io.*;
    import java.util.Map;
    import java.util.Vector;
    import javax.xml.parsers.*;
    import javax.xml.transform.*;
    import javax.xml.transform.dom.DOMSource;
    import javax.xml.transform.stream.StreamResult;
    import org.w3c.dom.*;
    import org.xml.sax.*;
    //Specify the Hirearchial Structure
    public class INT938_mapping implements StreamTransformation
         public Vector v;
        private Map map;
        /** * method setParamters is required, but we do not anything with it */
         public void setParameter(Map param)
              map = param;
         } /** * method execute is called by the XI mapping program */
    public void buildXsd()
      Relation  mriRel ;
      v = new Vector();
      /* INICI MODIFICACIÓ ESTRUCTURA DE SORTIDA DEL MAPPING */
      // --> TOCAR AQUEST NODE IMPLICA MODIFICAR EL CÒDI!!!
      mriRel = new Relation();
      mriRel.parents = new String[1];
      mriRel.node =  "IDOC" ;
      mriRel.parents[0] =   "NULL" ;
      v.add(mriRel) ;
      /* ESTRUCTURA DEL IDOC DE SORTIDA */
      //NODE - 01
      mriRel = new Relation();                          
      mriRel.parents = new String[1];                                                    
      mriRel.elements = new String[22];                                                                 
      mriRel.node = "E1BPEBANC";                                    
      mriRel.parents[0]   =   "IDOC";                                              
      mriRel.elements[0]  =   "SEGMENT";   
      mriRel.elements[1]  =   "PREQ_ITEM"; 
      mriRel.elements[2]  =   "DOC_TYPE";  
      mriRel.elements[3]  =   "PUR_GROUP"; 
      mriRel.elements[4]  =   "CREATED_BY";
      mriRel.elements[5]  =   "PREQ_NAME"; 
      mriRel.elements[6]  =   "PREQ_DATE"; 
      mriRel.elements[7]  =   "SHORT_TEXT";
      mriRel.elements[8]  =   "MATERIAL";  
      mriRel.elements[9]  =   "PLANT";     
      mriRel.elements[10] =   "STORE_LOC";
      mriRel.elements[11] =   "TRACKINGNO";
      mriRel.elements[12] =   "MAT_GRP";   
      mriRel.elements[13] =   "QUANTITY";  
      mriRel.elements[14] =   "UNIT";      
      mriRel.elements[15] =   "DELIV_DATE";
      mriRel.elements[16] =   "ACCTASSCAT";
      mriRel.elements[17] =   "DES_VENDOR";
      mriRel.elements[18] =   "PURCH_ORG"; 
      mriRel.elements[19] =   "BATCH";     
      mriRel.elements[20] =   "VEND_MAT";  
      mriRel.elements[21] =   "CURRENCY";
      v.add(mriRel) ; 
      //NODE - 02
      mriRel = new Relation();                                   
      mriRel.parents = new String[1];                                                    
      mriRel.elements = new String[2];                                                                  
      mriRel.node = "Z1SOLCOM";                                    
      mriRel.parents[0]  =   "E1BPEBANC";                                                     
      mriRel.elements[0] =   "SEGMENT";  
      mriRel.elements[1] =   "ZPO_NUMBER";
      v.add(mriRel) ;
      //NODE - 03
      mriRel = new Relation();                                   
      mriRel.parents = new String[1];                                                    
      mriRel.elements = new String[3];                                                                 
      mriRel.node = "E1BPEBKN";                                    
      mriRel.parents[0]  =   "IDOC";                                                   
      mriRel.elements[0] =   "SEGMENT";
      mriRel.elements[1] =   "PREQ_ITEM";   
      mriRel.elements[2] =   "COST_CTR";
      v.add(mriRel) ;
      //NODE - 04
      mriRel = new Relation();                                   
      mriRel.parents = new String[1];                                                    
      mriRel.elements = new String[8];                                       
      mriRel.node = "Z1SOLRES";                                    
      mriRel.parents[0]  =   "E1BPEBKN";                                                   
      mriRel.elements[0] =   "SEGMENT";            
      mriRel.elements[1] =   "DADES_PACIENT";      
      mriRel.elements[2] =   "NOHIS";              
      mriRel.elements[3] =   "ZNINTER";            
      mriRel.elements[4] =   "ZFEIMP";             
      mriRel.elements[5] =   "NMPAC";              
      mriRel.elements[6] =   "ZNLOTE";             
      mriRel.elements[7] =   "ZNSERIE";            
      v.add(mriRel) ;
      /* FI    MODIFICACIÓ ESTRUCTURA DE SORTIDA DEL MAPPING */
    public void execute(InputStream in, OutputStream out) throws com.sap.aii.mapping.api.StreamTransformationException
         INT938_mapping rel = new INT938_mapping();
         rel.buildXsd();
         new GenToHierMap(in,out,rel.v,"ZPREEX01","http://namespace1/namespace");
    public static void main (String[] args) throws Exception
              try
                   INT938_mapping rel = new INT938_mapping();
                   FileInputStream in = new FileInputStream ("C:/DOM_IN.xml");
                   FileOutputStream out = new FileOutputStream ("C:/DOM_OUT.xml");
                   rel.buildXsd();
                   new GenToHierMap(in,out,rel.v,"ZPREEX01","http://namespace1/namespace");
              }catch(Exception e) {e.printStackTrace();}
    //Transformation of flat structure to hirearchial structure
    Any issue you can contact me. Best regards and reward points !

  • Java mapping and sxmb_moni

    HI all,
    I am using java mapping. Is there any way through which I can post debug messages on SXMB_MONI.
    For example I want to send messages like
    <b>ENTERING METHOD "Execute".
    performing Mapping.
    Leaving METHOD "Execute".</b>
    to SXMB_moni.
    Is there any procedure so that I can send such customized messages in SXMB_moni.
    Usually we can send the debug messages or any log messages
    on a file , but what can be done for viewing in SXMB_MONI.
    Thanks,
    Yomesh

    Hi Yomesh,
    you can import the following class:
    com.sap.aii.mapping.api.MappingTrace
    you can use it to send trace data to the intergration server , which you can see in the trace file in SXMB_MONI.
    Cheers,
    Frank

  • Java mapping and monitoring

    Hello, does anybody know how to send tracing information to the XI monitor(SXMB_MONI) from within a Java mapping / XSLT mapping.
    Thank you
    /Ernesto

    You can use the following code in a user defined function in XI Mapping.  All of the trace messages are written to the SOAP message for the message in SXMB_MONI.
    MappingTrace trace;
    //First we get a handle to the trace object
    trace = container.getTrace();    
    //Here is how to write to the trace
    //Make sure your XI RUNTIME TRACE_LEVEL is set to 2 or 3
    trace.addInfo("You will see this info in SXMB MONI");
    //Here is how to write a warning
    //But make sure your RUNTIME TRACE_LEVEL is 1, 2 or 3
    trace.addWarning("Exception exception caught.");
    Jay Malla
    Licensed To Code
    Genentech SAP XI Team

Maybe you are looking for

  • HT4865 my apple ID changed but my icloud did not update with the info - how do i get icloud to use my new apple ID

    We updated our Apple ID's with our new email and home address etc... with no issues.  But.....icloud won't update and I can't figure out how to edit it.  It shows the old Apple ID info. 

  • RFBITB01 - posting detailed with single invoices

    Hi all, I tried to run the program RFBITB01 in order to perform the Posting of the failed payment transaction, The only problem is that when the program performs the posting  "customer @ Bank" i need the details about the invoices related the origina

  • Screen Exit in Transaction LM50

    Hi Experts, I created a screen exit for transaction LM50 (Count Inventory By System Guided). I created the subscreen SAPLXLRF 7152 because i need to add a field, this screen replace screen 2152. In transaction CMOD i created and activated a new proje

  • Fails to Recognize Symantec Update

    I am a college student (junior) who is required to run Cisco Clean Access Agent and Symantec. For the past two years, it seems Cisco does not recognize the update Symantec downloads. Every week, when I have to re-log into Cisco, I get the following e

  • Add an Object Authorization to a standard transaction

    Hello everybody, I have to add an authorization to MB1C so that the user can't introduce a specific movement to a type of material and it can to other type of material. I've not found some standard object what do it this. So I've created a new object