How to exit from loop after 3  time

hi
how to exit from loop after 3  time
loop at itab.
<exit after 3 time>
endloop.
thanks

Hi,
You can check the value of SY_TABIX inside loop,
For Example:
Loop at itab.
if sy-tabix  = 3.
Exit.
endif.
Endloop.
Hope it helps
Regrds
Mansi

Similar Messages

  • How to exit from a loop on 2 different conditions

    Hello Experts
    I’m trying to write a procedure in which I’m taking PROVINCE as an input parameter. All the provinces are stores in a table. I’m using a cursor and rowtype variable to check the province. After I finds province I displays province and its code. Everything works fine expect when I don’t find the province. I’m not sure how to exit from loop if I don’t find the province. I already uses exit when condition. I was expecting else condition should work and should exit from the loop but it doesn’t. Can please somebody show me how to exit if I don’t find province in the table through cursor.
    Here is my code
    set serveroutput on
    variable G_TAX varchar2(10)
    CREATE OR REPLACE PROCEDURE p_create(i_state VARCHAR2)is
    CURSOR cur_bb_tax is
    select * from bb_tax;
    bb_tax_details bb_tax%rowtype;
    begin
    if not cur_bb_tax%isopen then
    open cur_bb_tax;
    end if;
    loop
    fetch cur_bb_tax into bb_tax_details;
    if (bb_tax_details.state = i_state) then
    dbms_output.put_line(bb_tax_details.state || bb_tax_details.idstate);
    end if;
    exit when bb_tax_details.state = i_state;
    end loop;
    close cur_bb_tax;
    exception
    when others then
    dbms_output.put_line(SQLERRM);
    end;
    Thanks in advance

    Hello,
    Why don't you use dbms_output.Put_line and print output to find why logic is not able to execute? Maybe upper case/lower case/whitespace. *Also put your code between \ to preserve formatting*.
    Regards                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • How to stop a while loop after certain time using Elapsed time vi

    how to stop a while loop after certain time using Elapsed time vi.

    Hi Frankie,
    Just place the Elapsed Time VI inside the WHILE loop, and wire the 'Time Has Elapsed' output to the conditional terminal in the lower right corner (which should be set to 'stop if true' by default).
    In the future, please post your LabVIEW questions to the LabVIEW Forum.  You have a much better chance of getting your questions answered sooner, and those answers can then help others who are searching the LabVIEW forums.  Thanks!
    Justin M
    National Instruments

  • How to exit from while loop

    Hi
        I want to exit from loop if error is encountered.
    THanks

    Hi Sonu,
    This is not a question related to the SDK. This is more of a coding question you should probably try something like StackOverflow or MSDN forums for that next time.
    Regarding your question it depends on the language you are using. If you are using c# you can use the keyword "break;" inside an if that checks for the error. In VB you can use "Exit For" or "Exit While".
    Best regards,
    Pedro Magueija

  • 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

  • How to exit from the button test in diagnostic mode

    Hi,
    I am having some trouble with my ipod 7th gen.
    First my lightning cable wont be recognize. show the error Accesory incompatible.
    I try to solve the problem cleaning the golden pins in the cable and in the ipod. Don't work
    I enter in diagnostic mode in my ipod and I get stucked in the button counter test..
    In the screen appear a mesage 'Please reset the unit to end'. I don't know how to reset the unit
    I press any button and only increase the counter for every button.
    First how acan exit from the button counter test and how can fix the issue with the lightning cable

    Your problem is that you are trapped inside an event case. It is not a good idea to run extended code inside event cases, else the event structure cannot service other events.
    Why don't you use the outer loop for everything? Now things don't step on each others toes. What good is an event structure if it cannot react at all times???
    Message Edited by altenbach on 07-25-2008 12:26 AM
    LabVIEW Champion . Do more with less code and in less time .
    Attachments:
    event_problemMOD.vi ‏17 KB

  • How to exit from recovery mode?

    how to exit from recovery mode?

    You could try a hard reset
    - hold the home button and the sleep/wake button down at the same time
    - the phone will turn off, when the apple logo appears release both buttons
    More than likely after this you will still be in recovery mode. If so then you would need to restore the phone through itunes on a pc/mac.
    Hope this helps

  • Memory requirement is continiously increased when i am running my application program in an infinite loop,after certain time it shows an error called low virtual memory

    memory requirement is continiously increased when i am running my application program in an infinite loop,after certain time it shows an error called low virtual memory

    What are you doing with your program. Lots of improper programming techniques can cause this - building arrays, concantanating strings, opening but not closing refrences, etc. Need more details or post your VI. Also, have you looked at "LabVIEW Performance and Memory Management"? It's part of the shipping documentation and available from Help>Search the LabVIEW Bookshelf.

  • How to exit from whileloop with Timing Delay

    Hello;
    How to exit from forwhile with timing wait (10s) before finish 10s by stop botem;
    exemple ; first impulsion to start a while loop with 10 s wait ,before finsh a 10s second impulsion to stop the while loop; in labview 2010
    best regrds
    Forza Juventus

    Show us the code you currently have.  Just repeating your specification word-for-word is not going to help us to understand you problem.
    There are only two ways to tell somebody thanks: Kudos and Marked Solutions
    Unofficial Forum Rules and Guidelines

  • How to exit from a WebDynpro ABAP application and open another url

    Hi Friends,
    How to exit from a WebDynpro ABAP application and open another url like (www.yahoo.com) in the same window of the WD4 application on click of a Button?
    Regards,
    Xavier

    Hi,
    First of all you should create outbound plug in the window you are trying to exit with plufg type "Exit"
    Then create method handler in the view with this code
            data lo_view_cntr type ref to if_wd_view_controller.
            data lo_win_cntr type ref to if_wd_window_controller.
            data: l_parameter_list type wdr_event_parameter_list,
                  l_parameter type wdr_event_parameter,
                  l_val type ref to data,
                  l_val_url type REF TO data.
            field-symbols: <fs> type any,
                           <fs_url> type any.
            lo_view_cntr  = wd_this->wd_get_api( ).
            lo_win_cntr = lo_view_cntr->get_embedding_window_ctlr( ).
            CREATE DATA l_val type c.
            CREATE DATA l_val_url type string.
            ASSIGN l_val->* to <fs>.
            ASSIGN l_val_url->* to <fs_url>.
            <fs> = 'X'.
            <fs_url> = 'http://your-link.com'.     
            l_parameter-name = 'URL'.
            l_parameter-value = l_val_url.
            INSERT l_parameter INTO TABLE l_parameter_list.
            lo_win_cntr->if_wd_view_controller~fire_plug( EXPORTING plug_name = 'EXIT_PLUG'
                                                                    parameters = l_parameter_list ).
          You can easily change this logic to exit application instead of redirecting to the site
           just changing to
           l_parameter-name = 'CLOSE_WINDOW'.

  • Exit from loop by user

    Hi every body
    i have a procedure that execute a loop.What i want that to allow user to exit from loop before it finished(by using keyboard), i do that by pressing ctrl+alt+del which end the program it self.

    One could try putting the call to the procedure in a loop on the front end. Then check within the loop (in the front end ) whether the user has pressed a pre-defined button. If pressed, one could disconnect the connection or take some similar action that would stop processing the call to the stored procedure.
    May be something like this is workable ... ?
    Narayan.
    null

  • How to Exit from Session by executing program

    How to Exit from Session by executing program

    Hi,
    Try the following
    CALL the function module HLP_MODE_CREATE and pass '/nex' to tcode import parameter.
    Regards,
    Sesh
    Message was edited by: Seshatalpasai Madala

  • How to exit from the DO-while loop in the event structure

    Hi all
    I am just a beginner for Labview
    I want to build a loop in the event structure, but when I enter in the loop, it seems the system is dead, and I can't exit the loop.
    here I attached a simple sample.
     In the sample.  when I press the start_calculation button , the calculation start, but the system is dead, and I can't exit calculation loop.
     actually, i just want switch the different operation by changing the event action.
    anybody has a good idea about it??
    thanks so lot
    Attachments:
    event_problem.vi ‏17 KB

    Your problem is that you are trapped inside an event case. It is not a good idea to run extended code inside event cases, else the event structure cannot service other events.
    Why don't you use the outer loop for everything? Now things don't step on each others toes. What good is an event structure if it cannot react at all times???
    Message Edited by altenbach on 07-25-2008 12:26 AM
    LabVIEW Champion . Do more with less code and in less time .
    Attachments:
    event_problemMOD.vi ‏17 KB

  • How to continue the loop after getting the exception NO_DATA_FOUND

    I am inserting 2000 employees attendance data into table through procedure by validating the shifts assigned some times if employee doesn't have shift it raising NO_DATA_FOUND exception, so now I am inserting the details of the employee into one table as a log.
    my question is if 2000 transactions are inserting if exception raised at 1000 record as "NO_DATA_FOUND" is it remaining records will insert into the table? or it will exit from the procedure and stops remaining 1000 transactions?, please advice if any other way to continue the remaining transactions
    oracle version: 11 G R2, OS: Windows 2008 R2

    Do your select statement in a seperate begin...end block, you can cath the excption in the block and do your logging there.
    Something like this
    --just an example from scott/tiger
    Declare
    CNT number := 7851 ;
    vname varchar2(25);
    ins_flag boolean ;
    BEGIN
    while cnt  <= 7935 and cnt >=7850
    LOOP
    Begin
    select ename into vname from emp where empno=cnt ;
    ins_flag := true;
    exception
      when no_data_found then
    -- dbms_output.put_line('no data');
    ins_flag := false;
    end;
      if ins_flag then
      --do insert here
      dbms_output.put_line('do your insert here');
    else
      dbms_output.put_line('no insert');
    end if;
      cnt := cnt+1 ;
    END LOOP;
    end;

  • Pause and restart while loop after defined time

    Hello,
    What I need is to find a way to run a while loop that is acquiring and analysing a movie, to pause this while loop for a time I specify, and re-run it after that time has passed.
    I'm attaching a picture of the relevant parts of my VI. In the case structure of the "true" or "false", the program is checking, online, if the eye (my camera is focusing on the eye) is open above some threshold and for a certain duration of time. When "condition to start" is met, two things happen: one, the case structure changes to "false" and waits for some time; second, the loop of my state machine is triggered. Problem is, because I'm not really pausing my while loop (it's still running even when it's the "false" case), my state machine runs really slowly - for example, I have a part of video acquisition in my state machine, and saving the frames to avi takes forever. 
    Does anyone have any idea of how I could stop the while loop for x time?
    Thanks in advance!
    Attachments:
    help_pauseWhileLoop.png ‏112 KB

    Hi,
    I'm attaching (hopefully) better pics, if you still can't see let me know and I'll attach the code. About the frame saving and acquistion, I'm already doing that in a separate loop - you can't see my entire code in the pics, but what I have is a state machine that works as a producer loop and then a consumer loop, where video acquisition is happening. Now I'm working on a third loop (the one in the picture), that starts before the others and where I don't even want to save the movies - I just want it to check, online, if the condition is met (e g, the eye is open for a specified time) and if so, start the state machine and stop running, until the state machine has finished running. Then do the same, after waiting a specified time. I know that the problem is that the while loop keeps running after triggering the state machine, because if I remove that part and trigger it manually, the VI runs just fine and really fast. So how can I run, stop and restart the while loop?
    Attachments:
    help_pauseWhileLoop1.png ‏56 KB
    help_pauseWhileLoop2.png ‏32 KB

Maybe you are looking for