BPM Loop Condition ?

We have a output xml in BPM as shown below :
<?xml version="1.0" encoding="utf-8" ?>
<Product>
<ProductRecord>
  <ProductID schemeID="MaterialNumber" schemeAgencyID="MDM30_FILEADAPTER01" schemeAgencySchemeAgencyID="ZZZ">KRANTI_MAT1</ProductID>
  <ProductID schemeID="ProductGUID" schemeAgencyID="QM3_002" schemeAgencySchemeAgencyID="ZZZ">416452CBD0746B23E10000000A1553FC</ProductID>
  <ProductTypeCode>01</ProductTypeCode>
<Category>
  <CategoryID schemeID="ProductCategoryGUID" schemeAgencyID="QM3_002" schemeAgencySchemeAgencyID="ZZZ">4162C19D0C250E78E10000000A1553FC</CategoryID>
  <CategoryID schemeID="StandardCategoryID" schemeAgencyID="MDM30_FILEADAPTER01" schemeAgencySchemeAgencyID="ZZZ">MATCLASS2_ROOT</CategoryID>
  </Category>
  </ProductRecord>
  </Product>
The product id tag is 1..undbounded.
We want a loop condition in BPM wherein as soon as  we get a line of ProductID with   schemeID="ProductGUID" then we want to exit the loop.
Can anybody help us with the loop condition.
Regards,
Anurag

Hi Prasadh,
         I am able to give thie "Create the following expression in the expression editor:
/MT_Test_JDBC_Req_response/row_responseindicator != 9"  expression
           How can i give the second"(/MT_Test_JDBC_Req_response/row_responseindicator != 9 EX)" condition??
          I tried with giving the AND but it is not allowing me to enter the 9.
     Can you please let me know.
Thanks & Regards,
Purushotham

Similar Messages

  • BPM: Loop condition not coming outside of the loop

    Hi Experts,
    I am working on BPM. In the loop I am giving the condition as
    (ForSyncResponse./p1:MT_Test_JDBC_Req_response/row_response/Row/indicator u2260 9)
    If indication not equal to the 9(Integer) then it should come out of the loop otherwise loop needs to be repeat( Iam getting this data from the database through Send Synch step). When ever iam sending data other than 9 then it repeating if I send 9 also even though the loop condition is not satisfying and its keep on repeating the loop. Can you please let me know what might be ther problem.
    Thanks & Regards,
    Purushotham

    Hi Prasadh,
             I am able to give thie "Create the following expression in the expression editor:
    /MT_Test_JDBC_Req_response/row_responseindicator != 9"  expression
               How can i give the second"(/MT_Test_JDBC_Req_response/row_responseindicator != 9 EX)" condition??
              I tried with giving the AND but it is not allowing me to enter the 9.
         Can you please let me know.
    Thanks & Regards,
    Purushotham

  • Problem with BPM loop end condition

    Hi,
    I'm working with PI 7.1 in a BPM process which have a loop. I cant stop this loop in anyway, even, I have put a COUNTER != COUNTER as condition.
    Can someone help me with this issue?
    Regards,
    Alberto Pla.

    The BPM loops are while loop, so it will execute indefinitely if the condition given is true. The condition editor what we have in the BPM is not flexible. Can you just try the drag and drop facility available in the condition editor rather than writing on our own. it should look like this COUNTER!=COUNTER  without any spaces in between.

  • BPM Loop in PI  7.1

    I have an scenerio where I need to traverse through an xml file , and for each node of XML I need to loop with certain operation in BPM .
    e.g  
    xml as per the XSD --> Loop through each node --> with in each loop BPM will call a different webservice to get a confirmation depending on which it will insert some data in db.
    Will it be possible through BPM loop or there is some other work around. Please help
    Edited by: Riju Adhikary on Sep 18, 2009 7:09 AM

    Post this in the XI forum.. THis is for NW BPM not CCBPM

  • I pull fiftyfour bytes of data from MicroProcessor's EEPROM using serial port. It works fine. I then send a request for 512 bytes and my "read" goes into loop condition, no bytes are delivered and system is lost

    I pull fiftyfour bytes of data from MicroProcessor's EEPROM using serial port. It works fine. I then send a request for 512 bytes and my "read" goes into loop condition, no bytes are delivered and system is lost

    Hello,
    You mention that you send a string to the microprocessor that tells it how many bytes to send. Instead of requesting 512 bytes, try reading 10 times and only requesting about 50 bytes at a time.
    If that doesn�t help, try directly communicating with your microprocessor through HyperTerminal. If you are not on a Windows system, please let me know. Also, if you are using an NI serial board instead of your computer�s serial port, let me know.
    In Windows XP, go to Start, Programs, Accessories, Communications, and select HyperTerminal.
    Enter a name for the connection and click OK.
    In the next pop-up dialog, choose the COM port you are using to communicate with your device and click OK.
    In the final pop
    -up dialog, set the communication settings for communicating with your device.
    Type the same commands you sent through LabVIEW and observe if you can receive the first 54 bytes you mention. Also observe if data is returned from your 512 byte request or if HyperTerminal just waits.
    If you do not receive the 512 byte request through HyperTerminal, your microprocessor is unable to communicate with your computer at a low level. LabVIEW uses the same Windows DLLs as HyperTerminal for serial communication. Double check the instrument user manual for any additional information that may be necessary to communicate.
    Please let me know the results from the above test in HyperTerminal. We can then proceed from there.
    Grant M.
    National Instruments

  • JMM: legal to optimize non-volatile flag out of particular loop condition?

    Does Java Memory Model allow JIT compiler to optimize non-volatile flag out of loop conditions in code like as follows...
    class NonVolatileConditionInLoop {
      private int number;
      private boolean writingReady = true; // non-volatile, always handled inside synchronized block
      public synchronized void setNumber(int n) {
        while (!writingReady) { // non-volatile flag in loop condition
          try { wait(); }
          catch (InterruptedException e) { e.printStackTrace(); }
        this.number = n;
        this.writingReady = false;
        notifyAll();
      public synchronized int getNumber() {
        while (writingReady) { // non-volatile flag in loop condition
          try { wait(); }
          catch (InterruptedException e) { e.printStackTrace(); }
        this.writingReady = true;
        notifyAll();
        return number;
    }...so that it will execute like this:
    class NonVolatileConditionInLoopHacked {
      private int number;
      private boolean writingReady = true; // non-volatile, always handled inside synchronized block
      public synchronized void setNumber(int n) {
        if (!writingReady) { // moved out of loop condition
          while (true) {
            try { wait(); }
            catch (InterruptedException e) { e.printStackTrace(); }
        this.number = n;
        this.writingReady = false;
        notifyAll();
      public synchronized int getNumber() {
        if (writingReady) { // moved out of loop condition
          while (true) {
            try { wait(); }
            catch (InterruptedException e) { e.printStackTrace(); }
        this.writingReady = true;
        notifyAll();
        return number;
    This question was recently discussed in [one of threads|http://forums.sun.com/thread.jspa?messageID=11001801#11001801|thread] at New To Java forum.
    My take on it is that optimization like above is legal. From the perspective of single-threaded program, repeated checks for writingReady are redundant because it is not modified within the loop. As far as I understand, unless explicitly forced by volatile modifier (and in our case it is not), optimizing compiler "has a right" to optimize based on single-thread execution assumption.
    Opposite opinion is that JMM prohibits such an optimization because methods containing the loop(s) are synchronized.

    gnat wrote:
    ...so that it will execute like this:
    class NonVolatileConditionInLoopHacked {
    private int number;
    private boolean writingReady = true; // non-volatile, always handled inside synchronized block
    public synchronized void setNumber(int n) {
    if (!writingReady) { // moved out of loop condition
    while (true) {
    try { wait(); }
    catch (InterruptedException e) { e.printStackTrace(); }
    this.number = n;
    this.writingReady = false;
    notifyAll();
    public synchronized int getNumber() {
    if (writingReady) { // moved out of loop condition
    while (true) {
    try { wait(); }
    catch (InterruptedException e) { e.printStackTrace(); }
    this.writingReady = true;
    notifyAll();
    return number;
    This question was recently discussed in [one of threads|http://forums.sun.com/thread.jspa?messageID=11001801#11001801|thread] at New To Java forum.
    My take on it is that optimization like above is legal. From the perspective of single-threaded program, repeated checks for writingReady are redundant because it is not modified within the loop. As far as I understand, unless explicitly forced by volatile modifier (and in our case it is not), optimizing compiler "has a right" to optimize based on single-thread execution assumption.
    Opposite opinion is that JMM prohibits such an optimization because methods containing the loop(s) are synchronized.One of the problems with wait() and your the proposed optimization is that "interrupts and spurious wakeups are possible" from wait() . See [http://java.sun.com/javase/6/docs/api/java/lang/Object.html#wait()] Therefore your wait() would loop without checking if this optimization would occur and a interrupt or spurious wake-up happened. Therefore for this reason I do not believe writingReady would be rolled out of the loop. Also the code isn't even equivalent. Once all the threads wake-up due to the notifyAll() they would spin in the while(true) and wait() again. I don't think the JMM prohibits such an optimization because methods containing the loop(s) are synchronized, but because it contains a wait(). The wait() is kind of a temporary flow control escape out of the loop.
    Example:
    writingReady is true
    Thread A calls getNumber(). It waits().
    Thread B calls setNumber(). It calls notifyAll() and writingReady is now false;
    Thread A wakes up in getNumber() and while(true) loop and waits again(). //Big problem.

  • Less or less than equal in the for loop condition

    Hi,
    What do you prefer, what is more common, which one is more easily readable, less or less than equal in the for loop condition?
    for (int i = 0; i < arr.lenght; i++){..}
    //or
    for (int i = 0; i <= arr.lenght - 1 ; i++){..}I know this is basic programming and nothing to do with Java, so if this forum is not for this purpose, could you please suggest a general programming forum?
    I would really appreciate it as I have many general questions :)
    Thanks in advance,
    lemonboston

    lemonboston wrote:
    Hi,
    What do you preferPersonal preference, which is useless to you
    , what is more common,Based on years of reading open source code, the first
    which one is more easily readable, less or less than equal in the for loop condition?Personal opinion, which is useless to you
    I would really appreciate it as I have many general questions :)If you don't want to think about it yourself (which you should be doing in stead of asking general questions), simply attack it lazily. Both examples achieve exactly the same, but the first one is less to type and to read.

  • Help with a while loop condition

    I'm trying to write to a File. I ask the user for input, then I enter a while loop and test the condition. The loop works, but it won't stop. I've tried everything. Here is my code please help!!
    thanks
    inputline = keyboard.readLine();//read the keyboard
    try{
    while( inputline != null ){
    DiskOut.println( inputline );
    DiskOut.flush();
    inputline = keyboard.readLine();//read the keyboard again
    }//end while
    }//end try
    catch (IOException e) { 
    e.printStackTrace();
    }//end catch
    also i've tried these while loop conditions:
    while(inputline != "\n" || inputline != "\r") and the sort

    while(inputline != "\n" || inputline != "\r")The condition
    X!=Y OR X!=Z (given Y != Z)
    is always true. X will always not be equal to at least one of the values. So you'll want to use:
    while(!inputline.equals("\n") && !inputline.equals("\r"))In other words, "while inputline is not equal to either of them". Note the use of && instead of ||.
    If "keyboard" is simply a BufferedReader on top of System.in (and not your own class), the trailing line feeds and carriage returns won't even be in the string returned by readLine(). Your best bet is this:
    while(null != inputline && 0 != inputline.length())Make sure you type the two parts of that AND condition in the order above. If for whatever reason there are trailing \r and \n on the strings, you'll want to accomodate for platforms that may include both characters.
    // trim the trailing newline characters
    while(inputline.endsWith("\r") ||
          inputline.endsWith("\n")) {
       inputline = inputline.substring(0,inputline.length()-1);
    // or maybe this will work if you don't mind losing
    //  the whitespace at the beginning of the string:
    inputline = inputline.trim();Hope that helps somewhat.

  • New object inside loop condition

    I would like to create new object inside loop condition and use in its body
    while(new File(localization).exists()){
         //now would like use File object created above
    }What's the notation for that?

    YoungWinston wrote:
    TheGreatEmperor wrote:
    I would like to create new object inside loop condition and use in its body
    while(new File(localization).exists()){
    //now would like use File object created above
    }What's the notation for that?Encephalopathic gave it to you, but I'd worry about ending up with a never-ending loop. What about
    if ((myFile = new File(fileString)).exists()) { ...instead?
    Winston1) Same thing I put (except change the name "f" with "myFile")
    2) you could get a never-ending loop with your answer (depending on the body)
    3) The previous answer by Encephalopathic would NOT give a never-ending loop unless there was a never-ending listing of files with the name:
    "Foo" + fileCounter + ".txt"; where "fileCounter" is incrementing (as done in his code)

  • Re: loop condition using length

    Hi friends,
    in a loop condition i am using below coding.
    LOOP AT I_FORM1 INTO W_FORM1.
    A = STRLEN( W_FORM1-LOTNO ).
    LOOP AT I_AUFM INTO W_AUFM WHERE CHARG+0(A) = W_FORM1-LOTNO.
    ENDLOOP.
    ENDLOOP.
    But coming error is
    The length specification "(A)" is not a numeric literal or a numeric constant.
    how is it possible please help me any body.

    Hello ,
    Data type of variable A should be a integer .
    Edited by: Annasaheb More on Jul 2, 2011 9:20 AM

  • Endless loop condition

    Hi there,
    Working on a client/server chat application. On the client side app, everytime I want to send a message I create a new Thread called "SendingThread". See below.
    import java.io.*;
    import java.net.*;
    public class SendingThread extends Thread
      private Socket clientSocket;
      private String messageToSend;
      public SendingThread(Socket socket, String userName, String message)
           super("SendingThread: " + socket);
           clientSocket = socket;
           messageToSend = userName + Constants.MESSAGE_SEPERATOR + message;
      public void run()
           try
                PrintWriter writer = new PrintWriter(clientSocket.getOutputStream());
                writer.println(messageToSend);
                writer.flush();
                writer.close();
           catch(IOException ioe)
                System.out.println("Server must have closed connection");
                ioe.printStackTrace();
    }As you can see the line writer.close() is important in regard to a Thread that is running on the server app called "ReceivingThread" (see below). In the ReceivingThread there is a line:
    if((temp = input.readLine()) != null)
    It blocks until I actually send a message to read in. This is expected. However, now I have a catch 22 situation. On the client side app, since I called writer.close(), this was necessary in order to get a null value during the readLine() call on the ReceivingThread on the server. The one line gets processed as expected. The stream is now closed and on the server side app, since this is true, the next iteration of the while loop attempts to read in another line but now it is alway null and thus I wind up with an endless loop condition. I introduced a "count" variable and a condition only so that the loop wouldn't get away too far. I was hoping it would block again, but it isn't. I believe the ReceivingThread is written correctly, but I need to somehow obtain a null value on the stream for message completion and also have the ReceivingThread block for the next message coming in.
    Please advise,
    Alan
    public class ReceivingThread extends Thread
      private BufferedReader input;
      private MessageListener messageListener;
      private boolean keepListening = true;
      public ReceivingThread(MessageListener listener, Socket clientSocket)
           super("ReceivingThread: " + clientSocket);
           messageListener = listener;
           try
                clientSocket.setSoTimeout(50000);
                input = new BufferedReader(new InputStreamReader(clientSocket.getInputStream()));
           catch(IOException ioe){ioe.printStackTrace();}
      public void run()
           StringBuffer messageBuffer = new StringBuffer();
           String temp = "";
           int messageCount = 0;
           int count = 0;
             //START:
             while(keepListening)
               while(true)
                  try
                    //In order to receive a null, the client app
                    //has to close the stream!  Otherwise, this
                    //will block indefinitely.
                    System.out.println("blocking...");
                    if((temp = input.readLine()) != null)
                       if(messageCount == 0)
                            messageBuffer.append(temp);
                            messageCount++;
                            System.out.println("temp: " + temp);
                       else
                         //When we use the readLine method, it strips
                         //off the newline character, so we need to
                         //put it back.
                         messageBuffer.append("\n" + temp);
                         System.out.println("temp: " + temp);
                    else
                         break;
                  catch(IOException ioe)
                       System.out.println("IOException...");
                       ioe.printStackTrace();
                       //break;
               }//end while
                //System.out.println("out of inner while loop...message:\n" + messageBuffer.toString());
                String message = messageBuffer.toString();
                System.out.println("message: " + message);
                StringTokenizer tokenizer = new StringTokenizer(message, Constants.MESSAGE_SEPERATOR);
                if(tokenizer.countTokens() == 2)
                     System.out.println("message received");
                     messageListener.messageReceived(tokenizer.nextToken(), tokenizer.nextToken());
                     //reset string variables
                     messageCount = 0;
                     temp = "";
                     messageBuffer.delete(0, messageBuffer.length());
                     message = "";
                else
                    //System.out.println("checking disconnect string: " + message);
                   if(message.equalsIgnoreCase(Constants.MESSAGE_SEPERATOR + Constants.DISCONNECT_STRING))
                          stopListening();
                count++;
                if(count > 3)break;
             }//end while
             try
               //System.out.println("closing ReceivingThread");
               input.close();        
             catch(IOException ioe){ioe.printStackTrace();}
      public void stopListening()
           keepListening = false;
    }Edited by: ashiers on Nov 21, 2007 7:33 AM
    Edited by: ashiers on Nov 21, 2007 7:34 AM

    I'm not quite sure what you want to happen here. Here is what I would expect from the code you posted:
    *1.* The client connects and sends its message to the server.
    *2.* The server iterates through the line-reading loop until it exhausts the input (input.readLine() == null) and breaks out of the while (true) loop. The "temp: foo" messages are written to standard output accordingly.
    *3.* The server reaches the message portion of the loop and writes the "message: foo" to standard output.
    *4.* The server hits the end of the "while (keepListening)" loop and (assuming that you didn't receive a disconnect message) keepListening is still true. So it loops back around.
    *5.* The first time through the while (true) loop, the input is still empty (of course). So you get a null.
    *6.* Next, you get a "message: foo" output.
    *7.* Repeat *4* through *6* until your computer hardware fails or you abort the program. (Except that you added that count thing, so it'll loop three times and then break.)
    What are you trying to make the "keepListening" loop do? It doesn't seem like it should be there at all. At no point does this reading thread get the opportunity to read from any other socket. It almost seems like you want to spawn one ReceivingThread for each Socket you receive from the ServerSocket; if that's the case, the main thread (or whichever thread you have running that code and spawning the ReceivingThreads should be inside of the while (keepListening) loop.
    Any help?

  • Loop condition copy1

    hello,
    i am forwarding my codes here, and pls let me know how to write the loop conditions regarding this.
    *& Report  ZGOM1
    REPORT  ZGOM1.
    CALL SCREEN 200.
    *&      Module  USER_COMMAND_0200  INPUT
          text
    MODULE USER_COMMAND_0200 INPUT.
    tables : ZPERSONAL.
    data : begin of itab occurs 0,
           NAME LIKE ZPERSONAL-NAME,
           ADDRESS LIKE ZPERSONAL-ADDRESS,
           TELNO LIKE ZPERSONAL-TELNO,
           MOBILENO LIKE ZPERSONAL-MOBILENO,
           COUNTRY LIKE ZPERSONAL-COUNTRY,
           end of itab.
    case sy-ucomm.
           when 'DISP'.
    select * FROM ZPERSONAL INTO corresponding fields of ITAB.
           endselect.
           when 'EXIT'.
           LEAVE PROGRAM.
           ENDCASE.
    ENDMODULE.                 " USER_COMMAND_0200  INPUT
    *&      Module  STATUS_0200  OUTPUT
          text
    MODULE STATUS_0200 OUTPUT.
    SET PF-STATUS 'xxxxxxxx'.
    SET TITLEBAR 'xxx'.
    move-corresponding itab to ZPERSONAL.
    ENDMODULE.                 " STATUS_0200  OUTPUT
    please do the needful urgently,
    thanks
    suja

    hello,
    i am forwarding my codes here, and pls let me know how to write the loop conditions regarding this.
    please do the needful urgently,
    thanks
    suja

  • BPM with conditional start not getting triggered

    Hi
    I have developed a BPM which collects a few IDocs with a correlation based on the message content.
    When triggering the BPM in Development, everything works as intended. (Messages are collected together based on the value of the correlation)
    After this we decided to transport the BPM to Test by using NWDI. The deployment was successful, but when we try to run the scenario, the message gets delivered successfully in the monitor, but no BPM process is being triggered.
    Audit log in monitor:
    I've tried the same with the BPM in Dev but there it works fine, when trying in Test or Production, the BPM isn't getting triggered. Same when trying to trigger the process through the WS Navigator or SoapUI.
    The endpoint url we use is always the: http://host:port/MessagingSystem/receive/JPR/XI
    I can see the process in the process repository (but due to a conditional start, I cannot start it from there with a test).
    Do you have any suggestions on how to troubleshoot this?
    I can see nothing in the NWA Logs / Developer Traces either.
    Our system is a PO 7.40 SP5.
    Thanks in advance.
    Best regards,
    Nicolas

    Hi Nick
    thanks for the quick reply.
    The runtime version of the BPM is indeed the same for DEV and TEST.
    The BPM Actions don't show anything unfortunately, so doesn't seem to have triggered anything.
    The user has the SAP_BPM_TRIGGER_EVENT role so it should be able to trigger the process.
    The NWA Logs don't show up anything besides:
    JPR successfully processed the message
    And the following logs for the BPM:
    Returned destination xxxx.com/collectlabel~bpm*1400504350735*0, type WSProvider to user xxxx
    I can see the BPM Service in running state on the Java Services/Applications as well, so I would think everything is alright.
    br,
    Nicolas

  • BPM: XPath-Condition in Switch Step

    Hello,
    I have the following requirement in BPM.
    There is a switch step with five branches, and I have the following document structure:
    <Root>
    <Segment>
       <Docnum> 12345 </Docnum>
    </Segment>
    <Segment>
       <Docnum> 12346 </Docnum>
    </Segment>
    </Root>
    The switch condition is done based on the last digit of the first Docnum element. So in this case the value would be 5.
    I tried to work with a substring as the total number of digits of docnum is always 5.
    How would an XPath expression look like to retrieve the substring from the first <Segment> element? I tried different combinations but none of them really worked.
    Example what I tried: p1:/root/Segment[1]/substring(docnum, 4,1)
    Any advise on this?
    Thank you very much

    Try this...
    substring(/p1:/root/Segment[1]/docnum,4,1)
    for more info see
    http://www.w3.org/TR/xpath
    Message was edited by:
            Alex

  • If statement on a while loop condition

    Hello,
    I was just wondering whether it was possible to have an if statement on a while loop. Basically, I have a while loop that has the following terminating condition
    do{
    //...loop code here
    while (netError > acceptableError && learningCycle < 100000 && alive);I'm looking to introduce a boolean "ignoreMaxCycles" that basically stops the loop from taking notice of the learningCycle clause of the condition.
    do{
    //...loop code here
    while (netError > acceptableError && alive);I know it can be done repeating the two loops with an if statement governing which one is executed, but I was wondering whether there was a shorter/cleaner way of doing this?
    Thanks,
    Nick

    nickd_101 wrote:
    Hello,
    I was just wondering whether it was possible to have an if statement on a while loop. Basically, I have a while loop that has the following terminating condition
    do{
    //...loop code here
    while (netError > acceptableError && learningCycle < 100000 && alive);I'm looking to introduce a boolean "ignoreMaxCycles" that basically stops the loop from taking notice of the learningCycle clause of the condition.
    do{
    //...loop code here
    while (netError > acceptableError && alive);I know it can be done repeating the two loops with an if statement governing which one is executed, but I was wondering whether there was a shorter/cleaner way of doing this?
    Thanks,
    Nick
    do {
    while(netError > acceptableError && (ignoreMaxCycles || learningCycle < 100000) && alive)wtf ? i took 2 minutes for that ?
    Edited by: darth_code_r on Aug 29, 2008 9:21 AM

Maybe you are looking for