‎2006 Sep 05 7:47 PM
I wrote one exam in the sapdomain and it has got one question as follows.
if we have Exit in the loop of a sub Routine which is called from a programme what is the output.
The sapdomain gave the answer as exit from loop. But I read in the book as if we have exit in the program, the program comes out and displays the list which is contradicting from the above. Please clarify. please eloborate as much as possible.
Thank you
‎2006 Sep 06 6:46 AM
hi
good
the EXIT command works as per the use, as per the question you got in sapdomain the EXIT commnad had been used inside the LOOP so it come out from the loop, if the same EXIT command used inside the program than it would have been comout from the program.
the EXIT command works as per current flow of the program, if current flow is inside the loop statement than it comes out from that particular loop statement , and if the same EXIT command is inside the program than it ll come out from that program.
thanks
mrutyun^
‎2006 Sep 05 7:51 PM
What you read & got in the exam are both correct. Only the context differs.. that is the reason SAP recommends use of EXIT only inside a loop; To exit processing blocks, use the statement RETURN.
~Suresh
‎2006 Sep 05 10:06 PM
The behaviour of exit is diff in diff situations
if you use it in coditional loops like do..enddo, while..endwhile and loop and loop ....it will comeout of the conditional loop.
and it behaves diff in events...
if you use exit in your prog it won't leave the prog but it depends where you used exit.
for example if you use exit after start-of-selection then program goes to the list(report output) without processing further.
if you use in initialization then it will directly to the selection screen without processing further.
‎2006 Sep 06 6:46 AM
hi
good
the EXIT command works as per the use, as per the question you got in sapdomain the EXIT commnad had been used inside the LOOP so it come out from the loop, if the same EXIT command used inside the program than it would have been comout from the program.
the EXIT command works as per current flow of the program, if current flow is inside the loop statement than it comes out from that particular loop statement , and if the same EXIT command is inside the program than it ll come out from that program.
thanks
mrutyun^