Issue in Java Mapping

Hi
I 'm doing Java mapping implementation in one interface. Where I have tested mapping through console, it is working fine. However,when i upload .jar file into XI server, there it has been tested with unit test. It fails because of " saying one xxxxx.class file is not found". Infact, it is there in the jar. I have cross check in jar file that was uploaded to XI. Please suggest me how do i approach this issue?
Thanks

Hi Abhishek..
Thanks for u r response.
I suppose, Java version doesn't impact on package access. Since as we do for normal java class which would be bound as package includes in same jar file that we had uploaded in XI server. However, we are accessing the class irrespective of standard jar.
In simple, as we normally can create custom jar file which we could put some class files in the same jar.
pLZ Advice me further.
Thanks once again.

Similar Messages

  • Issue with java mapping in a multi-mapping scenario

    Hi
        We have  a 1:n multiple mapping scenario in XI and the source is R3 proxy and target side is files. So, creating multiple file from a single message from R3 .
    R3 --> XI --> Multiple files
    Structure of the output of the multi-mapping is
    - <ns0:Messages xmlns:ns0="http://sap.com/xi/XI/SplitAndMerge">
    - <ns0:Message1>
    <Transaction>
    </Transaction>
    <Transaction>
    </Transaction></ns0:Message1>
    </ns0:Messages>
    wherein each Transaction node represents a file.
    Now, we need to introduce a constant /string like
    <!DOCTYPE Transaction PUBLIC \"-//XXXXXX//DTD BatchReceiptAuthorization//EN\" \"http://dtd.XXXXXXX.com/dtds/ReceiptAuthorization.dtd\">
    on each of the files at the very beginning - i.e within each transaction node , in the above structure, we need the above DTD string to be written.  To do this, we added a java mapping as the second mapping after the message mapping that creates this string. Is this the right approach and would it produce what we are expecting ?
    import java.io.BufferedReader;
    import java.io.InputStream;
    import java.io.InputStreamReader;
    import java.io.OutputStream;
    import java.util.Map;
    import com.sap.aii.mapping.api.StreamTransformation;
    import com.sap.aii.mapping.api.StreamTransformationException;
    import com.sap.aii.mapping.api.StreamTransformationConstants;
    import com.sap.aii.mapping.api.DynamicConfiguration;
    import com.sap.aii.mapping.api.AbstractTrace;
    public class ModifyRootAndDelay implements StreamTransformation {
         AbstractTrace myTrace;
    public void execute(InputStream input, OutputStream output) throws StreamTransformationException {
              try{
                   BufferedReader reader = new BufferedReader(new InputStreamReader(input));
                   String NameSpacePrefix = "<!DOCTYPE Transaction PUBLIC \"-//innotrac//DTD BatchReceiptAuthorization//EN\" \"http://dtd.innotrac.com/dtds/ReceiptAuthorization.dtd\">";
                   String sLine = null;
                   StringBuffer XmlMsg= new StringBuffer();
                   String Result,PayloadBody;
                   int indexOfFirst;
                   while ((sLine = reader.readLine()) != null) {
                        XmlMsg.append(sLine);
                   String StartingTag = XmlMsg.toString();
                   indexOfFirst = StartingTag.indexOf("<MerchantID>") ;
                   PayloadBody=new String(XmlMsg.substring(indexOfFirst));
                   Result=NameSpacePrefix.concat(PayloadBody);
                   output.write(Result.getBytes());
              /*     Thread.sleep(200000); */
              }catch(Exception e){
                   myTrace.addWarning("Exception raised in the JavaMapping:modifyNamespace.java""\n The Exception Message: " e.getMessage());
                   throw new RuntimeException(e.getMessage()) ;
            }     public void setParameter(Map param) {
              myTrace = (AbstractTrace) param
                        .get(StreamTransformationConstants.MAPPING_TRACE);

    Hi XI Gurus
                       In my scenario, I sent the inputstream that is being passed to the Java execute method - to trace and I see that the whole of the xml file - as shown below  - which is the output of message mapping ( from the first mapping step ) in sent to the execute method of the java mapping a single call
    <ns0:Messages xmlns:ns0="http://sap.com/xi/XI/SplitAndMerge">
    <ns0:Message1>
    <Transaction> </Transaction>
    <Transaction> </Transaction>
    </ns0:Message1>
    <ns0:Messages>
    So, I modified Java mapping program to look for multiple occurences of <Transaction> tag and prefix them with my constant DTD Literal - which is the primary reason , why I had to use Java mappings after the message mapping.
    Now, I get an error is XI- SXMB_MONI
    - <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="MAPPING" />
      <SAP:P1>unexpected symbol; expected '<', '</', entity refe</SAP:P1>
      <SAP:P2>rence, character data, CDATA section, processing i</SAP:P2>
      <SAP:P3>0</SAP:P3>
      <SAP:P4>113</SAP:P4>
      <SAP:AdditionalText />
      <SAP:ApplicationFaultMessage namespace="" />
      <SAP:Stack>The exception occurred (program: CL_XMS_MAIN===================CP, include CL_XMS_MAIN===================CM00A, line: 609)</SAP:Stack>
      <SAP:Retry>M</SAP:Retry>
      </SAP:Error>
    Should I create multiple outputs - as many as the numberof target split files ( of type outputstream ) from the execute method in the java program ?

  • Java Mapping in pi 7.1 using pi 7.1 nwds

    I am writing a program to remove the special chars in NWDS Java mapping. this is for replacing the "&" with "&amp;".. I am able to compile it and import the jar in PI.. but it does not do anything.. please check..
    And also let me know where to check for Java mapping executed with trace detail.. to check if any error
              try {
              int read_data;
              while ((read_data = arg0.getInputPayload().getInputStream().read()) != -1) {
                   if (read_data != '&') {
                        arg1.getOutputPayload().getOutputStream().write(read_data);
                        } else {
                             arg1.getOutputPayload().getOutputStream().write("&amp;".getBytes());
              arg1.getOutputPayload().getOutputStream().flush();
              }catch (Exception e) { }

    Dear Gopal,
    If i not wrong you need to replace all the charecters "&" with blank ...
    if so you can this code for doing that..
    String outData = inData.replaceAll("&","");
    or
    you need to replace any special charecter to blank please clarify..
    so that i can help you out to solve this issue using java mapping..
    Regards
    Vijay

  • Issue in conversion ABAP to java mapping during PI upgrade

    Hi All,
    We are upgrading one interface from ABAP mapping to Graphical/Java mapping in PI upgrade.(7.1 dual stack to 7.4 version)
    In ABAP mapping there is character conversion like below.
      encoding    = '1164'
          replacement = '?'
    We want to implement the same functionality either through Java or graphical mapping . But we are not sure what are the range  of characters that need to be converted to '?' and also what is the most optimized way to achieve this functionality.
    Below are few sample of characters coming in the file:
    б,л,к,У,М,л,и,о,ф..etc

    hi all,
    the issue got resolved with a JAVA replace function
    String r = str.replaceAll("\\P{InBasic_Latin}", "?");
    Thanks all for your inputs.
    Regards,
    Anamika

  • Java Mapping Issue

    Hi,
    I'm new to JAVA mapping and I'm having an issue which I can't get resolved :
    When I execute my mapping I get :
    <SAP:Error xmlns:SAP="http://sap.com/xi/XI/Message/30" xmlns:SOAP="http://schemas.xmlsoap.org/soap/envelope/" SOAP:mustUnderstand="">
      <SAP:Category>Application</SAP:Category>
      <SAP:Code area="MAPPING">LINKAGE_ERROR</SAP:Code>
      <SAP:P1>XIFileNameMapClass</SAP:P1>
      <SAP:P2>http://notimportant.com/xi/SOOFT</SAP:P2>
      <SAP:P3>068fe9b0-44d1-11db-c69d-ee989e43162e</SAP:P3>
      <SAP:P4>-1</SAP:P4>
      <SAP:AdditionalText />
      <SAP:ApplicationFaultMessage namespace="" />
      <SAP:Stack>Incompatible class versions (linkage error)</SAP:Stack>
      <SAP:Retry>M</SAP:Retry>
      </SAP:Error>
    I'm using eclipse for the java class and I have choosen several jre versions to create the .jar file but all lead to the same error.
    I had copied the required aii_map_api.jar.jar from xi box to my local project directory and added it as an external .jar to my project.
    But since I new to JAVA and unsure on what exactly is going into the jar and what not.
    Is it important with which jre version you build the java class ? ( Xi is running on 1.4.2_12 ) I tried first with 1.5.0_06 and then with 1.4.2_9 and then 1.4.2_13 all with the same result.
    I do this by adding a different jre to the properties of my project. And then I export to the .jar file . Is that enough ? ( I was expecting something like a 'build' option somewhere but I can't find that in eclipse )
    When I imported the archive in XI, I also see a .Classpath , a .project , SAP_AG_G.RSA and a SAP_AG__G.SF file.
    This reminds me of those ugly .dll incompatibilities which I had hoped not occurring with JAVA...:(
    Any ideas ?
    PS We are on XI 7.0 SP8 ( so the older note 755302 is not relevant )

    Hi all,
    I did understand that I had something todo with different versions ( as I started to make a first attempt with version jre 1.5 and then with other versions )
    But somehow I apparently couldn't get my .jar file to be compiled to a 1.4.2_xx
    ( although I tried numerous settings in the Eclipse build path etc...)
    Finally, I removed the 1.5 version and started from scratch using jre 1.4.2_10.
    And now it works OK !
    I'm sure you can configure Eclipse correctly to generate 1.4 compatible jar files ( even when running itself on 1.5 or above ) but I must have missed the right combination of settings ( as I said I'm new in Java / Eclipse....)
    regards
    Dirk

  • Java mapping & namespace issue

    Hello,
    I am doing a java mapping from a flat file to an IDOC. After the document is mapped succesfully I call an RFC via the Adapter. When monitoring the adapter I get the error:
    com.sap.aii.af.rfc.RfcAdapterException: failed to read funtionname from XML document: missing namespace declara
    so I added the namespace reference to my java mapping to look like this :
    <ns0:IDOC_INBOUND_ASYNCHRONOUS xmlns:ns0="urn:sap-com:document:sap:rfc:functions">
    But when I test my java mapping in the builder (interface mapping) the namespace xmlns="urn:sap-com:document:sap:rfc:functions" is added to my above ns0:IDOC_INBOUND_ASYNCHRONOUS tag. The consequence is that while mapping in the integration engine the "ns0" prefix is then removed and I get the error:
    Delivery of the message to the application using connection AFW failed, due to: error while processing message to remote system:com.sap.aii.af.rfc.core.client.RfcClientException: functiontemplate from repository was.
    Any help or sample code resolving the namespace issue is welcome.
    Frank

    Hi Frank,
    I am getting the same error message. You fixed yours. Can you help me with mine. The error message is
      " Delivery of the message to the application using connection AFW failed, due to: error while processing message to remote system:com.sap.aii.af.rfc.core.client.RfcClientException: functiontemplate from repository was ."
    I am trying to send data to SAP SRM4.0 from SAP R/3 using SAP XI. XI content is delivered by SAP.
    The message is sent from R/3 to XI successfully and the XML monitor does not show any errors in XI . But the messages does not show up in SRM.
    Thanks
    Kishore.

  • XSLT & JAVA Mapping issue.

    is there any situation,
    where we should definately go for XSLT mapping..
    where we should definately go for JAVA mapping..
    can anyone brief me plz....
    Cheers,
    Raghavesh

    No hard and fast rules.
    There never can be specific rules.
    1. Java Mapping should be used when the input is NON XML for sure. As the input is a InputSTream, you can convert it to a string and do the needful programmic logic etc.
    2. XSL can be used with HTML source etc.
    Regards
    Bhavesh

  • Handling Character Entities - Java Mapping Issue

    Hi Experts,
        I need to replace the character entities in my input XML. But, the problem is the java mapping I've written isn't replacing  the character entities as expected.  For example if my input XML  contains <NAME>&><XYZ</NAME>, then the ouput is <NAME>&amp:&gt:<0001&lt:/NAME>, whereas it should be <NAME>&amp:&gt:&lt:0001</NAME>.
    Note: I've used : instead of ; just to show it properly SDN.
    Can any of you share the code for the same if you've used it already?
    Thanks a lot in advance.
    Regards,
    Hussain.

    Hi Pooja,
        Thanks for your prompt reply.
    Are you trying to use the java mapping just to handle the character entities or your interface itself only has a java mapping?
                   - I'm using Java Mapping just to handle the character entities. Say my input XML looks like
    <?xml version="1.0" encoding="UTF-8"?>
    <resultset>
    <row>
    <ID>&<1</ID>
    <MESSAGE><![CDATA[<?xml version="1.0" encoding="UTF-8" ?><LGORT>&<0001</LGORT>]]></MESSAGE>
    </row>
    </resultset>
    I need to replace &< in <ID> to &amp:&lt: and similarly for CDATA <LGORT>&amp:&lt:0001</LGORT> before I process it in XI. In my java mapping I read the whole XML as string (line by line as mentioned below) and try to replace the character entities using some logic, which isn't working properly.
    StringBuffer buffer = new StringBuffer();
    BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream, "UTF-8"));
    for (String lineRead = reader.readLine(); lineRead != null; lineRead = reader.readLine()) {
           buffer.append(lineRead);
    I've also checked the thread mentioned by Srinivas. But, StringEscapeUtils.escapeXml() would replace all the character entities like &lt:?XML... , which would result in an invalid xml...
    Please suggest.
    Thanks,
    Hussain.

  • Empty file, java mapping issue

    Hello,
    does anyone have an ide how to create java mapping to create empty file on FTP?
    Why this code always send NUL character = 1byte and not 0 byte as needed?
    public void execute(InputStream in, OutputStream out) throws StreamTransformationException {
    out = null;

    try 1 thing...
    run ur code for some standalone file.
    create a file at ur local harddisk and check out its size..
    i had tried creating such a file using the code below....
    it is creating a 0 byte file successfully.
    public class TestCode {
         public static void main(String ags[]){
         try{
         TransformerFactory tf = TransformerFactory.newInstance();
         Transformer transform = tf.newTransformer();
         FileOutputStream out;
         out = new FileOutputStream("c:
    OutTestCode.xml");
         transform.transform(null, new StreamResult(out));
         } catch (FileNotFoundException e1) {
              e1.printStackTrace();
         } catch (TransformerConfigurationException e) {
              e.printStackTrace();
         } catch (TransformerException e) {
              e.printStackTrace();

  • Java mapping runtime issue

    Hi,
    I have currently created a java mapping which unzips files and transforms plain text/falt files to xml according to a specific structure... So far so good. This stuff works perfectly when testing interface mapping in the repository. However at runtime it does not work, and this is where you clever guys come into the picture:-)
    It should be mentioned that the zip-file is dropped on a MQ-queue and picked up in XI and passed on to a BPM - the only thing the BPM does is to perform the java mapping and afterwards send one of the messages to R/3 and the other to CRM.
    The concrete error given at runtime in the PE is:
    Error handling for work item 000000718016
    Work item 000000718016: Object CL_SWF_XI_MSG_BROKER method CALL_TRANSFORMATION cannot be executed
    Parsing error before mapping: unexpected end-of-file (line 1, column 1)
    Hope somone can help me on this matter,
    Best regards,
    Daniel
    PS: In case it is of interest/use the java code used is this:
    package dk.post.xi.unzipAndConvert;
    import java.io.*;
    import java.util.Map;
    import java.util.HashMap;
    import java.util.zip.ZipEntry;
    import java.util.zip.ZipInputStream;
    import com.sap.aii.mapping.api.MappingTrace;
    import com.sap.aii.mapping.api.StreamTransformation;
    import com.sap.aii.mapping.api.StreamTransformationConstants;
    import com.sap.aii.mapping.api.StreamTransformationException;
    public class UnzipMain implements StreamTransformation {
         private MappingTrace mappingTrace = null;
         private Map param = null;
         private StringBuffer currentXmlRecord = new StringBuffer();
        private StringBuffer currentPlainRecord = new StringBuffer();
        private int[][] dataRanges = null;
        private char[] charsInCurrentRange = new char[650];
         private String[] xmlTagNames = null;
         /* (non-Javadoc)
    @see com.sap.aii.mapping.api.StreamTransformation#setParameter(java.util.Map)
    Method must be implemented when class is implementing streamTransformation
           public void setParameter(Map param) {
            this.param = param;
            if (param == null) {
               this.param = new HashMap();
    (non-Javadoc)
    @see com.sap.aii.mapping.api.StreamTransformation#execute(java.io.InputStream, java.io.OutputStream)
    Main function -- called by XI to start execution of java mapping
           public final void execute(InputStream in, OutputStream out)
                throws StreamTransformationException
                //if no input, then cancel program execution
                if (in == null) {
                     throw new RuntimeException("Something wrong with input zip file - is null");
                //input <> null. Begin upzip operation
                try {
                     //test is only relevant outside of XI
                     if (param != null) {
                          mappingTrace = (MappingTrace) param.get(StreamTransformationConstants.MAPPING_TRACE );
                  ZipInputStream zip = null;
                     try {
                          zip = new ZipInputStream(in);
                          ZipEntry ze = null;
                          out.write("<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?><ns0:Messages xmlns:ns0=\"http://sap.com/xi/XI/SplitAndMerge\">".getBytes());
                          while ((ze = zip.getNextEntry()) != null) {
                               writeDebugInfo("File: " + ze.getName() + " with compressed size: " + ze.getCompressedSize());
                               scrutinize(zip,(ZipEntry) ze, out);
                          out.write("</ns0:Messages>".getBytes());
                     finally {
                          if (zip != null)
                               zip.close();
                          out.flush();
                          out.close();
                } catch (Exception e) {
                     throw new RuntimeException(e + "\nSomething went wrong...");
           //Unzip flat files and convert to xml
           private void scrutinize(ZipInputStream inStream,ZipEntry zipEntry, OutputStream outstream) throws Exception {
                long start = System.currentTimeMillis();
              InputStreamReader inStreamReader = null;
              BufferedReader buffReader = null;
              byte[] xmlBytes = null;
              try {
                   inStreamReader = new InputStreamReader(inStream);
                   buffReader = new BufferedReader(inStreamReader);
                 boolean masterData = zipEntry.getName().equals("PD-01-STAMDATA.DAT");
                 boolean creditData = zipEntry.getName().equals("PD-02-KREDITVURDERING.DAT");
                 String currentLine = null;
                 if (masterData) {
                      writeDebugInfo("- Begin reading and converting every line of MasterData...");     //out-comment this outside of XI, or compilation will fail (functionality is only available in XI)
                      outstream.write("<ns0:Message1><ns1:masterData_MT xmlns:ns1=\"http://pdk/xi/kob/importDataToSap\">".getBytes());
                        while ((currentLine = buffReader.readLine()) != null) {
                           //convert one line of credit data plain into an xml record structure
                           makeXmlRecord(currentLine,true);
                           //Write record XML to XI's outputstream (appends)
                           xmlBytes = currentXmlRecord.toString().getBytes();
                           outstream.write(xmlBytes);
                      outstream.write("</ns1:masterData_MT></ns0:Message1>".getBytes());
                      writeDebugInfo("- Finished reading and converting every line of MasterData...");     //out-comment this outside of XI, or compilation will fail (functionality is only available in XI)
                 if (creditData) {
                      writeDebugInfo("- Begin reading and converting every line of CreditData...");
                      outstream.write("<ns0:Message2><ns1:creditData_MT xmlns:ns1=\"http://pdk/xi/kob/importDataToSap\">".getBytes());
                      while ((currentLine = buffReader.readLine()) != null) {
                           //convert one line of credit data plain into an xml record structure
                           makeXmlRecord(currentLine,false);
                           //Write record XML to XI's outputstream (appends)
                           xmlBytes = currentXmlRecord.toString().getBytes();
                           outstream.write(xmlBytes);
                      outstream.write("</ns1:creditData_MT></ns0:Message2>".getBytes());
                      writeDebugInfo("- Finished reading and converting every line of CreditData...");
              } finally {
                   long timeUsed = System.currentTimeMillis() - start;
                   writeDebugInfo(zipEntry.getName() + "  - Write took: " + timeUsed + " ms");
                   writeDebugInfo("Final statement entered...\n");
           //check for invalid xml chars (plus a few other strange chars) in a plain text record and if any are found update the ranges of so they correspond to the new length of a record
           private int[][] checkRange(String currentPlainLine, boolean isMasterData) {
                int counter = 0;
                int beginRange = 0;
                int endRange = 0;
                //populate array with proper data ranges/intervals according to how data is to be split
                dataRanges = isMasterData ? new int[][] {{0,2},{2,12},{12,44},{44,47},{47,50},{50,295},{295,298},{298,356},{356,426},{426,496},{496,499},{499,506},{506,510},{510,518},{518,540},{540,546},{546,552},{552,558},{558,564},{564,570},{570,576},{576,582},{582,588},{588,594},{594,604}} : new int[][] {{0,2},{2,12},{12,20},{20,23},{23,26},{26,29},{29,44}};
                //ensure stringbuffer is empty
                currentPlainRecord.delete(0,currentPlainRecord.length());
                //insert the current plain text line into stringbuffer
                currentPlainRecord.append(currentPlainLine);
              //loop through outer array (array of ranges)
              for (int i = 0; i <= (dataRanges.length-1); i++) {
                   beginRange = dataRanges<i>[0];
                   counter = beginRange;
                   endRange = dataRanges<i>[1];
                   //loop through stringbuffer, based on the value-pairs of ranges/intervals in array of arrays
                   while (counter < endRange) {
                        switch (currentPlainRecord.charAt(counter)) {
                             case '&':
                                  currentPlainRecord.insert(counter+1,"amp;");          //insert 'amp;' after '&', so that syntax conforms to xml syntax requirements (&amp;)
                                  counter += 5;                                                   //increment counter so that it continues after insertet characters
                                  updateRange(counter,4);                                        //update the array of ranges so that is corresponds to the new range
                                  break;
                             case '\'':
                                  currentPlainRecord.replace(counter,counter+1,"&");     //replace '\'' with '&'
                                  currentPlainRecord.insert(counter+1,"apos;");          //insert 'apos;' after '\'', so that syntax conforms to xml syntax requirements (&apos;)
                                  counter += 6;                                                   //increment counter so that it continues after insertet characters
                                  updateRange(counter,5);                                        //update the array of ranges so that is corresponds to the new range
                                  break;
                             case '"':
                                  currentPlainRecord.replace(counter,counter+1,"&");     //replace '"' with '&'
                                  currentPlainRecord.insert(counter+1,"quot;");          //insert 'quot;' after '"', so that syntax conforms to xml syntax requirements (&quot;)
                                  counter += 6;                                                   //increment counter so that it continues after insertet characters
                                  updateRange(counter,5);                                        //update the array of ranges so that is corresponds to the new range
                                  break;
                             case '<':
                                  currentPlainRecord.replace(counter,counter+1,"&");     //replace '<' with '&'
                                  currentPlainRecord.insert(counter+1,"lt;");               //insert 'lt;' after '&', so that syntax conforms to xml syntax requirements (&lt;)
                                  counter += 4;                                                   //increment counter so that it continues after insertet characters
                                  updateRange(counter,3);                                        //update the array of ranges so that is corresponds to the new range
                                  break;
                             case '>':
                                  currentPlainRecord.replace(counter,counter+1,"&");     //replace '>' with '&'
                                  currentPlainRecord.insert(counter+1,"gt;");               //insert 'gt;' after '&', so that syntax conforms to xml syntax requirements (&gt;)
                                  counter += 4;                                                   //increment counter so that it continues after insertet characters
                                  updateRange(counter,3);                                        //update the array of ranges so that is corresponds to the new range
                                  break;
                             case 0x7F:
                                  currentPlainRecord.replace(counter,counter+1," ");     //replace 0x7F with ' '
                                  writeDebugInfo("-- Corrected the character 0x7F ('') to ' '");
                                  counter++;
                                  break;
                             case '‘':
                                  currentPlainRecord.replace(counter,counter+1," ");     //replace 0x91 ('‘') with ' '
                                  writeDebugInfo("-- Corrected the character '‘' to ' '");
                                  counter++;
                                  break;
                             case '›':
                                  currentPlainRecord.replace(counter,counter+1," ");     //replace 0x9B ('›') with ' '
                                  writeDebugInfo("-- Corrected the character 0x9B to ' '");                              counter++;
                                  break;
                             case '†':
                                  currentPlainRecord.replace(counter,counter+1," ");     //replace '†' with ' '
                                  writeDebugInfo("-- Corrected the character '†' to ' '");
                                  counter++;
                                  break;
                             default :
                                  counter++;
                                  break;
                return dataRanges;
           //update array of ranges so that is corresponds to the new range
           private void updateRange(int currentRange, int updateRangeBy) {
              for (int k = currentRange; k < dataRanges.length; k++) {
                   if (k != currentRange) {     //never update begin interval for the current range - only for the remaining intervals
                             dataRanges[k][0] += updateRangeBy;
                   dataRanges[k][1] += updateRangeBy;     //always update end intervals
           //convert one flat record line to a xml record structure
         private void makeXmlRecord(String currentPlainLine,boolean isMasterData) {
              dataRanges = checkRange(currentPlainLine,isMasterData);
              //clear StringBuffer
              currentXmlRecord.delete(0,currentXmlRecord.length());
              //get the correct set of xml tags to be used when performing mapping between plain text and xml
              if (isMasterData) {
                   xmlTagNames = new String[] {"dum1","kob_no","dum2","corp_status","legal_form","dum3","pr_protec_code","dum4","uri","email","emp_no_grp_code","exact_no_emp","dum5","founding_date","dum6","main_industry_code","industry_code1","industry_code2","industry_code3","industry_code4","industry_code5","industry_code6","industry_code7","industry_code8","dum7"};
              } else {
                   xmlTagNames = new String[] {"dum1","kob_no","rating_date","rating_value","risc_grp_code","currency","max_credit"};
              //copy all chars in stringBuffer to the specified char[]
              currentPlainRecord.getChars(0,currentPlainRecord.length(),charsInCurrentRange,0);
              //populate XML record structure
              currentXmlRecord.append("<record>");
              for (int i = 0; i < xmlTagNames.length; i++) {
                   currentXmlRecord.append("<" + xmlTagNames<i> + ">");
                   currentXmlRecord.append(charsInCurrentRange,dataRanges<i>[0],(dataRanges<i>[1])-(dataRanges<i>[0]));
                   currentXmlRecord.append("</" + xmlTagNames<i> + ">");
              currentXmlRecord.append("</record>");
         //write debug information to correct "place"
         private void writeDebugInfo(String debugInfo) {
              if (mappingTrace == null) {
                   System.out.println("Debug: " + debugInfo);
              } else {
                   mappingTrace.addInfo("Debug: " + debugInfo);

    Hi Alex,
    Thanks for your reply. First of all I was wondering if I missed something somewhere in my generel understanding of XI and BPM's!? - I kind of sense some irony/sarkasm in beginning of your reply:-) As far as I know BPM should have no trouble receing non-xml (in my case zip-files)!?
    Anyways here goes:
    1. Yes, this is also my impression that is should be possible somehow (we do currently run sp14). However, I havent yet figured out how to do it in this case. When trying to create interface mapping between the three involved software components, I get a 'MESS_MULTI_MAP_IF_WRONG_SWCV' three times. I've searched around without being able to find any information on the error. I does seem, though, like the problem is that all objects aren't in the same software component!! But this approach is of course the prefered one...
    2. Well - you got me there. Kind of expected someone to point that out:-) This is of course something to be looked into also in order to "improve"/"enhance" the program - though it, as already pointed out, works perfectly as is.
    3. This part I have also thought about - though quickly moved away from the idea, but that is only due to lacking insight/knowhow on the subject. Interesting weblog you have written, something so I will investigate further when  time allows for it:-)
    Best regards,
    Daniel

  • Error while doing java mapping

    Hi,
    I have written a java mapping code .But i have a small doubt when i compile it it is showing errors that package com.sap.aii.mapping.api does not exist.How can i solve the problem.Please help me in this issue.
    Thanks,
    Bhargav

    Hi ,
    check this thread, it may help you.
    https://forums.sdn.sap.com/click.jspa?searchID=3558715&messageID=3229273
    Regards,
    Ramesh.

  • Creation of additional attachment in Java Mapping

    Hello all,
    I want to use a Java Mapping with the functionality to create a second /attachment which I can send over email out?
    I don’t want to pick this file somewhere from the server, instead I want to fill the content of the additional attachment directly in the java mapping.
    I hope somebody knows the answer of my question.
    If its possible is there any kind of example??
    Many thanks for your help
    ilka

    hi Stefan,
    http://scn.sap.com/thread/1874962
    Regarding the comment in this thread, can you please tell me if you have faced any issue with creating output attachments. Right now, i have a message mapping in which i have written a udf to create attachments
    this message mapping is a multi mapping and the source is 0-unb. I have used a return as xml on the root message and pointed it to the udf after split by value.
    There are three root nodes in one of my cases, and when this goes through this mapping, there is 1 attachemnt each created with three main documents and submain documents. However, all the attachments contain details of the first root node itself where in actually it should be each main and submain document having a different attachment. Please find my udf below. Please let me know if you think it is wrong somewhere.
    udf :-
    GlobalContainer globalContainer = container.getGlobalContainer();
    OutputAttachments outputAttachments = globalContainer.getOutputAttachments() ;
    int flag =0;
    AbstractTrace trace = container.getTrace();
    String attachmentName = "";
    //for(int i=0;i<var1.length;i++){
    try
    var1=var1.replaceAll("><",">\n<");
    attachmentName = "attachment"+cnt;
    Attachment newopAttachment = outputAttachments.create((attachmentName), var1.getBytes("UTF-8"));
    outputAttachments.setAttachment(newopAttachment);
    trace.addInfo("newopAttachment"+newopAttachment);
    cnt=cnt+1;
    attachmentName ="";
    newopAttachment = null;
    var1="";
    catch (Exception e)
    trace.addInfo("ever reaching trace");
          e.printStackTrace(); 
    //result.addValue("1");  
    //result.addValue("1");  
    return "1";
    Input :-
    Messages
    Message1
    SBDH
    SBDH
    SBDH
    Each of the above SBDH, i have returned as xml and pointed to the udf after split by value
    Your help is highly appreciated.
    Regards,
    Ninu

  • Java Mapping - Not able to compile .Java file

    Hi Experts,
    I am working with a sample scenario which involves Java Mapping. For this I created MappingClass.java file, After compiling the .Java file .Jar file would be used for Java Mapping by using Imported Archives.
    After compiling the MappingClass.java file, I am getting the errors as below.
    --> Java errors after compilation
    C:\j2sdk1.4.2_13\bin>javac MappingClass.java
    MappingClass.java:4: package com.sap.aii.mapping.api does not exist
    import com.sap.aii.mapping.api.AbstractTrace;
                                   ^
    MappingClass.java:5: package com.sap.aii.mapping.api does not exist
    import com.sap.aii.mapping.api.StreamTransformationConstants;
    --> End of java errors
    In the MappingClass.java file, I had given followed imports.
    import java.util.*;
    import com.sap.aii.mapping.api.AbstractTrace;
    import com.sap.aii.mapping.api.StreamTransformationConstants;
    Could some one please guide me to resolve this issue.
    Thanks in advance.
    ..Sree

    Hi
    I had copied " aii_map_api.jar " file in my Java Class path folder.. i.e " C:\j2sdk1.4.2_08\bin "     AND    " C:\j2sdk1.4.2_08\lib " folders too.. and even in C:\ i.e Root Drive also.
    After trying to Compile my java file (ex : MappingClass.java), still I am getting the errors.
    Errors shown as below.
    --> Errors
    C:\mytest>javac MappingClass.java
    MappingClass.java:2: package com.sap.aii.mapping.api does not exist
    import com.sap.aii.mapping.api.AbstractTrace;
                                   ^
    MappingClass.java:3: package com.sap.aii.mapping.api does not exist
    import com.sap.aii.mapping.api.StreamTransformationConstants;
                                   ^
    MappingClass.java:6: cannot resolve symbol
    symbol  : class AbstractTrace
    location: class MappingClass
        private static AbstractTrace trace = null;
                       ^
    MappingClass.java:12: cannot resolve symbol
    symbol  : class AbstractTrace
    location: class MappingClass
            trace = (AbstractTrace)inputparam.get(
                     ^
    MappingClass.java:13: cannot resolve symbol
    symbol  : variable StreamTransformationConstants
    location: class MappingClass
                       StreamTransformationConstants.MAPPING_TRACE );
                       ^
    5 errors
    --> End of Errors
    Could some one please guide me to resolve this issue.
    Thanks in advance.
    ..Sree

  • Java mapping in ccBPM works in PI 7.0 but fails in PI 7.1

    Hi guys,
    at the moment we are upgrading form SAP PI 7.0 to SAP PI 7.11.
    In a scenario for processing of incoming orders we use an ccBPM.
    In this ccBPM there is an mapping where the original xml document of the order are combined with some
    additional information form an web service (multi mapping 2 => 1)
    The result of this mapping is processed further to create an sales order in the backend.
    The multi mapping an java mapping is used.
    Now we are testing the scenario with PI 7.11 and it fails at this mapping step.
    in the workflow log following error occurs.
    An exception with the type CX_ST_MATCH_ELEMENT occ urred, but was neither handled locally, nor de
    Message no. W8899
    I tested the same message on out SAP PI 7.0 system and the whole ccBPM works well.
    When I extract the 2 messages from workflow log and paste them into the test tab of the operation mapping of Enterprise Service Builder of SAP PI 7.11, surrounding by the envelope used by multi mappings
    <ns0:Messages xmlns:ns0="http://sap.com/xi/XI/SplitAndMerge">
       <ns0:Message1>
                   XML MESSAGE 1
       </ns0:Message1>
       <ns0:Message2>
                   XML MESSAGE 2  
       </ns0:Message2>
    </ns0:Messages>
    the mapping works without error, but at runtime it fails, throwing the error mentioned above.
    What could be the reason for this error?
    Does the multi mapping change in PI 7.11 at runtime?
    Could it be a problem parsing the multi message?
    Any help appreciated.
    Kind regards
    Jochen

    Hi Raja,
    thanks for your suggest.
    I know this issue, the java class files are compiled using jdk 1.5.
    We made some more tests.
    e.g. created an dummy ccBPM with two mappings, one two spilt the incoming message in two messages (graphical message mapping) and one to merge this two messages to one message again (java mapping)
    the mapping works at design time on test tab, but fails with the same error at rumtime.
    Also we tested one single operation mapping with this two mappings (split via graphical mapping and merge via java mapping)
    This works also at design time but fails at runtime with a similar error shown in smq2
    The error message is Error ST_MATCH_FAIL occured. P1=element-start P2=M
    we tried to add the whole incoming message to the trace by
    getTrace().addWarning()
    but an trace object is never created in for this step in the workflow log.
    it seem whether you can not add trace messages using the command or that the error occures before this command will be used.
    Kind regards
    Jochen

  • Java Mapping PI 7.0 to 7.1

    Hi,
    The below mentioned code is for sending email with attachment using Java Mapping which was implemented in PI 7.0
    I know the API for PI 7.1 has changed, I changed the below code using extends AbstractTransformation using Transform instead of implements streamTransformation and few other changes but I get lot of issues.
    Could anyone point out what and all need to be changed in PI 7.1 for the below mentioned code. It would be greatly if anyone could let me know the changes
    package dynamicconfmail;
    import com.sap.aii.mapping.api.*;
    import java.io.BufferedReader;
    import java.io.ByteArrayInputStream;
    import java.io.ByteArrayOutputStream;
    import java.io.FileInputStream;
    import java.io.FileNotFoundException;
    import java.io.FileOutputStream;
    import java.io.IOException;
    import java.io.InputStream;
    import java.io.InputStreamReader;
    import java.io.OutputStream;
    import java.util.HashMap;
    import java.util.Map;
    import java.util.Properties;
    import javax.mail.*;
    import javax.activation.*;
    import javax.mail.internet.*;
    import javax.mail.util.ByteArrayDataSource;
    public class DynamicConfMail implements StreamTransformation {
        private Map param;
    //// Start of Main Class
    //         public static void main(String[] args) throws Exception
    //     try
    //     FileInputStream fin = new FileInputStream("c:/test/sam.txt");
    //     FileOutputStream fout =     new FileOutputStream("H:/test/sam2_O.txt");
    //     DynamicConfMail mapping = new DynamicConfMail();
    //     mapping.execute(fin, fout);
    //     catch (Exception e)     
    //     //   e.printStackTrace();
    // //End of Main Class
        public DynamicConfMail() {
        public void setParameter(Map map) {
            param = map;
            if (param == null) {
                param = new HashMap();
        public void execute(InputStream inputstream, OutputStream outputstream)
            int IO_BUFFER_SIZE = 4 * 1024;
                String llkj = "1111";
                String llkj_f = "llkj.txt";
                String llkj_dir = "/usr/sap/llkj/in";
                String xyzv = "9999";
                String xyzv_f = "xyzv.txt";
                String xyzv_dir = "/usr/sap/xyzv/in";
               String default_dir = "/usr/sap/Error";
               String Flag = "";
               String FileName = "";
            try
    //           The following is for the FileName in the File Adapter
                DynamicConfiguration conf = (DynamicConfiguration) param.get("DynamicConfiguration");
                DynamicConfigurationKey key = DynamicConfigurationKey.create("http://sap.com/xi/XI/System/File", "FileName");
                DynamicConfigurationKey key1 = DynamicConfigurationKey.create("http://sap.com/xi/XI/System/File", "Directory");
                InputStream ins = inputstream;
                // Start Copy the InputStream to OutputStream
                byte[] b = new byte[IO_BUFFER_SIZE];
                int read;
                StringBuffer out = new StringBuffer();
                 try {
                        while ((read = inputstream.read(b)) != -1)
                            out.append(new String(b, 0, read));
                            String InputString =  out.toString();
                            String substr = InputString.substring(2, 18);
                            System.out.println(substr);
                            if (substr.equals(llkj))
                                     System.out.println("The given string is equals");
                                     conf.put(key, llkj_f);
                                     conf.put(key1, llkj_dir );
                                       FileName = llkj_f;
                            else if (substr.equals(xyzv))
                                     System.out.println("The given string is equals");
                                     conf.put(key, xyzv_f);
                                     conf.put(key1, xyzv_dir);
                                       FileName = xyzv_f;
                            else
                                    conf.put(key1, default_dir);
                                    Flag = "F";
                                    System.out.println("The given string is not equals");
                                     FileName = substr;
                            // Writes to outputstream
                            outputstream.write(b, 0, read);
                        if (Flag.equals(""))
                         //* Code to Send Email*/
                            String att = outputstream.toString();
                            email obj1 = new email();
                          obj1.send("mailhost", "emailID", "Success", "Success", "emailID",InputString, FileName);
                         //End of Email          Code/
                        else if (Flag.equals("F"))
                        //* Code to Send Email*/
                            String att = outputstream.toString();
                            email obj1 = new email();
                         obj1.send("mailhost", "emailID", "Failed", "Failed", "emailID",InputString, FileName);
                        //End of Email          Code/
                catch (IOException ex)
                    ex.printStackTrace();
               // End of Copy the InputStream to OutputStream
            catch (Throwable throwable)
                throwable.printStackTrace();
       public class email {
         public void postMail(String mailhst, String recivers, String subject, String message, String from, String attachment, String FileName) throws MessagingException
              boolean debug = false;
                    byte[] AttByteArray = attachment.getBytes();
              Properties props = new Properties();
              props.put("mail.smtp.host", mailhst);
                    Session session = Session.getDefaultInstance(props, null);
              session.setDebug(debug);
                    Message msg = new MimeMessage(session);
              InternetAddress addressFrom = new InternetAddress(from);
              msg.setFrom(addressFrom);
                    String recipients[] = recivers.split(",");
              InternetAddress[] addressTo = new InternetAddress[recipients.length];
              for (int i = 0; i < recipients.length; i++)
                   addressTo<i> = new InternetAddress(recipients<i>);
                    msg.setRecipients(Message.RecipientType.TO, addressTo);
              msg.addHeader("MyHeaderName", "myHeaderValue");
              msg.setSubject(subject);
                    // Create the message part
                    BodyPart messageBodyPart = new MimeBodyPart();
                    // Fill the message
                    messageBodyPart.setText("TEST");
                    Multipart multipart = new MimeMultipart();
                    multipart.addBodyPart(messageBodyPart);
                    // Part two is attachment
                    messageBodyPart = new MimeBodyPart();
                    DataSource source = new ByteArrayDataSource("Test","text/plain", AttByteArray );
                    messageBodyPart.setDataHandler(new DataHandler(source));
                    messageBodyPart.setFileName(FileName);
                    multipart.addBodyPart(messageBodyPart);
                    // Put parts in message
                    msg.setContent(multipart);
                    Transport.send(msg);
         public void send(String mailhst, String recivers, String subject, String message, String from, String attachment, String FileName)
         try {
              this.postMail(mailhst, recivers, subject, message, from, attachment, FileName );
         catch (MessagingException mex) {
              System.out.println("send failed, exception: " + mex);
            class ByteArrayDataSource implements DataSource {
             byte[] bytes;
             String contentType;
             String name;
             ByteArrayDataSource( String name, String contentType, byte[] bytes ) {
               this.name = name;
               this.bytes = bytes;
               this.contentType = contentType;
             public String getContentType() {
               return contentType;
             public InputStream getInputStream() {
               return new ByteArrayInputStream(bytes);
             public String getName() {
               return name;
             public OutputStream getOutputStream() throws IOException {
               throw new FileNotFoundException();
    Edited by: PI-seeker on Feb 3, 2011 10:58 PM

    Thansk a lot for your link.
    I did implemented the same way as it mentioned, but I am getting the following error message
    SAP:Error SOAP:mustUnderstand="" xmlns:SAP="http://sap.com/xi/XI/Message/30" xmlns:SOAP="http://schemas.xmlsoap.org/soap/envelope/">
      <SAP:Category>Application</SAP:Category>
      <SAP:Code area="MAPPING">LINKAGE_ERROR</SAP:Code>
      <SAP:P1>dynamicconfmail/DynamicConfMail</SAP:P1>
      <SAP:P2>java.lang.UnsupportedClassVersionError: dynamiccon</SAP:P2>
      <SAP:P3>fmail/DynamicConfMail : Unsupported major.minor ve</SAP:P3>
      <SAP:P4>rsion 50.0</SAP:P4>
      <SAP:AdditionalText />
      <SAP:Stack>Linkage error while loading class dynamicconfmail/DynamicConfMail; java.lang.UnsupportedClassVersionError: dynamicconfmail/DynamicConfMail : Unsupported major.minor version 50.0</SAP:Stack>
      <SAP:Retry>M</SAP:Retry>
    I am sure that I need to do include some library files, but I couln't figure it out. Couls you pls help to resolve this. The following library jar files were included
    activation.jar
    aii_map_api.jar
    com.sap.xpi.ib.mapping.lib.jar
    jce.jar
    mail.jar
    JRE System Library.............is anything else missed out??
    By the way I included all these in Netweaver Developer studio , in JavaBuildPath ->Libraries.
    Added those jar files as external jar's for development and then compiled it and  exported as DynamicConfMailJar  and imported in PI .
    could anyone help?

Maybe you are looking for

  • How do I move movie files to the Movie folder in the Library?

    I imported various kinds of media into iTunes on my PC and a couple of Movie files and a few TV Show files ended up in the Music folder. I cannot figure out how to move them to their correct folder. The files are listed correctly by iTunes under Get

  • Can't add file to baggage files folder

    Hi, I have a javascript file I'm trying to add to the baggage files folder. However, for some reason, I can't add it. I'm using robohelp 6 and roboosource control 3.0. When I try to add the file, nothing is added to the folder. I was able to add the

  • Acrobat Reader v8 and vXI side-by-side installation

    Hi, A while back I bought a Fujitsu scanner which came with Acrobat Reader Standard ver.8. It has worked brilliantly over the years. The whole package - quality! Now Acrobat Reader has obviously evolved and we are now up to version XI and occasionaly

  • Gava SE 1.0, a Java IDE for international code,  released,

    Please go to check http://www.gavasoft.com for more information Gava is a Java Integrated Development Environment (IDE), built in pure Java, to develop Java applications and applets. Most part of Gava is developed in Gava itself. As a pure Java appli

  • Ca I stop TM from formatting external drive prior to backup?

    I bought an external drive to backup my Mac and my Pc. It is formatted as Fat32, acceptable both to Mac and Pc. When I tried to use Time Machine it asks to format the external drive -- which means it will be formatted for Mac only. Is there a way to