LOOP REVERSE EXIT

Next code...
     GO_BLOCK('BLOCK');
     LAST_RECORD;
     LOOP
       /*something*/
     EXIT WHEN ..................;
          PREVIOUS_RECORD;
     END LOOP;   What condition for exit when is first record???

Hi jortri,
We normally use system.last record as exit condition, when we traverse the loop in forward way.
But, system.first_record is not a defined variable so i suggest you to modified your code as follows:
declare
REC_NUM NUMBER;
begin
       GO_BLOCK('BLOCK');
     LAST_RECORD;
     LOOP
                /*something*/
              REC_NUM := get_block_property('<block_name>',CURRENT_RECORD);
                IF REC_NUM = 1 then
                       exit;
               else
                 PREVIOUS_RECORD;
     END LOOP;
end;Hope it helps.
Please mark answer as helpful / correct, if it helps you
Navnit

Similar Messages

  • How do I create a 1d array that takes a single calculation and insert the result into the first row and then the next calculation the next time the loop passes that point and puts the results in thsecond row and so on until the loop is exited.

    The attached file is work inprogress, with some dummy data sp that I can test it out without having to connect to equipment.
    The second tab is the one that I am having the problem with. the output array from the replace element appears to be starting at the index position of 1 rather than 0 but that is ok it is still show that the new data is placed in incrementing element locations. However the main array that I am trying to build that is suppose to take each new calculation and place it in the next index(row) does not ap
    pear to be working or at least I am not getting any indication on the inidcator.
    Basically what I am attempting to do is is gather some pulses from adevice for a minute, place the results for a calculation, so that it displays then do the same again the next minute, but put these result in the next row and so on until the specifiied time has expired and the loop exits. I need to have all results displayed and keep building the array(display until, the end of the test)Eventually I will have to include a min max section that displays the min and max values calculated, but that should be easy with the min max function.Actually I thought this should have been easy but, I gues I can not see the forest through the trees. Can any one help to slear this up for me.
    Attachments:
    regulation_tester_7_loops.vi ‏244 KB

    I didn't really have time to dig in and understand your program in depth,
    but I have a few tips for you that might things a bit easier:
    - You use local variables excessively which really complicates things. Try
    not to use them and it will make your life easier.
    - If you flowchart the design (very similar to a dataflow diagram, keep in
    mind!) you want to gather data, calculate a value from that data, store the
    calculation in an array, and loop while the time is in a certain range. So
    theres really not much need for a sequence as long as you get rid of the
    local variables (sequences also complicate things)
    - You loop again if timepassed+1 is still less than some constant. Rather
    than messing with locals it seems so much easier to use a shiftregister (if
    absolutely necessary) or in this case base it upon the number of iterations
    of the loop. In this case it looks like "time passed" is the same thing as
    the number of loop iterations, but I didn't check closely. There's an i
    terminal in your whileloop to read for the number of iterations.
    - After having simplified your design by eliminating unnecessary sequence
    and local variables, you should be able to draw out the labview diagram.
    Don't try to use the "insert into array" vis since theres no need. Each
    iteration of your loop calculates a number which goes into the next position
    of the array right? Pass your result outside the loop, and enable indexing
    on the terminal so Labview automatically generates the array for you. If
    your calculation is a function of previous data, then use a shift register
    to keep previous values around.
    I wish you luck. Post again if you have any questions. Without a more
    detailed understanding of your task at hand it's kind of hard to post actual
    code suggestions for you.
    -joey
    "nelsons" wrote in message
    news:[email protected]...
    > how do I create a 1d array that takes a single calculation and insert
    > the result into the first row and then the next calculation the next
    > time the loop passes that point and puts the results in thsecond row
    > and so on until the loop is exited.
    >
    > The attached file is work inprogress, with some dummy data sp that I
    > can test it out without having to connect to equipment.
    > The second tab is the one that I am having the problem with. the
    > output array from the replace element appears to be starting at the
    > index position of 1 rather than 0 but that is ok it is still show that
    > the new data is placed in incrementing element locations. However the
    > main array that I am trying to build that is suppose to take each new
    > calculation and place it in the next index(row) does not appear to be
    > working or at least I am not getting any indication on the inidcator.
    >
    > Basically what I am attempting to do is is gather some pulses from
    > adevice for a minute, place the results for a calculation, so that it
    > displays then do the same again the next minute, but put these result
    > in the next row and so on until the specifiied time has expired and
    > the loop exits. I need to have all results displayed and keep building
    > the array(display until, the end of the test)Eventually I will have to
    > include a min max section that displays the min and max values
    > calculated, but that should be easy with the min max function.Actually
    > I thought this should have been easy but, I gues I can not see the
    > forest through the trees. Can any one help to slear this up for me.

  • Exit condition in loop

    I am putting exit condition in before and after my business logic, so it make any difference
    BEGIN
         FOR REC IN 1..10
         LOOP
              EXIT WHEN REC =5;
              business logic
         END LOOP;
    END;
    BEGIN
         FOR REC IN 1..10
         LOOP
              business logic
              EXIT WHEN REC =5;
         END LOOP;
    END;Thanks
    Edited by: Braam on Oct 11, 2012 10:24 PM

    Would have been quicker for you to test it yourself, than to post the question:
    SQL> ed
    Wrote file afiedt.buf
      1  BEGIN
      2     FOR REC IN 1..10
      3     LOOP
      4             EXIT WHEN REC =5;
      5             /*
      6             business logic
      7             */
      8                  dbms_output.put_line('Processing: '||rec);
      9     END LOOP;
    10* END;
    11  /
    Processing: 1
    Processing: 2
    Processing: 3
    Processing: 4
    PL/SQL procedure successfully completed.
    SQL> ed
    Wrote file afiedt.buf
      1  BEGIN
      2     FOR REC IN 1..10
      3     LOOP
      4             /*
      5             business logic
      6             */
      7                  dbms_output.put_line('Processing: '||rec);
      8             EXIT WHEN REC =5;
      9     END LOOP;
    10* END;
    SQL> /
    Processing: 1
    Processing: 2
    Processing: 3
    Processing: 4
    Processing: 5
    PL/SQL procedure successfully completed.

  • How to exit Loop in the middle

    I have a requirement of exiting a loop in between, if a particular condition is satisfied. How do i achieve this in workflow? I thought of using 'Process Control' but it has no option to exit a loop from the middle....is there a way out?

    Hi,
    Loop runs until a condition is met.
    So to exit a loop you need to set a condition as false at a step and then it would exit.
    To do so, you can set a flag value in the loop processing. When ever the flag is initial keep on processing the loop and when you want the loop to exit, just set the value of the flag.
    Hope this helps!
    Regards,
    Saumya

  • Findforward() results in infinite loop and server exits

    I have a dataform which has struts html text field and 3 poplist bound
    to database fields. I do a submit on the event onChange in the first poplist and it
    will call a custom method in app module, which will setup the VO for populating the second poplist, based on
    the data from the first list. In the action class, I override the findforward() to go to
    DataAction to execute this custom method. On sucess from DataAction a forward is set to the first page
    which display the second poplist. When i run the action from struts-config.xml,
    the oc4j server goes on to loop and exits with message "Process exited with exit code 128".
    Any ideas why this is happing ?.

    One or several of the events handled by the page are still present because you keep forwarding between actions.
    The onChange event is still hanging around when it is forwarded to the next action and this action may act on it in an unpredictable way.
    There is currently code in the ADF framework to insure that an event is not executed by more than one action but in your case you may have your own events. Make sure to act on possible event being forwarded around.
    Charles.

  • Start/Stop Buttons and infinite loop exit

    I am trying to make a GUI with a Start/Stop and an Exit button. Initially the button will have the label "Start". When i push it, its label should become "Stop" and an infinite loop function will begin. I want the loop to run until i press the Stop or Exit button.
    The problem is that when the loop starts i can't press neither of the buttons. The "Start" button changes its label into "Stop" only if i make the loop finite and it ends.
    Here is the source:
    import java.awt.BorderLayout;
    import java.awt.Component;
    import java.awt.event.ActionEvent;
    import java.awt.event.ActionListener;
    import javax.swing.JButton;
    import javax.swing.JFrame;
    import javax.swing.JLabel;
    import javax.swing.JPanel;
    public class StartStopButtons extends JFrame{
        Component visualComponent = null;
        JPanel panel = null;
        JLabel statusBar = null;
         public StartStopButtons() {
              setSize(160, 70);
              getContentPane().setLayout(new BorderLayout());
            panel = new JPanel();
            panel.setLayout(new BorderLayout());
            getContentPane().add(panel, BorderLayout.CENTER);
            final JPanel panel_1 = new JPanel();
            panel.add(panel_1, BorderLayout.CENTER);
            final JButton startButton = new JButton();
            startButton.addActionListener(new ActionListener() {
                 public void actionPerformed(final ActionEvent e) {
                    String action = e.getActionCommand();
                    if (action.equals("Start")) {
                         System.out.println("Start Loop");
                         startButton.setText("Stop");
                         myLoop ();
                    if (action.equals("Stop")) {
                         System.out.println("Stop Loop");
                         System.exit(0);
            startButton.setText("Start");
            panel_1.add(startButton);
            final JButton exitButton = new JButton();
            exitButton.addActionListener(new ActionListener() {
                 public void actionPerformed(final ActionEvent e) {
                    String action = e.getActionCommand();
                    if (action.equals("Exit")) {
                        System.exit(0);
            panel_1.add(exitButton);
            exitButton.setText("Exit");
         public void myLoop() {
              for (int i = 0; ; i++)
                   System.out.println(i);
         public static void main(String[] args) {
              StartStopButtons ssB = new StartStopButtons();
              ssB.setVisible(true);
    }

    I works just fine. Here is the source and thanks for the help.
    import java.awt.BorderLayout;
    import java.awt.Component;
    import java.awt.event.ActionEvent;
    import java.awt.event.ActionListener;
    import javax.swing.JButton;
    import javax.swing.JFrame;
    import javax.swing.JLabel;
    import javax.swing.JPanel;
    import javax.swing.UIManager;
    public class StartStopButtons extends JFrame implements ActionListener, Runnable{
        Component visualComponent = null;
        JPanel panel = null;
        JLabel statusBar = null;
        Thread thread;
        JButton startButton;
         public StartStopButtons() {
            try {
                UIManager.setLookAndFeel(
                    UIManager.getSystemLookAndFeelClassName());
            } catch(Exception e) {}
              setSize(160, 70);
              getContentPane().setLayout(new BorderLayout());
            panel = new JPanel();
            panel.setLayout(new BorderLayout());
            getContentPane().add(panel, BorderLayout.CENTER);
            final JPanel panel_1 = new JPanel();
            panel.add(panel_1, BorderLayout.CENTER);
            startButton = new JButton();
            startButton.addActionListener(this);
            startButton.setText("Start");
            panel_1.add(startButton);
            final JButton exitButton = new JButton();
            exitButton.addActionListener(new ActionListener() {
                 public void actionPerformed(final ActionEvent e) {
                    String action = e.getActionCommand();
                    if (action.equals("Exit")) {
                        System.exit(0);
            panel_1.add(exitButton);
            exitButton.setText("Exit");
         public void actionPerformed(ActionEvent e) {
              String action = e.getActionCommand();
              if (action.equals("Start")) {
                   startButton.setText("Stop");
                   thread = new Thread( this );
                   thread.start();
              if (action.equals("Stop")) {
                System.exit(0);
         public void run() {
              myLoop();
         public void myLoop() {
              for (int i = 0; ; i++)
                   System.out.println(i);
         public static void main(String[] args) {
              StartStopButtons ssB = new StartStopButtons();
              ssB.setVisible(true);
    }

  • How to exit from the loop

    loop at itab.
    if <CONDITION>
    <EXIT LOOP>
    endif
    endloop.
    this ths condition , pz tel how to exit from loop

    Hi
    Loop
       statements
    EXIT
    Endloop.
    Will comes out of the loop.
    Regards,
    Sreeram Kumar.Madisetty

  • Catch in Loop w/o exiting loop.

    Hi,
    I'm performing a LOOP at table.  ENDLOOP.  Within the loop I have a TRY. ENDTRY. CATCH.  This is so I can perform a arithmatic statement and catch any errors.  The problem is, if an error occurs it exits the LOOP.  I don't want to exit the entire LOOP statement.  I just want to continue on with the next record in my internal table.  But instead, the loop is exited.
    Any ideas?
    Example code:
      LOOP AT t_pcts ASSIGNING <wa_pcts>.
            TRY.
                <wa_pcts>-percent = <wa_pcts>-expprod / <wa_pcts>-actprod.
              CATCH cx_root INTO oref.
                text = oref->get_text( ).
            ENDTRY.
      ENDLOOP.

    Hi,
    check if your program is activated. TRY CATCH in LOOP works fine.
    For my program:
    DATA gt_vbrp TYPE TABLE OF vbrp WITH HEADER LINE.
    APPEND INITIAL LINE TO gt_vbrp.
    APPEND INITIAL LINE TO gt_vbrp.
    APPEND INITIAL LINE TO gt_vbrp.
    LOOP AT gt_vbrp.
      TRY.
          gt_vbrp-fkimg = 100 / gt_vbrp-fkimg.
        CATCH cx_root.
          WRITE: / 'Exception'.
      ENDTRY.
      WRITE: / sy-tabix.
    ENDLOOP.
    I get correct result:
    Exception
             1
    Exception
             2
    Exception
             3
    Program does not interrupt the loop.
    Regards,
    Przemysław

  • How to ignore error and continue with next value in PL/SQL FOR loop?

    hi,
    When the DROP INDEX statement fails it have to continue with the next value in FOR loop without exiting from the loop. Can anyone tell me how to do this?
    DECLARE
    CURSOR aud_cur IS
    SELECT key_col_idx FROM audience_work where aud_ref_id between 106 and 109;
    BEGIN
    FOR aud_row IN aud_cur LOOP
    EXECUTE IMMEDIATE
    'DROP INDEX ' || aud_row.key_col_idx;
    END LOOP;
    END;
    Thanks,
    Noble

    DECLARE
      CURSOR aud_cur
      IS
      SELECT key_col_idx FROM audience_work where aud_ref_id between 106 and 109;
    BEGIN
      FOR aud_row IN aud_cur LOOP
        begin
          EXECUTE IMMEDIATE 'DROP INDEX ' || aud_row.key_col_idx;
        exception
          when others then
            if sqlcode = -01418 then
              dbms_output.put_line(' index does not exist ');
            else
              dbms_output.put_line(sqlcode);
              raise;
            end if; 
        end;
      END LOOP;
    END;
    /

  • How to code a parallel 'for loop' and 'while loop' where the while loop cannot terminate until the for loop has finished?? (queues also present)

    I've attached a sample VI that I just cannot figure out how to get working the way that I want.  I've labeled the some sections with black-on-yellow text boxes for clarity during the description that follows in the next few sentences.  Here's what I want:
    1) overall -- i'm intend for this to be a subVI that will do data acquisition and write the data to a file.  I want it to use a producer/consumer approach.  The producer construct is the 'parallel for loop' that runs an exact number of times depending on user input (which will come from the mainVI that is not included).  For now I've wired a 1-D array w/ 2 elements as a test case.  During the producer loop, the data is acquired and put into a queue to be delt with in the consumer loop (for now, i just add a random number to the queue).
    2) the consumer construct is the 'parallel while loop'.  It will dequeue elements and write them to a file.  I want this to keep running continuously and parallel until two conditions are met.
          i. the for loop has finished execution
          ii. the queue is empty.
       when the conditions are met, the while loop will exit, close the queue, and the subVI will finish. (and return stuff to mainVI that i can deal with on my own)
    Here's the problems.
    1)  in the "parallel for loop" I have a flat sequence structure.. I haven't had time to incorporate some data dependency into these two sequential sections, but basically, I just care that the "inner while loop" condition is met before the data is collected and queued.  I think I can do this on my own, but if you have suggestions, I'm interested.
    2)  I can easily get the outer for and while loops to run sequentially, but I want them to run in parallel.  My reasoning for this is that that I anticipate the two tasks taking very different amounts of time. .. basically, I want the while loop to just keep polling the queue to get everything out of it (or I suppose I could somehow use notifiers - suggestions welcome)...  the thing is, this loop will probably run faster than the for loop, so just checking to see that the queue is empty will not work... I need to meet the additional condition that nothing else will be placed in the queue - and this condition is met when the for loop is complete. basically, I just can't figure out how to do this.
    3) for now, I've placed a simple stop button in the 'parallel while loop', but I must be missing something fundamental here, because the stop button is totally unresponsive.  i.e. - when I press it, it stays depressed, and nothing happens.
    suggestions are totally welcome!
    thanks,
    -Z
    Attachments:
    daq01v1.vi ‏59 KB

    I'd actually like to add a little more, since I thought about it a bit and I'm still not quite certain I understand the sequence of events...
    altenbach wrote:
    zskillz wrote:
    So i read a bit more about the 'dequeue element' function, and as I understand it, since there is no timeout wired to the dequeue element function, it will wait forever, thus the race condition I suggested above can never happen!
    Yes, you got it!
    As I've thought about it a bit more, there's a few things that surprise me... first, the reason the 'dequeue element while loop' errors is not because there's nothing in the queue, it's becaues the queue has been released and it's trying to access that released queue...   However the problem I have is this --- Even though there's no timeout wired to the dequeue element, I still would think that the while loop that contains it would continue to run at whatever pace it wanted -- and as i said before.. most of the time, it would find that there is nothing to dequeue, but once in a while, something is there.  however, it seems that this loop only runs when something has been enqueued.  the reason I say this is illustrated in the next code sample MODv2 that's attached below.  I've added a stop button to the "queue size while loop" so the program runs until that is pressed.  I've also added a simple conditional in the "dequeue while loop"  that generates a random number if it a button is pressed... but this button is totally non-responsive... which means to me that the "dequeue while loop" isn't actually continuously running, but only when an element is added to the queue.  this still seems almost like the 'dequeue while loop" waits for a notifier from the queue telling it to run.  can you explain this to me? because it is different from what I expect to be happening.
    rasputin wrote:
    I tried to open your VIs but it doesn't work. LV
    is launched, the dialog box (new, open, configure...) opens and then...
    nothing. Not even an error message. I guess it isn't a problem of LV
    version or a dialog box would appear saying this. Could you, please,
    send a image of the code?
    Thanks,
    Hi Rasputin, I'm using LV8.  I assume that was your problem, but who knows.  I've attached a pic of of altenbach's solution since it's what I needed.
    thanks
    -Z
    Message Edited by zskillz on 10-20-2006 11:49 AM
    Attachments:
    daq01v1MODv2.vi ‏63 KB
    daq01v1MODpic.JPG ‏116 KB

  • How do i configure a FOR loop to have the behavior of the step Loop Type: Pass/Fail count?

    Hello,
    I'm using the Pass/Fail count set to one Pass to capture an event generated by my DUT.  I originally used a numerical compare step with the Looping type of Pass/Fail count to accomplish this.  Unfortunately the implementation changed and now I need to execute a few steps that can not be combined within one code module as before. Nor can these steps be put into a subroutine.  One of the steps executes a .NET asembly and I haven't figured out how to pass the reference to the subroutine.  When the subroutine is intered the reference is lost and the methode does not execute correctly.
    I have an evaluation function the exits the loop when the expected conditions are met. Everything works except for the Overall Pass/Fail result of the For loop.  If the loop exits due to the first numerical compare test passing, I want the loop overall execution to report as "Passed".  If the loop reaches it's predetermined number of iterations, the overall result needs to report as "Failed".  It would also be nice to have the radio button functionality of "Record Result of Each iteration".  Some conditions require a wait over a minute for the event to occur and I don't want to generate needless data for the report.
    Currently I get the pass/fail status for each For loop iteration, but only "Done" for each loop iteration.  I don't want the initial few failures to cause the test to fail.
    Does anyone know how to do this? Suggestions?
    Thanks,

    I have 2 steps in the loop that can not be combined into one step. This forces me to implement the behavior in some form of loop.  A While Loop could be an option.  I would need to pass the Step.Result.Status from the Multiple Numerical compaire step to the condition of the While Loop.  I tried to use the Step.TS.ID without success.  Some form of reference to the numerical compare step would be needed. I'm using a For Loop as I do want to limit the number of iterations of the loop.  In the case where the loop iterations are reached, the event I am trying to detect did not occur at the correct time and a failure needs to be reported.
    I came up with something based on my comments in the second post:
    1) To start with I configured a Locals.ForLoop_5 variable.  This is used to set the limit on the loop iterations and for comparison after the loop has finished executing. More on that later.
    2) The first step inside the loop invokes a method within a .NET assembly that has been packed in a DLL This method gets the required data from the DUT and stores it to a text file.
    3) The next step is the Multiple Numeric Limit step.  This step invokes a VI that extracts the data from the text file.  This step has been customized in several ways.
      i)  In Run Options, the Results Recording Option was disabled.  This prevents recording of "Failed" while the loop executes when waiting for the event to happen.
      ii) In Run Options, the Step Failure Causes Sequence Failure is unchecked.  Same reasoning as i)  These steps are not true failures.
      iii) A Post Action is configured to go to the nexxt step after the For Loop End step On Condition True with the logic of Step.Result.Status == "Passed".  This causes the loop to exit when the first "Passed" is encountered which corrolates with the event I'm trying to detect. On Conditon Fail remains set to default.
    4)  The step after the For Loop End is an expression step with everythin set to default except for the Status Expression logic set to: Locals.Loopindex < Locals.ForLoop_5 ? (Step.Result.Status = "Passed") : (Step.Result.Status = "Failed"). This step performs the overall Pass/Fail reporting for the For Loop.  If the number of loop iterations is less than the maximum it could have only gotten there by the previous logic triggered by the numerical compare passing, therefore "Passed".  If the loop index has reached the limit, then the event was not detected, therefore Failed.
    I have tested this work around with success, it just a pain to now have to implement this on my 40 some odd For Loops.
    If there is a better way, I'd still like to hear it.

  • Problem using local variable in event loop

    I have a state machine from which I want to monitor various controls, including "Start" and "Stop" buttons.  Not every state needs to monitor the controls.  At present, most states run timed loops.  In the first state that reads the front panel, I have an Event structure (inside a While loop) that monitors the various controls' Change Value events.  For numeric controls, I update variables (in shift registers) as needed.  The "Start" button is used to end the While loop controlling the Event structure, allowing the State to exit to the next state.
    My problem comes in subsequent states that employ this same idea.  Here, I put a Local Variable bound to the Start button and use the same code, but it frequently happens that when I enter this particular state, I cannot "turn on" the control -- I push the button, but it stays off.  Curiously, if it was On when I enter, I can turn it off, but then I'm stuck not being able to turn it on.
    I mocked up a very simply routine that illustrates this.  There are two sequences (corresponding to the two states).  Both use an Event loop with a local variable bound to my Stop button (really this is an LED control with custom colors).  I've deliberately moved the "initialization" (the declaration of the control in the block diagram) out of the Event loops -- putting it inside the first loop modifies the behavior in another strange way.
    Here's my thinking on how I would expect this to work:  The code outside Event Loop 1 should have little effect.  Assume the Stop button is initially Off.  You will "sit" in Event Loop 1 until you push the Stop button, changing its value to True; this value will be passed out of the Event case and cause the first While loop to exit.  You now enter the second sequence.  As I understand the Exit tunnel, it defaults to "False", so I'd expect to stay in the second Event loop until I turn the Stop button from On to Off, which will pass out a False, and keep me in the While for one more button push.  However, this doesn't happen -- I immediately exit, as though the "True" value of the Stop local variable is being seen and recognized by the Event loop (even though it hasn't changed, at least not in the context of this second loop).
    An even more curious thing occurs if I start this routine with the Stop button turned on.  Now I start in my Event loop waiting for a change, but this time the change will be from On to Off, which won't cause an exit from the frame.  This will be reflected by having the While loop count increment.  We should now be in the state of the example above, i.e. in an Event loop waiting for the control to be pushed again, and turned On.  However, clicking the control has no effect -- I cannot get it to "turn on".
    Where am I going astray in my thinking?  What is it about this method of doing things that violates the Labview paradigm?  As far as I can tell, what I'm doing is "legal", and I don't see the flaw in my reasoning, above (of course not -- otherwise I'd have fixed it myself!).  Note that because I'm using local variables inside Event loops (and I'm doing this because there are two places in my code where I want to do such testing), the Stop control is not latching (as required).  Is there something that gets triggered/set when one reads a latched control?  Do I need to do this "manually" using my local variable?
    I'll try to attach the simple VI that illustrates this behavior.
    Bob Schor
    Attachments:
    Simple Stop Conundrum.vi ‏14 KB

    altenbach wrote:
    Ravens Fan wrote:
    NEVER have multiple event structures that share the same events. 
    Actually, that's OK.  NOT OK is having multiple event structures in the same sequence structure.
    See also: http://forums.ni.com/ni/board/message?board.id=170&message.id=278981#M278981
    That's interesting.  I had always thought I read more messages discouraging such a thing rather than saying it was okay.  Your link lead me to another thread with this message. http://forums.ni.com/ni/board/message?board.id=170&message.id=245793#M245793.  Now that thread was mainly concentrating on registered user events which would be a different, but related animal. 
    So if you have 2 event structures they each have their own event queue?  So if you have a common event, one structure pulls it off its event queue and it does not affect the other structure's event queue?  I guess the inherent problem with this particular VI was that the second event structure locked the front panel.  Since the code never got to that 2nd event structure because the  first loop never stopped because the change was from true to false.  After reading your post and the others, I did some experimentation and turned off the Lock front panel on the 2nd structure, and that prevented the lockup of the program.
    Overall, the example VI still shows problems with the architecture and I think your answer should put the original poster on the right track.  I think as a rule I would probably never put the same event in multiple structures, I feel there are better ways to communicate the same event between different parts of a program,  but I learned something by reading your reply and about how the event structures work in the background.  Thanks.

  • EXIT command behaviour in ABAP code?

    Hi Experts,
    Pls. let me clarify that, the behaviour of EXIT command, like,
    - in IF statement
    - in LOOP
    - in PERFORM/FORM
    -in DO
    thanq

    to exit out of the event blocks and the loops we will use exit command.
    see these links for more info.
    http://help.sap.com/saphelp_nw70/helpdata/en/9f/db9af135c111d1829f0000e829fbfe/content.htm
    terminating the loop using exit
    DO 10 TIMES.
      IF sy-index = 3.
        EXIT.
      ENDIF.
      WRITE sy-index.
    ENDDO.
    The list output is:
    1 2
    module exit input.
    if ok_code = 'REFR'.
    call transaction 'ZMEDEMP'.
    elseif ok_code = 'BACK'.
    set screen 0.
    leave to screen 0.
    elseif ok_code = 'EXIT'.
    leave program.
    endif.
    endmodule.
    For E.g
    AT EXIT-COMMAND code.
    In your flow logic, you create a module as so:
    MODULE md_exit_command AT EXIT-COMMAND.
    Then in PF-status, you configure the Cancel (red button on toolbar) as exit button by setting Type of button as 'E'. Put OKCODE as 'CANC'.
    Then, in the module
    MODULE md_xit_command INPUT.
    CASE OKCODE.
    WHEN 'CANC'. LEAVE TO SCREEN 0. ENDCASE.
    ENDMODULE.
    Also refer,
    AT Exit
    Reward points..

  • Process chain - Loop

    Hello,
    I have a requirement where in, I would like to call a Infopackage load, DTP and activate DSO process types continously in a loop and exit when a certain condition is met.
    Looking for ideas on how to acheive this.
    For now, I created an ABAP to call the process chain via the FM in a loop and check the status using another FM and continue in the loop if the PC has sucessfully completed.
    I just think there's gotta be a better way to do this. Also, this method is kinda unstable - sometimes the PC runs upto the DTP and just stops. The program then stays in a infinite loop .
    Thanks,
    HD

    How about having your process chain scheduled "After Event".  Then in your process chain, the last process will call an ABAP program that will check for your condition, and trigger the event (which starts the process chain again) if the condition is not met.

  • How to come out of loop at last record?

    As I told in my previous posts,Iam transferring data from excel to zgkmaster tabel
    table structure:
    eid
    ename
    First I did SHDB(recording) and then made my BDC program.There are 10 records in table with names gopi,hari,rajesh.... with eid 1 to 10.My task is to updated all these names to 'XXX' for all 10 records (just for simple purpose).In my program I called 'Call transaction 'se11' using ptable mode 'A'.I moved from first screen to last screen (where you will update XXX and save for each record').Here:
    Loop at ptable into otable
    perform screens using <program name> <number> 'X'
    perform fields using zgkmaster-ename , otable-ename
    perform fields using 'BDC_OKCODE' , 'SAVE'
    perform screens using <program name> <number> 'X'
    perform fields using 'BDC_OKCODE' , 'NEXT'
    endloop.
    This code works fine in 'A' mode,but at last record a message comes 'Function code cannot be selected' (i think 'next' cannot be executed as it is last record) but all records are updated.
    When the mode is changed to 'N' and 'E',nothing is saved and the same error 'Function code cannot be selected'.Due the this error whatever data we give before that is not saving into table,may be due to this error.
    Now how shoud i make the loop exit when it reaches last record,i tried even with hardcording
    if sy-index = 10.
    leave prograam'
    endif.
    perform.....'NEXT' statement
    But the program is not exiting,I dont know why?Can anyone help me,I think if i made the loop to exit before next statement for last record that error will not occur.advise me if anything wrong.
    Thanks in advance
    The problem is that
    endloop

    Hi..
    1. To Terminate the LOOP in Last record.
        LOOP AT ITAB.
            << PROCESSING LOGIC>>
             AT LAST.
               EXIT.
             ENDAT.
        ENDLOOP.
    2. It is necessary to Declare the Internal table with same structure as the Excel file
    3. It is not necessary to call the Screen Explicitly before filling the BDCDATA record.
        If you want to process the Screen Twice the Fill the SAME SCREEN twice in BDCDATA Table and set the DYNBEGIN = 'X' in both the cases.
    REWARD IF HELPFUL.

Maybe you are looking for

  • Please help me decide on an all-in-one

    Hoping to buy an all-in-one soon mainly for uni work. Will also be using it for general web browsing, youtube, watching movies, etc. No gaming.  These are my options so far. If anyone could please help me decide it would be much appreciated as I am j

  • Getting second monitor settings to 'stick'

    Hopefully I'm missing something obvious... Is there a way to get LR2 to remember my choices/settings for the second monitor? I like to have it show the live loupe at 1:1, but every time I relaunch it's back to 'Normal' loupe and fit-to-screen. (On a

  • Libraries panel kills tool shortcuts

    Since updating PS recently, I've encountered a frustrating problem with the Libraries panel. Here are the steps to replicate it: Select a tool (any tool) Click inside the Libraries panel to put it in focus Try to select a different tool with a keyboa

  • 6110, Bluetooth and Alfa Romeo

    Hi In my new car, an Alfa Romeo, it's a Bluetooth system called Blue& Me (developed by Fiat and Microsoft). I have som problems with this connecting to my Nokai 6110 Navigator: - The phone won't connect on first attempt. Ok on second. - It won't conn

  • Mdworker (Launchd) using CPU 100%

    I'm using 10.8.2. I've observed today in the activity monitor that "mdworker" is using 100% of my CPU. When I click the 'inspect' button it showed "launchd" as the parent process for "mdworker". My CPU temperature is in between 70 to 80 celcius. This