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

regarding preform

Former Member
0 Likes
724

perform rajesh.

form rajesh.

some code.

exit.

endform.

what will hapen when exit triggers.

is it come out from perform or come out from form.

could u plz explain clearly step by step

with code.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
696

hi Rajesh,

exit will come out of the form, which eventually means that it comes out of

the perform!

When and <b>EXIT</b> is called inside,

<u>1. loop</u>

It exits the current loop.

<u>2. IF condition.</u>

it exits the current condition check.

<u> Form</u>

it exits the form

<u>event (start of selection) </u>

it exits the event.

Hope this helps,

Sajan Joseph.

6 REPLIES 6
Read only

Former Member
0 Likes
697

hi Rajesh,

exit will come out of the form, which eventually means that it comes out of

the perform!

When and <b>EXIT</b> is called inside,

<u>1. loop</u>

It exits the current loop.

<u>2. IF condition.</u>

it exits the current condition check.

<u> Form</u>

it exits the form

<u>event (start of selection) </u>

it exits the event.

Hope this helps,

Sajan Joseph.

Read only

Former Member
0 Likes
696

Hi Rajesh,

EXIT - will come out the routine.

For an example You want to come out of the loop if sy-tabix is greter than 5.

PERFORM populate_data.

FORM populate_data .

Loop at internal table.

if sy-tabix > 5.

exit.

ENDIF.

endloop.

ENDFORM.

If u r not clear let me know i will send the detail code.

By

Nava

Read only

0 Likes
696

could u send it step by step with comments

Read only

Former Member
0 Likes
696

Hi Rajesh....

Here when exit is encountered the processing of that subroutine will stop there and the statements after the exit will not get executed........

the control comes to the next statement after perform.

Ex:

execute the following code then u will understand.

REPORT XYZ.

perform rajesh.

Write / 'Rajesh1' .

form rajesh.

Write / 'Rajesh2' .

exit.

Write / 'Rajesh3' .

endform.

This program will print the output as:

Rajesh2.

Rajesh1.

If u have any doubt, Reply .

Reward points if helpful.

Suresh...

Read only

0 Likes
696

its clear thanks a lots

Read only

Former Member
0 Likes
696

Hi,

Please check this sample codes regarding exit statement.


...

perform rajesh.

perform rajesh2.

...
form rajesh.
  
  if <condition> = <condition check>.
   exit.                  <--- Exit1
  else.
   <codes>.      
  endif.

  loop at <internal table>.
    if <condition> = <condition check>.
      exit.               <--- Exit2
    else.
      continue.
    endif.   
  endloop.
  
  <codes>.
  exit.                   <--- Exit3

endform.

Exit1:

The exit will exit from IF statement when the condition check is met. Then continue to perform loop statement.

Exit2:

The exit will exit from current loop when the condition check is met in IF statement. Then continue to perform next <codes>.

Exit3:

The exit will exit from form rajesh and continue to perform rajesh2.

Regards,

Ferry Lianto