Message Mapping - Identify a number in a sting

Hello Guys,
                      There is a requirement to perform a conversion based on its length.
If the length of the incoming field is less than or equal to 20 characters pass the string directly to the target field.
If the length is more than 20 then find the number of excess characters and remove that many number of characters from the string before the first occuranace of number in the string to make the total length as 20 chars.
As an example, lets say if I have a string with a length of 22 like this " I have 4 books at home"
In the string 2 chars have to be removed before the number 4,  so that it has to look like "i hav4 books at home" which of length 20 char.
Some more examples :
"I have 14 keys and 1 pen" should be converted to "I h14 keys and 1 pen" (4 excess chars "ave " has been removed)
Have used this UDF and many combinations but that didn't work :
public String test2(String STREET1,Container container){  //STREET1 is the incoming field
int input = STREET1.length();
int Length = 30;
int a,b,c;
int Loc = -1;
String str = "";
String str1, str2 = "";
if(input<=30)
         str = STREET1;
//else
        for (int i = 0; i < STREET1.length(); i++)
                 if (Character.isDigit(STREET1.charAt(i)))
                           Loc = i;
         // No digit found, so truncate to 30 length streetStr
         if (Loc == -1)
               str = STREET1;
          // Digit found
        else
                       a = input - Length;
                        b = Loc - a;
     c = input - Loc;
     str1 = STREET1.substring(0,b-2);
     str2 = STREET1.substring(Loc,c);
     str = str1" "str2;
return str;
Please correct the code or provide a workaround.... Thanks

Hello,
this should be your code. I make a test with "I have 14 keys and 1 pen" and my result is "I h14 keys and 1 pen".
Regards, Björn
int input = text.length();
int Length = 20;
int a,b,c;
int Loc = -1;
String str = "";
String str1, str2 = "";
if(input<=Length)
  str = text;
  return str;
for (int i = 0; i < text.length(); i++)
     if (Character.isDigit(text.charAt(i)))
          Loc = i;
          break;
// No digit found, so truncate to 30 length streetStr
if (Loc == -1)
     str = text.substring(0,Length);
}else
     a = input - Length;
     b = Loc - a;
     c = Length - Loc;
     str1 = text.substring(0,b);
     str2 = text.substring(Loc,input);
     str = str1""str2;
return str;

Similar Messages

  • BPM flow instance identifier in message mapping

    Question: Is the unique instance identifier (number) of an executing BPM flow available to a message map being executed in a transformation step in the flow?  I'm thinking that it would be a parameter available in the container object, or something like that.  I would expect to need a user defined function to access it.
    Thanks,
    Chris

    I doubt that you can do that.
    All the StreamTransformationConstants that you can access can be found if you write
    StreamTransformationConstants.
    and press ctrl+space, in eclipse (or NWDS).
    Make sure you have
    import com.sap.aii.mapping.api.StreamTransformationConstants;
    and that you have added aii_map_api.jar to your project.
    Regards,
    Henrique.

  • Message mapping for checking hyphens (-) in material number

    Hi All,
    I have an interface in PI 7.1 for product change and product create coming from ORACLE to SAP
    Now, the reqmt is to take the ORACLE product which could have hyphens or without hyphens
    In SAP, the product can have upto 40 characters and if something without hyphens come in, then it adds leading zeros while creating and while changing, SAP expects a product with leading zeros
    So, how do I handle this? How do I check in message mapping, the product with hyphens or without and write a condition to it.
    Here is my idea
    Take the product, use a message mapping function to check for products without hyphens and if YES, add leading zeros upto 40 characters
    Can anyone let me know how this could be achieved using message mapping function
    I am sure this kind of reqmt especially leading zeros for products is very common in PI interface circle
    So, please let me know the details
    Thx
    mike

    Hi Mike,
                  your requirement can be solved without UDF too
    inputfield ---------------->
                                                 indexOf() ------------>  
    Constant(-)---------->                                                  less---->if ----->target field                                                                               
    constant(0)---------->
    inputfield  and contant (hyphen) are inputs to standard text function indexOf. Output of IndexOF and constant(zero) are inputs to standard arithmetic function less. Out put of less goes to boolean function if. The IF has two inputs then and else .
    For then part write this logic
    inputfield----> formatNumber()---->then
    in standard arithmetic function Formatnumber  specify number format with 40 zeroes, leave decimal separetor blank.
    Now for the else part of "IF" write this
    inputfield----->else
    Finally
    output of "IF" goes to target field
    IF------>target
    Regards
    Anupam

  • CcBPM Process Number in the Message mapping

    Hi,
    I  have a requirement to map the ccBPM's process number in which the Mapping error has occured to be mapped to a specific field in the target.  I wanted to know how could I pass the BPM's process number to the message mapping ( this message mapping(Service mapping) is a part of the same BPM).  If we could get the MESSAGE_ID of the message in the message mapping, we should also be getting the BPM Process number.
    In other words, when an alert is triggered in BPM, we get the BPM process number in its subject, i need that BPM process number in to the message mapping where that message has to be stored in a table in ECC.
    I have searched in help and SDN to check if some system properties can help, but i couldnt.  Any help/inputs from you is highly appreciated.
    Regards,
    Kalpana.

    Hi Manuel,
    it is very easy to to get the <b>Message ID</b>, which is unique and useful for selecting a message in the monitoring
    <a href="http://help.sap.com/saphelp_nw2004s/helpdata/en/b3/9a2aeb24dc4ab6b1855c99157529e4/content.htm">Special Access to Mapping Runtime Constants</a>
    You send a mail from Java Mapping or, what would be the standard, (as additional) message from BPM or just as normal Message Receiver or only in Error case as Alert receiver.
    Regards,
    Udo

  • Sequnce Number generation in Message Mapping..

    Hello All,
    I am using this thread as a reference for declaring a Counter for unique sequence number generation...
    Sequence Number in XI Mapping
    -> define a global variable by clicking the JAVA_SECTION_TOOLTIP icon on the design tab of source message type of ur message mapping.
    enter the following in the GlobalVariables Section
    Integer counter =0;
    -> define a user defined function (SeqGen let's say)
    write the following code in it.
    Integer seq = 0;
    GlobalContainer globalContainer = container.getGlobalContainer();
    a = globalContainer.getParameter("counter");
    seq = globalContainer.getParameter("counter");
    seq = seq + 1;
    globalContainer.setParameter("counter",seq);
    return a;
    now use this user defined function (SeqGen)in all ur mappings to the sequence no of ur line items.
    If u could just elaborate on creation of UDF.. on what are we goin to pass in the variable 'a'...  while creating the UDF. ??
    Harpreet..!!

    Hi harpeet,
    A UDF can be of two types a  Simple UDF and Adavnced UDF.
    This is a case of a simple UDF,
    A simple UDF returns only 1 element  as  an output. 
    here 'a' is such an generated output.   you can assign this to any numeric filed of ur target stucture
    This UDf does not require any input Field from the message. 
    These functions are known as generating functions.
    Hope this explains.
    Reward points if useful.
    Regards,
    Abhishek

  • I am getting text messages from a "textfree" number that cannot be identified

    I am getting text messages from a "textfree" number that cannot be identified. The text messages are threatening and I am trying to match the unknown number to a person. How can I do that?

    Hello uncl@home,
    Thanks for reaching out to us for assistance with unwanted texts on your device. After all, we're always here to help when you need us. I wanted to touch bases with you to see if the issue has been resolved. Just curious, are you getting unwanted texts from a 10-digit number? If so then you can have the texts blocked at www.vzw.com/spamcontrols. For all other unwanted texts, forwarding them to 7726 is the method to have them addressed. Let me know, just in case more options are needed.
    Thank you...
    ArnettH_VZW
    Follow us on Twitter @VZWSupport

  • Identifying which number a message is sent to for contacts with multiple numbers

    Hi there,
    Like many, I have a lot of contacts that have 2 or more mobile numbers stored against their name.
    I sent a message to a contact who has 3 numbers. A couple of days later I wanted to check to see to which number I sent the message but I couldn't see any way to display this from the message. The only information given is the contact name of the person I sent the message to, not the number.
    Surely there must be a way to do this by tapping on some part of the message. I tapped the message and got options "Copy/More" and "More" gives me the option to bin or forward. Tapping on Contact, gives me the contact name and phone/FT/info icons and tapping on the "i" icon displays the full contact details with the 3 numbers!
    The only way I got round this to find out which number it was, was to split the contact in to 3 different contacts as in Name 1, Name 2, and Name 3.This then allowed me to see the number because the message list updated depending on the number that was used. So really, the number is definitely there somewhere, but how to get it!
    Any ideas anyone please?
    Thanks,
    Maz

    Hey Maz K,
    Thanks for the question. This can be done by viewing the contact info in Messages. Simply tap “Contact” in the top right corner, then tap the icon. This will bring up the contact card, and the number the message was sent to will be highlighted in blue.
    View someone’s contact info in Messages.
    To quickly view someone's contact info in Messages, tap Contact.
    - Tap to call that person or to use FaceTime
    - Tap to see the person’s complete contact info
    If they're not already a contact, you can tap Create New Contact to add them.
    Messages - Learn more about iOS 7 and iPhone - Apple Support
    http://support.apple.com/kb/index?page=tidetail&product=iphone&locale=en_US&tag= Messages#TI136
    Thanks,
    Matt M.

  • Error when saving message mapping -

    Just upgradedto PI 7.1. System details below....
    Make Release NW07_08_REL  SPS Number 08  JDK Version jdk15
    Server Version SAP J2EE Engine 7.10.3710.43701.20090416112158
    Java Runtime Java(TM) 2 Runtime Environment, Standard Edition (version=5.1.034)
    Java Virtual Machine SAP Java Server VM (version=5.1.034)
    Operating System AIX (version=5.3, arch=ppc64)
    I've been building an interface to test the developer tools and when I save my message mapping (it's a very simple graphical mapping) I get a java popup with the text 'Internal GUI error', I'm using Java WS Version 1.5.0 (build 1.5.0_19-b02) as per the PI documentation.
    I recreated the problem timing each activity and saved the exception in a text file. I'm able to identify the relevant section of the exception biut it's meaningless to me. I searched SDN & OSS and I can't find any specific hits. Those that are similar (different SAP applications - WebDynPro for example) point towards incompatible s/w components - Java Run Time environment etc.... I've cleared the Java WS cache (Edit>Preferences>Delete Files) just to make sure, but the problem still occurs. I'm looking for advice. I've pasted some of the exception details below. I can provide more information but it's a pretty long file.
    Edited by: Rob Warde on Aug 5, 2009 4:27 PM

    Thrown:
    com.sap.aii.utilxi.swing.framework.FrameworkException: Internal problem occurred
         at com.sap.aii.utilxi.swing.toolkit.ExceptionDialog.init(ExceptionDialog.java:124)
         at com.sap.aii.utilxi.swing.toolkit.ExceptionDialog.<init>(ExceptionDialog.java:96)
         at com.sap.aii.utilxi.swing.toolkit.IBMessages$1.run(IBMessages.java:319)
         at com.sap.aii.utilxi.misc.thread.ThreadPool.assureAWTEventQueueing(ThreadPool.java:84)
         at com.sap.aii.utilxi.misc.thread.ThreadPool.assureAWTEventQueueing(ThreadPool.java:67)
         at com.sap.aii.utilxi.swing.toolkit.IBMessages.showException(IBMessages.java:309)
         at com.sap.aii.utilxi.swing.toolkit.IBMessages.showException(IBMessages.java:299)
         at com.sap.aii.utilxi.swing.toolkit.Guitilities$EventProcessor$1.run(Guitilities.java:395)
         at java.awt.event.InvocationEvent.dispatch(Unknown Source)
         at java.awt.EventQueue.dispatchEvent(Unknown Source)
         at com.sap.aii.utilxi.swing.toolkit.Guitilities$EventProcessor.dispatchEvent(Guitilities.java:319)
         at java.awt.EventDispatchThread.pumpOneEventForHierarchy(Unknown Source)
         at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
         at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
         at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
         at java.awt.EventDispatchThread.run(Unknown Source)
    Caused by: java.lang.NoSuchMethodError: com.sap.aii.ib.bom.mt.js.JavaSource.setMode(I)V
         at com.sap.aii.mappingtool.Project.getJavaFile(Project.java:324)
         at com.sap.aii.mappingtool.mf.MappingTool.getJavaFile(MappingTool.java:107)
         at com.sap.aii.mappingtool.fwutil.api.ViewUtil.prepareSave(ViewUtil.java:118)
         at com.sap.aii.ibrep.gui.mapping.xitrafo.XiMappingView.prepareSave(XiMappingView.java:269)
         at com.sap.aii.ib.gui.editor.DefaultPersistenceHandler.save(DefaultPersistenceHandler.java:153)
         at com.sap.aii.ib.gui.editor.XiDocument.save(XiDocument.java:335)
         at com.sap.aii.utilxi.swing.framework.cmd.SaveCommand.execute(SaveCommand.java:76)
         at com.sap.aii.utilxi.swing.framework.ExecutionContext.execute(ExecutionContext.java:198)
         at com.sap.aii.utilxi.swing.framework.ExecutionContext.executeSafe(ExecutionContext.java:154)
         at com.sap.aii.utilxi.swing.framework.CommandAction.actionPerformed(CommandAction.java:82)
         at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
         at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)
         at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
         at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
         at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Source)
         at java.awt.AWTEventMulticaster.mouseReleased(Unknown Source)
         at java.awt.Component.processMouseEvent(Unknown Source)
         at javax.swing.JComponent.processMouseEvent(Unknown Source)
         at java.awt.Component.processEvent(Unknown Source)
         at java.awt.Container.processEvent(Unknown Source)
         at java.awt.Component.dispatchEventImpl(Unknown Source)
         at java.awt.Container.dispatchEventImpl(Unknown Source)
         at java.awt.Component.dispatchEvent(Unknown Source)
         at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
         at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
         at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
         at java.awt.Container.dispatchEventImpl(Unknown Source)
         at java.awt.Window.dispatchEventImpl(Unknown Source)
         at java.awt.Component.dispatchEvent(Unknown Source)

  • XI message mapping clarifications

    Dear All                                                                               
    I would like to know if XI message mapping(graphical mapping) can be         
    used for mapping based on the order of elements given in the XML source          
    message.                                                                               
    For example I have a source message as below                                                                      
    Source XML:                                                                      
    <Source>                                                                         
    <givenname>Ramesh</givenname>                                                     
    <givenname>Kumar</givenname>
    <givenname>Ganapathy</givenname>                                                                               
    </Source>                                                                               
    semantic is first instance of <givenname> needs to be mapped <firstname> in target,                      
    Second occurance of <givenname> needs to be mapped <secondname>,                                
    Third occurance of <givenname> needs to be mapped <familyname>                                                                               
    Target XML                                                                       
    <Target>                                                                         
    <firstname>Ramesh</firstname>                                                    
    <secondname>Kumar</secondname>
    <familyname>Ganapathy</familyname>                                               
    </Target>                                                                               
    As I understand graphical mapping editor works based on Xpath                    
    expressions, Is it possible to achieve such mapping schematics with              
    graphical mapping and UDF in XI.
    Please note I cannot use Java, ABAP or XSLT mapping programme.
    Can you provide me some hints on how to do this.                                                                               
    Thanks                                                                           
    Satish

    Hi Chilla
    This is how I am currently handling it. But my problem is
    The number of UDF's keeps increasing if I have a fourth, fifth element to handle. I have to create new UDF for every new level added.
    Is there a way I can do this with single UDF.
    result.addValue(givenname(X));
    X- will be the position and I can pass values as an argument to the UDF.
    Again the problem here is when I have second argument to specify which value of input to pick up say for example  givenname(1) or givenname(2)
    The second argument expects an String[] array as argument and not string(when i assign a constant its a string).
    So I cannot attach a constant to the second argument and pass the input.
    Is there any functions that can return a String[] array as an output taking sting value as input.
    Thanks
    Satish

  • Hi , friends pls explain abap mapping and message mapping

    1) pls explain abap mapping and message mapping
       send me screen shorts also.

    Hi
    Mapping Techniques
    XI provides 3 standard ways of interface mapping between source and target.
    Graphical mapping
    Java Mapping
    XSLT Mapping
    Two more additional mapping types can be activated in XI by making changes to the exchange profile. Those two mappings are
    ABAP mapping
    XSLT mapping with ABAP Extensions
    Graphical Mapping
    Graphical mapping is a common approach followed by everyone for generating desired target structure. It involves simple drag-n-drop to correlate respective nodes (fields) from source and target structure. It hardly involves coding. (Exception - User defined functions). But sometimes with graphical mapping it is difficult to produce required output. For example ... text/html output, namespace change, sorting or grouping of records etc.
    ABAP Mapping
    A person comfortable with Object Oriented ABAP can go for ABAP mapping instead.
    Java Mapping
    Java Mapping uses 2 types of parsers. DOM and SAX. DOM is easier to use with lots of classes to help you create nodes and elements, but , DOM is very processor intensive.
    SAX parser is something that parses your XML one after the other, and so is not processor intensive. But, it is not exaclty easy to develop either.
    XSLT Mapping
    One can also think of Java mapping as another option but it is a bit complex and required knowledge of Java. In such cases, XSLT mapping can be the best approach to meet the requirements.
    A few example cases in which an XSLT mapping can be used:-
    When the required output is other than XML like Text, Html or XHTML (html displayed as XML)
    When default namespace coming from graphical mapping is not required or is to be changed as per requirements.
    When data is to be filtered based on certain fields (considering File as source)
    When data is to be sorted based on certain field (considering File as source)
    When data is to be grouped based on certain field (considering File as source)\
    Advantages of using XSLT mapping
    XSLT program itself defines its own target structure.
    XSLT programs can be imported into SAP XI. Message mapping step can be avoided. One can directly go for interface mapping once message interfaces are created and mapping is imported.
    XSLT provides use of number of standard XPath functions that can replaces graphical mapping involving user defined java functions easily.
    File content conversion at receiver side can be avoided in case of text or html output.
    Multiple occurrences of node within tree (source XML) can be handled easily.
    XSLT can be used in combination with graphical mapping.
    Multi-mapping is also possible using xslt.
    XSLT can be used with ABAP and JAVA Extensions.
    Disadvantages of using XSLT mapping
    Resultant XML payload can not be viewed in SXMB_MONI if not in XML format (for service packs < SP14).
    Interface mapping testing does not show proper error description. So errors in XSLT programs are difficult to trace in XI but can be easily identified outside XI using browser.
    XSLT mapping requires more memory than mapping classes generated in Java.
    XSLT program become lengthier as source structure fields grows in numbers.
    XSLT program sometimes become complex to meet desired functionality.
    Some XSL functions are dependent on version of browser.
    Different types of Mappings
    MAPPING SUPPORTED BY XI
    Message Mapping -> Graphical Design and testing environment. Default Provided By XI. Queue based modelling allow handling or large documents. Extensible via user defined functions
    XSLT Mapping - > Based on openstandard, Portable across application platform, Extensible using user defined functions kewl but disadvantage is Memory overload while handling large documents.
    SAX -> Simple Api For XML. -> Allows you to parse through a XML document. Doesn't consume any memory. But the message can be parsed only once from top to bottom. It Has evolved by contributions made by group of ppl itz a open architecture.
    DOM -> Document Object Model -> Itz designed by W3C. Consumes Memory as the message will be loaded. Allows parsing of document in both way top down and bottom up.
    Send me your email id.Shall send you very good docs for both ABAP Mapping and message mapping.
    Thanks

  • Message Mapping activation error-Source code has syntax errors in UDF

    Hi all,
    I wrote a small UDF for sum of 2 numbers:
    import
    udf.*
    public String getsum(String a, String b, Container container) throws StreamTransformationException{
    int c = Integer.parseInt(a);
    int d = Integer.parseInt(b);
    int e = packageDemo.getSum(c,d);
    return e+"";}
    In imported archives, i imported pack.jar
    In D:\udf , I have packageDemo.java, packageDemo.class, aii_map_api.jar, pack.jar(has the other 3)
    packageDemo.java :-
    package udf;
    public class packageDemo{   
        public static int getSum(int a,int b)
            int c= a+b;
            return c;
    Did i miss anything?? Icant activate message mapping for 2 errors:-
    1.package udf does not exist
    2.Function getsum, Line 3:
    cannot find symbol symbol : variable packageDemo location: class com.sap.xi.tf._xml_mm_int e = packageDemo.getSum(c,d); ^Note: /usr/sap/P7R/DVEBMGS00/j2ee/cluster/server0/./temp/classpath_resolver/Mapd4214d3099dc11dd9470001d090e4bbe/source/com/sap/xi/tf/_xml_mm_.java uses or overrides a deprecated API.Note: Recompile with -Xlint:deprecation for details.Note: /usr/sap/P7R/DVEBMGS00/j2ee/cluster/server0/./temp/classpath_resolver/Mapd4214d3099dc11dd9470001d090e4bbe/source/com/sap/xi/tf/_xml_mm_.java uses unchecked or unsafe operations.Note: Recompile with -Xlint:unchecked for details.2 errors
    Edited by: NagaDurga Nannapaneni on Oct 16, 2008 1:07 PM

    Hi ,
    Think the error is coming because the content in imported archive is not being taken into message mapping at all...so package, class, method ..nothing is identified.
    Can anyone suggest the solution..
    Thanks,
    Durga

  • Message Mapping error in UDF

    I am receiving errors when trying to activate my MM.  I believe the issues are in one of two UDF's.  These UDF's do work in another MM without error.  Below are the error's and UDF's.
    ERRORS:
    Activation of the change list canceled Check result for Message Mapping MM_WPDBBY_WPDBBY01_TO_POS_WAWAFILE | http://wawa.com/xi/erp/pos:  Starting compilation  Source code has syntax error:  /usr/sap/XID/DVEBMGS00/j2ee/cluster/server0/./temp/classpath_resolver/Map5420e070cabe11dcab4b00306ef38da9/source/com/sap/xi/tf/_MM_WPDBBY_WPDBBY01_TO_POS_WAWAFILE_.java:3291: cannot resolve symbol symbol : variable container location: class com.sap.xi.tf._MM_WPDBBY_WPDBBY01_TO_POS_WAWAFILE_ map = container.getTransformationParameters(); ^ /usr/sap/XID/DVEBMGS00/j2ee/cluster/server0/./temp/classpath_resolver/Map5420e070cabe11dcab4b00306ef38da9/source/com/sap/xi/tf/_MM_WPDBBY_WPDBBY01_TO_POS_WAWAFILE_.java:3293: cannot return a value from method whose result type is void return constant; ^ 2 errors
    UDF's:
    public String getSender(Container container){
    String constant;
    java.util.Map map;
    // get constant map
    map = container.getTransformationParameters();
    constant = (String) map.get (StreamTransformationConstants.SENDER_SERVICE);
    return constant;
    IMPORTS:  com.sap.xi.mapping.parse.dom.;javax.xml.parsers.;java.io.;com.sap.aii.mapping.lookup.;org.w3c.dom.*;
    public String getSeqNum(String fileType,String objNum,String Sender,Container container){
    String request = "<ns0:ZRFC_NUMBER_GET_NEXT xmlns:ns0=\"urn:sap-com:document:sap:rfc:functions\"><NR_RANGE_NR>" + fileType + "</NR_RANGE_NR><OBJECT>" + objNum + "</OBJECT><QUANTITY/></ns0:ZRFC_NUMBER_GET_NEXT>";
    InputStream isRequest = new ByteArrayInputStream(request.getBytes());
    SystemAccessor accessor = null;
    String num  = null;
    try{
         // 1. Determine a channel.
         Channel channel = LookupService.getChannel(Sender, "R_RFC_ERP");
         // 2. Get a system accessor for the channel.
         accessor = LookupService.getSystemAccessor(channel);
         // 3. Create a payload according to the data type which the adapter expects.
         //    Use service.getBinaryPayload() for binary payload,
         //    and service.getTextPayload() for text payloads.
         Payload payload = LookupService.getXmlPayload(isRequest);
         // 4. Execute lookup.
         Payload response = accessor.call(payload);
         //Parse response
         DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
         DocumentBuilder builder = factory.newDocumentBuilder();
         InputStream resStream = response.getContent();
         Document doc = builder.parse(resStream);
         Element sequence = doc.getDocumentElement();
         NodeList number = sequence.getElementsByTagName("NUMBER");
         //Extract Number
         num = DOMUtil.getSimpleElementText((Element) number.item(0));
    } catch (Exception e) {
         return e.getMessage();
    } finally {
         try {
              if (accessor != null) accessor.close();
         } catch (Exception e) {
              return e.getMessage();
    GlobalContainer gc = container.getGlobalContainer();
    gc.setParameter("Num", num);
    return num;
    Any help is appreciated.
    Regards,
    Darrell

    Fauver,
    Just to narrow down the problem first remove the first udf and only use the 2nd user defined function. Also in the 2nd udf you have to change this line:
    try{
    // 1. Determine a channel.
    Channel channel = LookupService.getChannel(Sender, "R_RFC_ERP");
    In the above line instead of Sender you use the business service or business system where R_RFC_ERP RFC communication channel is created in Integration Directory. So you are hardcoding it first.
    Once you have done this changes do save and test it once again. If this works then you can change back to original and your first udf needs to be checked.
    Regards,
    ---Satish

  • Error in Multi Message Mapping

    Hi,
    I am getting the following error in my multi message mapping scenario where I am trying to create 2 different output files from a single input file based on some condition. I tested the message mapping by using a test file and it works fine, but when I use the same file and test it end to end the scenario is failing with the following error.
    <?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
    - <!--
    Request Message Mapping
      -->
    - <SAP:Error xmlns:SAP="http://sap.com/xi/XI/Message/30" xmlns:SOAP="http://schemas.xmlsoap.org/soap/envelope/" SOAP:mustUnderstand="1">
      <SAP:Category>XIServer</SAP:Category>
      <SAP:Code area="MAPPING">GENERIC</SAP:Code>
      <SAP:P1>Split mapping created no messages</SAP:P1>
      <SAP:P2 />
      <SAP:P3 />
      <SAP:P4 />
      <SAP:AdditionalText />
      <SAP:Stack>Split mapping created no messages</SAP:Stack>
      <SAP:Retry>M</SAP:Retry>
      </SAP:Error>
    Is there something wrong with my configuration?
    The trace has the following content.
    Trace level="1" type="T">*** START APPLICATION TRACE ***</Trace>
      <Trace level="3" type="T">Document start</Trace>
      <Trace level="3" type="T">Start tag [ns0:Messages]</Trace>
      <Trace level="3" type="T">Add raw attribute [ xmlns:ns0="http://sap.com/xi/XI/SplitAndMerge"]</Trace>
      <Trace level="3" type="T">Start tag [ns0:Message1]</Trace>
      <Trace level="3" type="T">Close tag [ns0:Message1]</Trace>
      <Trace level="3" type="T">Start tag [ns0:Message2]</Trace>
      <Trace level="3" type="T">Close tag [ns0:Message2]</Trace>
      <Trace level="3" type="T">Close tag [ns0:Messages]</Trace>
      <Trace level="3" type="T">Document end</Trace>
      <Trace level="1" type="T">*** END APPLICATION TRACE ***</Trace>
      <Trace level="2" type="T">Java mapping com/sap/xi/tf/_Employee1_MT_To_Employee1_MT_AND_Employee2_MT_MM_ completed. (executeStep() of com.sap.xi.tf._Employee1_MT_To_Employee1_MT_AND_Employee2_MT_MM_).</Trace>
      <Trace level="3" type="T">Message Type 1 Number of Messages 0</Trace>
      <Trace level="3" type="T">Message Type 2 Number of Messages 0</Trace>
      <Trace level="1" type="E">CL_XMS_PLSRV_MAPPING~ENTER_PLSRV</Trace>
      </Trace>
      <Trace level="3" type="System_Error">Error exception return from pipeline processing!</Trace>
      <Trace level="1" type="B" name="CL_XMS_MAIN-WRITE_MESSAGE_TO_PERSIST" />
    - <!--
      -->
      <Trace level="3" type="T">Persisting message Status = 014</Trace>
      <Trace level="3" type="T">Message version 001</Trace>
      <Trace level="3" type="T">Pipeline CENTRAL</Trace>
      </SAP:Trace>

    Hi,
    The scenario I am trying to test is a multi mapping scenario where I am trying to split one source message and create two target messages by using two different receiver interfaces, one for each message.
    I am on PI 7.1 and when I test message mapping and operation mapping using the payload from SXMB_MONI, it is successful. Whereas when I test the scenario end to end I am getting the following error messages:
    Operation Mapping
    Employee_Out_SI_To_Employee1_In_SI_AND_Employee2_In_SI_OM
    Name
    Employee_Out_SI_To_Employee1_In_SI_AND_Employee2_In_SI_OM
    Namespace
    http://accenture.com/1:N_multi-mapping
    Runtime error
    Split mapping created no messages
    Start tag ns0:Messages Add raw attribute xmlns:ns0="http://sap.com/xi/XI/SplitAndMerge" Start tag ns0:Message1 Close tag ns0:Message1 Start tag ns0:Message2 Close tag ns0:Message2 Close tag ns0:Messages
    Could someone please help
    Cheers,
    S

  • Unable to save the message mapping

    Hi..
    I have completed the Message Mapping. when i am trying to save the Message Mapping i am getting the  Error while executing save "The length 0 of the array ' Sorted Function keys' is not equal to the number of 1 functions".
    can you pls suggest me, how can i rectify this type of strange error.
    Regards,
    Prasad

    Hi,
    that means that one of your Sorted Functions does not have correct input
    as the error says
    you probably placed it in a wrong way - check the functions
    desciption on help.sap.com or an example on SDN blogs
    and correct it - then it will work
    Regards,
    Michal Krawczyk

  • Soap lookup in PI7.31 message mapping

    Hi All,
    I have a soap lookup created in UDF in PI message mapping
    I am taking material id from the source structure and use it as input parameter for the lookup webservice
    Here is the UDF code which takes material number and returns the internal id
    AbstractTrace trace = container.getTrace();
    String matintid = "";
    try {
    //instance the channel to invoke the service.
    Channel channel = LookupService.getChannel("BS_Bus","CC_SearchLookup");
    SystemAccessor accessor = LookupService.getSystemAccessor(channel);
    // The Request message in XML. THIS IS THE LOOKUP SERVICE
      String SOAPxml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?><searchTM_MATERIAL>xmlns:ns0=\"MDM_MAT_Search_MDM"><query><criteria><fTX_MATERIAL><constraint><value>"
    +a
    + "</value><expressionOperator>equals</expressionOperator></constraint></fTX_MATERIAL></criteria></query><reposInfo><repositoryName>REP_MATERIALS</repositoryName><serverName>mdm6765</serverName></reposInfo></searchTM_MATERIAL>";
    InputStream inputStream =new ByteArrayInputStream(SOAPxml.getBytes());
    XmlPayload payload = LookupService.getXmlPayload(inputStream);
    Payload SOAPOutPayload = null;
    //The response will be a Payload. Parse this to get the response field out.
    SOAPOutPayload = accessor.call(payload);
    /* Parse the SOAPPayload to get the SOAP Response back.  */
    InputStream inp = SOAPOutPayload.getContent(); 
    DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); 
    /* Create DOM structure from input XML */ 
    DocumentBuilder builder = factory.newDocumentBuilder(); 
    Document document = builder.parse(inp);
    NodeList matlist = document.getElementsByTagName("tM_MATERIAL");
    Element material = (Element) matlist.item(0);
    NodeList recidlist = material.getElementsByTagName("recordIdentification");
    Element recidnode = (Element)recidlist.item(0);
    matintid = recidnode.getNodeValue();
    trace.addInfo("matnid is" + matintid);
    } catch (Exception e) {
    trace.addWarning("Error" + e);  }
    trace.addInfo("Service XXX success executed");
    return matintid;
    This is giving a java null point error
    Errorjava.lang.NullPointerException: while trying to invoke the method org.w3c.dom.Element.getElementsByTagName(java.lang.String) of a null object loaded from a local variable at slot 16
    Any idea whats going on? I am able to get response for the webservice using SOAP UI 
    And here is the soap input and output in SOAP UI execution
    Input
    <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:urn="urn:MDM_MAT_Search_MDM" xmlns:urn1="urn:com.sap.mdm.ws.beans.mdt_mat_search_mdm_in" xmlns:urn2="urn:com.sap.mdm.ws.beans" xmlns:urn3="urn:com.sap.mdm.core.beans">
       <soapenv:Header/>
       <soapenv:Body>
          <urn:searchTM_MATERIAL>
             <urn:query>
                <!--Optional:-->
                <urn1:criteria>
                     <!--Optional:-->
                   <urn1:fTX_MATERIAL>
                      <urn2:constraint>
                         <!--Optional:-->
                         <urn2:value>12345</urn2:value>
                         <!--Optional:-->
                         <urn2:expressionOperator>equals</urn2:expressionOperator>
                      </urn2:constraint>
                   </urn1:fTX_MATERIAL>
                </urn1:criteria>
             </urn:query>
             <urn:reposInfo>
                <urn3:repositoryName>REP_MATERIALS</urn3:repositoryName>
                <urn3:serverName>mdm1234</urn3:serverName>
             </urn:reposInfo>
          </urn:searchTM_MATERIAL>
       </soapenv:Body>
    </soapenv:Envelope>
    Output:
    <SOAP-ENV:Envelope xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
       <SOAP-ENV:Body xmlns:rpl="urn:MDM_MAT_Search_MDM">
          <rpl:searchTM_MATERIALResponse xmlns:rn0="java:sap/standard" xmlns:rn1="urn:com.sap.mdm.ws.beans" xmlns:rn2="http://schemas.xmlsoap.org/soap/encoding/" xmlns:rn3="urn:com.sap.mdm.core.base" xmlns:rn4="urn:com.sap.mdm.ws.beans.mdt_mat_search_mdm_in" xmlns:rn5="urn:com.sap.mdm.core.beans">
             <rpl:Response>
                <rn1:executionStatus>
                   <rn1:status>OK</rn1:status>
                   <rn1:description>Search/Retrieve done successfully</rn1:description>
                   <rn1:dataObject>Records 1..1 of 1 found</rn1:dataObject>
                </rn1:executionStatus>
                <rn4:tM_MATERIAL>
                  <rn4:fTX_MATERIAL>12345</rn4:fTX_MATERIAL>    
                 <rn4:recordIdentification>
                       <rn4:internalID>1267</rn4:internalID>
                    </rn4:recordIdentification>
           </rn4:tM_MATERIAL>
             </rpl:Response>
          </rpl:searchTM_MATERIALResponse>
    Thx
    mike

    Hi Mike,
    What I suspect is, you get a null pointer exception because the XML tag name which you are trying to retrieve, has a namespace. Could you please instead try to use:
    getElementsByTagNameNS(java.lang.String namespaceURI, java.lang.String localName)
              Returns a NodeList of all the Elements with a given local name and namespace URI in document order.
    Let us know if it works.
    Regards,
    Shweta

Maybe you are looking for