Application Development 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: 

EXIT statement

Former Member
0 Kudos

hi

what happens in the following scenarios

form a

perform b

statement1

statement 2

endform

form b

if sy-subrc eq 0

exit

endif.

endform

will it exit from form b or form a also?

in the above case if the form b is like this

form b

select statement

check sysubrc eq 0.

statemnet1

statement2

endform.

what happens now?

3 REPLIES 3

former_member555112
Active Contributor
0 Kudos

Hi,

Code and check.

This seems to be some interview question.

Regards,

Ankur Parab

Former Member
0 Kudos

hi

it doesn't work until you write 'perform a' stmt in report.

if you write so ,

1)in first case

( if sy-subrc eq 0.

exit.

endif in form b).....

it wil excute what ever you write after perform b stmt in form a.(i.e in your case stmt 1 stmt2)

because if sy-subrc = 0 or any value control just terminate the form .

2)in second case.(check stmt)

if sy-subc = 0.

then it wil excute after check stmt.

if sy-subrc = any other value

control terminate the form.

Former Member
0 Kudos

Hi,

In the first case it will only exit from perform b and then continue with perform a.

Try to write the code and then try debugging it, you will come to know the exact flow.

In second case statement1 and statement 2 gets executed twice.

Hope this may be useful..

Regards,

Prashant