Exiting from Inner Loop.
Example.
Loop at I_catsdb.
Loop at I_catsdb_tmp.
endloop.
endloop.
How do I come out of the inner loop on certain conditions?
Hi,
Use the EXIT statement..
Loop at I_catsdb.
Loop at I_catsdb_tmp.
Check the conditions..
EXIT.
endloop.
endloop.
Thanks,
Naren
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 advanceHello,
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 -
loop at itab.
if <CONDITION>
<EXIT LOOP>
endif
endloop.
this ths condition , pz tel how to exit from loopHi
Loop
statements
EXIT
Endloop.
Will comes out of the loop.
Regards,
Sreeram Kumar.Madisetty -
Hi
I want to exit from loop if error is encountered.
THanksHi 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 -
Hi all, I have this annoying problem and I am looking for any suggestions.
I have 2 select boxes. One is for all available users, and second - for selected users (designated as admins). The list of all users is available in a collection (2 properties userId and userName displayed in the code below). The list of admins contains only userId (as strings).
I have no problem with populating selected users (admins) list, reusing pretty much the same logic below, but I cannot find a way to break out from the nested loop once the match is found, to avoid repetitions leading to incorrect display of results.
<select name=available>
<c:forEach items="${users}" var="user" varStatus="outer">
<c:forEach items="${adminIds}" var="adminId" varStatus="inner">
<c:if test="${user.userId!=adminId">
<option value="<c:out value="${user.userId}" />"><c:out value="${user.userFullName}"/></option>
</c:if>
</c:forEach>
</c:forEach>
</select>
<select name=selected>
<c:forEach items="${users}" var="user" varStatus="outer">
<c:forEach items="${adminIds}" var="adminId" varStatus="inner">
<c:if test="${user.userId==adminId">
<option value="<c:out value="${user.userId}" />"><c:out value="${user.userFullName}"/></option>
</c:if>
</c:forEach>
</c:forEach>
</select>Can anyone help, please? I am also restricted to JSP 1.2Double post: http://forum.java.sun.com/thread.jspa?threadID=707950&tstart=0
-
How to terminate or exit a for loop when the user clicks on stop button
Actually my problem is to stop a loop when i click on stop button.
example:i have two buttons 'start' and 'stop'
in start buttom i wrote a for loop as
dim i as integer
For i=1 To 100000
print i
Next
when i click on start buuton it prints 'i' value up tp 100000.
my question is when i click on 'Stop' button the for loop has to terminate or Exit from the loop and should stops the execution.
Is it possible to termianate or Exit the 'for loop'
PS.Shakeer Hussain
HyderabadI am unable to stop the loop and application not at all allowing to Press the Stop button.
It seems like Hung, any advise ?
Private Sub btnStart_Click(sender As Object, e As EventArgs) Handles btnStart.Click
btnStop.Enabled = True
btnSelectFile.Enabled = False
btnStart.Enabled = False
btnStop.Focus()
Dim strFileName As String = txtFileName.Text.ToString
Dim strLineText As String
If System.IO.File.Exists(strFileName) = True Then
Dim objReader As New System.IO.StreamReader(strFileName)
While objReader.Peek() <> -1 And stopclick = False
strLineText = objReader.ReadLine()
MsgBox(strLineText, MsgBoxStyle.Information)
Application.DoEvents()
Thread.Sleep(My.Settings("strDelay") * 1000)
'System.Diagnostics.Process.Start(My.Settings("strFireFoxLocation"), strLineText)
End While
End If
End Sub
Private Sub btnStop_Click(sender As Object, e As EventArgs) Handles btnStop.Click
stopclick = True
btnSelectFile.Enabled = True
btnStart.Enabled = True
btnStop.Enabled = False
End Sub
Raman Katwal
Please remember to mark the replies as answers if they help and unmark them if they provide no help -
To exit from the while(1) loop
Hi all ,
I have a simple question that if in a callback function of a command button, i use a While(bLoop)
loop , where bLoop is a boolean variable initially set to TRUE, then how can i break or exit from this while Loop by using a control on the front panel , which exits the while loop by setting bLoop = FALSE .
I have tried it but it is not exiting
Solved!
Go to Solution.The problem here is that CVI normally only executes one callback at a time. While you are in one control callback, no GUI processing and subsequent calls to other callbacks normally occurs.
You can try the following approach - but it is not really the best method:
while (b_loop) { // Inside a callback
... // Perform your tight program loop
ProcessSystemEvents (); // Force CVI to see if any GUI controls need servicing
If you have a different control callback to clear the global b_loop, this quick-and-dirty approach might work for you.
You should only use this technique for very simple programs - it can rapidly spiral out of control and end up in a mess if you're not careful. NI recommends that you do not use ProcessSystemEvents() inside a control callback.
JR -
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 -
Update a front panel indicator from a loop inside a called vi. Without exiting
I am looking for the best way to update some indicators from within loop within a called .vi.
I need to update the front panle without exiting the loop.
I am able to use functional global vi to update the values of front panel indicators from within my nested loops, but I am looking for the best way that these values can be read to update my indicators.
ThanksOr a cluster of references, that way each reference can be named, and can be different types to match the respective indicator.
There are also methods where you can just send in a VI reference, and in the subVI traverse all the controls and search for the appropriate references by name.
Take a look at this long nugget. -
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.
thanksHi,
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 -
if in a loop iam checkin a condition n if the condition satisfies then which is the best way to exit the loop.
Hi Sushant,
Use EXIT in the LOOP after the condition .If u use STOP it will exit from the Program.
Try this example creating a Program by uncommending EXIT and STOP.
DATA: t_mara TYPE STANDARD TABLE OF mara.
DATA: w_mara TYPE mara,
sum TYPE i.
SELECT matnr mtart FROM mara INTO CORRESPONDING FIELDS OF TABLE t_mara
WHERE mtart EQ 'KMAT' OR mtart EQ 'FERT' OR mtart EQ 'LGUT'.
sum = 0.
IF sy-subrc EQ 0.
SORT t_mara BY mtart.
LOOP AT t_mara INTO w_mara.
IF w_mara-mtart EQ 'LGUT'.
sum = sum + 1.
EXIT.
*STOP.
ENDIF.
ENDLOOP.
ENDIF.
WRITE : sum.
Reward Points if useful.
Regards
Avi... -
Which system variable is reset at the exit of a loop of an internal table
which system variable is reset at the exit of a loop of an internal table
a)sy-loop b)sy-index c)sy-dbcnt d)sy-tabixYou might want to revist your threads from Friday, and award points and mark as "Answered" or "Solved".
Regards,
Rich Heilman -
hi guys,
does anyone know the correct way to exit a server loop, at the moment i have ....
while(!SrvInput.getEndProgStatus()){
sk = skt.accept();
System.out.println("Accepting new client connection");
serverThread st = new serverThread(sk, conn);
st.start();
this just loops around creating a new thread for every client that connects, i have a class SrvInput which reads input from the console so if the user types "quit" the end prog status flag is set to true and the server exits.
the problem is that for it to exit i need one more person to connect since it blocks on the accept call.
Does anyone know how i can sort this out
thanks for any helpHi.
I'm trying to solve the same problem. I solve it, sending myself a Socket conection and then existing the while code like this:
public void run()
while (!isFinish())
try
System.out.println("Waiting for connections.");
Socket client = serverSocket.accept();
if (!isFinish())
System.out.println("Accepted a connection from: "+client.getInetAddress());
LocationThread connect = new LocationThread(client);
}catch(Exception e)
System.out.println(e.getMessage());
e.printStackTrace();
try
System.out.println("Server exiting");
join(); // remove join(), this a test.....
serverSocket.close();
System.out.println("Server has exit");
}catch(Exception e)
System.out.println("Error al cerrar el Socket");
}This code belongs to the server side.
I do this, in a Button in a GUI interface.
try{
location.setFinish(true);
Socket s = new Socket(InetAddress.getLocalHost(),Integer.parseInt(result));
}catch(Exception e)
System.out.println("Error al tratar de terminar el servidor");
}But I have a problem, I want my server to wait for their childs to finish, How can I do it?.
a Join() , do the server to hang.
Any suggestion ?. -
How to track exit from the PageFragment Lifecycle
Hi,
I have a requirement of keeping track of exit from a pageFragment.
My structure contains: a TaskFlow which contains a train . This train node contains the page Fragments. Now when i navigate from one PageFrag to another ie. when i exit the currently selected node having a page Fragment, i need to fire a logic.
I tried using creating a bean which implements RegionController interface which has refreshRegion(RegionContext ) method.I got hold of RegionBinding interface which has only one of the following values: Entry, Execute_Model, Prepare_Model, Refresh_Unknown, Render_Model and Type_executable_region.
Also in this case i am not exiting the TaskFlow during the navigation.
My doubt is how do i or can i use RegionController to keep track of exit from the currently rendered PageFragment's Lifecycle.
Also , can i use PagePhaseListener to keep track of the PageFragment lifecycle stage. (My understanding is PagePhaseListener is to be used for Jspx not Jsff). Plz do correct me if i am wrong.
Thanks,
Prasenjit
Edited by: user586616 on Aug 31, 2009 3:54 AM
Edited by: user586616 on Aug 31, 2009 3:57 AMHi Frank,
I have created a ControllerClass which implements RegionController. I have registered the same as controller class in my pageFragments PageDef.
So, on navigation from one train node to another. due to post back call to leaving node and freshcall to the arriving node in the train flow. i am able to get the leaving as well approaching node.
My doubt is can i get similar or better control over the nodes traversed using trainModel or anyother adfinternal controller class? Kindly suggest any better way of getting handle to the navigating train nodes.
Sample Code which i have implemented:
public class RegionControllerBean implements RegionController {
public boolean refreshRegion(RegionContext regionContext) {
System.out.println("**********************************");
System.out.println("inside refreshRegion method call");
String selectedView = ControllerContext.getInstance().getCurrentViewPort().getViewId(); ------> this gives me the handle to the viewId of the curently selected pageFragment
System.out.println(ControllerContext.getInstance().getCurrentViewPort().getViewId().toString());
String pageName = selectedView.split("/")[2];
System.out.println("Current PageName:"+pageName);
System.out.println("name: "+regionContext.getRegionBinding().getName());
int refreshFlag = regionContext.getRefreshFlag();
if(refreshFlag == RegionBinding.PREPARE_MODEL){
System.out.println("Inside prepare Model phase"); ------> on entering of that node i need to call some logic before prepare_model phase
if(refreshFlag == RegionBinding.EXECUTE_MODEL){
System.out.println("Inside execute model phase");
if(refreshFlag == RegionBinding.RENDER_MODEL){
System.out.println("Inside render model phase");
// propagate refresh to inner binding container
regionContext.getRegionBinding().refresh(refreshFlag);
return false;
public boolean validateRegion(RegionContext regionContext) {
// propagate the validate to inner binding container
System.out.println("inside validate region method");
regionContext.getRegionBinding().validate();
return false;
thanks,
Prasenjit -
Hello Gurus,
How can I get user exit from ABAP workbench ?
thanks very much!here is the program for the user exits..
REPORT z_find_userexit NO STANDARD PAGE HEADING.
TABLES : tstc, "SAP Transaction Codes
tadir, "Directory of Repository Objects
modsapt, "SAP Enhancements - Short Texts
modact, "Modifications
trdir, "System table TRDIR
tfdir, "Function Module
enlfdir, "Additional Attributes for Function Modules
tstct. "Transaction Code Texts
*& Variables
DATA : jtab LIKE tadir OCCURS 0 WITH HEADER LINE.
DATA : field1(30).
DATA : v_devclass LIKE tadir-devclass.
*& Selection Screen Parameters
SELECTION-SCREEN BEGIN OF BLOCK a01 WITH FRAME TITLE text-001.
SELECTION-SCREEN SKIP.
PARAMETERS : p_tcode LIKE tstc-tcode OBLIGATORY.
SELECTION-SCREEN SKIP.
SELECTION-SCREEN END OF BLOCK a01.
*& Start of main program
START-OF-SELECTION.
Validate Transaction Code
SELECT SINGLE * FROM tstc
WHERE tcode EQ p_tcode.
Find Repository Objects for transaction code
IF sy-subrc EQ 0.
SELECT SINGLE * FROM tadir
WHERE pgmid = 'R3TR'
AND object = 'PROG'
AND obj_name = tstc-pgmna.
MOVE : tadir-devclass TO v_devclass.
IF sy-subrc NE 0.
SELECT SINGLE * FROM trdir
WHERE name = tstc-pgmna.
IF trdir-subc EQ 'F'.
SELECT SINGLE * FROM tfdir
WHERE pname = tstc-pgmna.
SELECT SINGLE * FROM enlfdir
WHERE funcname = tfdir-funcname.
SELECT SINGLE * FROM tadir
WHERE pgmid = 'R3TR'
AND object = 'FUGR'
AND obj_name = enlfdir-area.
MOVE : tadir-devclass TO v_devclass.
ENDIF.
ENDIF.
Find SAP Modifactions
SELECT * FROM tadir
INTO TABLE jtab
WHERE pgmid = 'R3TR'
AND object = 'SMOD'
AND devclass = v_devclass.
SELECT SINGLE * FROM tstct
WHERE sprsl EQ sy-langu
AND tcode EQ p_tcode.
FORMAT COLOR COL_POSITIVE INTENSIFIED OFF.
WRITE:/(19) 'Transaction Code - ',
20(20) p_tcode,
45(50) tstct-ttext.
SKIP.
IF NOT jtab[] IS INITIAL.
WRITE:/(95) sy-uline.
FORMAT COLOR COL_HEADING INTENSIFIED ON.
WRITE:/1 sy-vline,
2 'Exit Name',
21 sy-vline ,
22 'Description',
95 sy-vline.
WRITE:/(95) sy-uline.
LOOP AT jtab.
SELECT SINGLE * FROM modsapt
WHERE sprsl = sy-langu AND
name = jtab-obj_name.
FORMAT COLOR COL_NORMAL INTENSIFIED OFF.
WRITE:/1 sy-vline,
2 jtab-obj_name HOTSPOT ON,
21 sy-vline ,
22 modsapt-modtext,
95 sy-vline.
ENDLOOP.
WRITE:/(95) sy-uline.
DESCRIBE TABLE jtab.
SKIP.
FORMAT COLOR COL_TOTAL INTENSIFIED ON.
WRITE:/ 'No of Exits:' , sy-tfill.
ELSE.
FORMAT COLOR COL_NEGATIVE INTENSIFIED ON.
WRITE:/(95) 'No User Exit exists'.
ENDIF.
ELSE.
FORMAT COLOR COL_NEGATIVE INTENSIFIED ON.
WRITE:/(95) 'Transaction Code Does Not Exist'.
ENDIF.
Take the user to SMOD for the Exit that was selected.
AT LINE-SELECTION.
GET CURSOR FIELD field1.
CHECK field1(4) EQ 'JTAB'.
SET PARAMETER ID 'MON' FIELD sy-lisel+1(10).
CALL TRANSACTION 'SMOD' AND SKIP FIRST SCREEN.
give the tcode it will show the user exit and if u click on the user exit it will takes to the code..
regards,
venkat
Maybe you are looking for
-
Host name changed on server after router reboot?
I recently installed a new router and when I started my Mac Pro the server (10.7.5) Serverwould not respond and I received an error message stating the host name has changed on my server. I can not recall what I did nut I got the server working. I ha
-
I bought Indesign as one app but it doesn't show in my account. How can I install?
I bought Indesign as one app but it doesn't show in my account. How can I install?
-
Restriction of characteristic getting problem......
Hi All, When i am doing restriction on characteristic i am getting the error like Run time error '-2147417848(80010108)'; Automation error The object invoked has disconnected from its clients. I dont understand its my problem or any other Basis Issue
-
How can add or open a document like word,excel from forms ?
Hello, I want to open a excel file from my forms from a specific location , i have to write the code in when-button-pressed button i.e when i will click on add button it will open a dialog box there i need to browse the excel file then it will add th
-
Adobe Reader preventing computer shutdown.
Hi. I use Vista and IE7. When I shutdown click on the Shutdown Gadget on my desk top I get the following message; "One or more PDF documents are open inside a web browser. If you exit Adobe Readernow these documents will be closed. Are you sure you w