Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Exit command

Former Member
0 Likes
794

I have the following logic

if

loop

if

if

-


> Here I use EXIT command

endif

endif

endloop

endif

............

Will the control of the program return out of the outermost if endif

7 REPLIES 7
Read only

Sm1tje
Active Contributor
0 Likes
753

No, it will get out of the loop.

If you're using this in a subroutine for example, and you want to leave this subroutine, then use RETURN.

Read only

Former Member
0 Likes
753

No it will come out of the innermost if-endif.

I ahve tries out ur case and it will jst come out of the innermost if-endif. for ur concern u can jst debug this code

types : begin of zmr_tc_cert_header,

lfimg type lfimg,

meins type meins,

length(100),

end of zmr_tc_cert_header.

data : zmr_tc_cert_header type zmr_tc_cert_header.

data : it_try type standard table of zmr_tc_cert_header.

data : d type c value 1,

e type c value 1,

f type c value 1.

start-of-selection.

append zmr_tc_cert_header to it_try.

if d = 1.

loop at it_try into zmr_tc_cert_header.

if e = 1.

if f = 1.

write:/ 'dlfkjasdlfk'.

endif.

endif.

endloop.

endif.

reward if helpful

Edited by: Ashish Paliwal on Apr 3, 2008 3:12 PM

Read only

Former Member
0 Likes
753

Hi S V,

No it would not.

Exit command works in the same way as it works in other languages

1.In IF statement it comes out at the end of the code.

2.In for loop it comes out of the inner loop.

3.In perform it comes out the particular subroutine.

Kindly Reward Points If You Found The Reply Helpful,

Cheers,

Chaitanya.

Edited by: Chaitanya Raju on Apr 3, 2008 11:29 AM

Read only

Former Member
0 Likes
753

what ever may be...

if you exit place it in side loop and endloop then it comes out of loop and endloop.

if and endif is not a loop. so it take comes out of loop and endloop. even you place it inside if and endif.

so because of the reason it comes out of your main if and endif that is your feeling.

Read only

Former Member
0 Likes
753

hi,

If the EXIT statement is listed within a loop, it leaves the loop by ending the current loop process. Program execution is continued after the closing statement in the loop.

Read only

Former Member
0 Likes
753

Hi,

The control of the program return out of the outermost if endif.

Your exit is with in all the if endifs and loop...endloop.

Reward.

Read only

Former Member
0 Likes
753

Hi,

When you write exit it will come out of the loop and it will there with in outermost if endif.