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

difference between exit and leave program

Former Member
0 Likes
26,997

Hi,

what is the difference between exit and leave program.

I want to come to sap screen which one have to use.?

Thanks,

srii.

7 REPLIES 7
Read only

Former Member
0 Likes
8,209

Hi,

The EXIT command will stop the LOOP passings, exit from the SUBROUTINES..etc.

LEAVE PROGRAM.

Effect

Leaves the current program and continues processing after CALL TRANSACTION , CALL DIALOG or SUBMIT prog AND RETURN .

If you use LEAVE TO TRANSACTION , SUBMIT prog or start the program via the transaction menu or a transaction code, you branch to the transaction selection screen.

Note

LEAVE PROGRAM always leaves the current program - there is never any processing after LEAVE PROGRAM !

Read only

bpawanchand
Active Contributor
0 Likes
8,209

Hi

use EXIT statement to come on to the main SAP Screen if you want to come back to the program then use LEAVE PROGRAM

Regards

Pavan

Edited by: Pavan Bhamidipati on Jul 11, 2008 9:29 AM

Read only

Former Member
0 Likes
8,209

Hello sridhar ,

exit is a command used with to come out of the loops while leave program is used to leave the running program.

Check the following programs ;-

EXIT

http://help.sap.com/saphelp_nw2004s/helpdata/en/71/9f893f17493c17e10000000a114084/content.htm

LEAVE PROGRAM

http://help.sap.com/saphelp_nw70/helpdata/en/9f/dba50035c111d1829f0000e829fbfe/content.htm

Regards,

Bhumika

Read only

naveen_inuganti2
Active Contributor
0 Likes
8,209

Hi..,

EXIT:

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.

Outside of a loop, the EXIT statement leaves the current processing block. But better to use Exit inside the loop only!

LEAVE PROGRAM:

This statement immediately ends the current main program and deletes its internal session - including all loaded programs, instances, and their data .

The LEAVE PROGRAM statement can appear anywhere within any processing blocks. It ends the program regardless of the program/object or the program group of the internal session in which it is executed.

Thanks,

Naveen.I

Read only

Former Member
0 Likes
8,209

Hi,

EXIT is used to end the Further processing after The EXIT Statement if the condition does not meet.

The output before EXIT is then Displayed.

But LEAVE PROGRAM is used to Leave the defined program just after the the Statement.

Generally if to Coming Back to Calling Program after the Processing of Called Program it is used.Or After a Certain Statement if you want to Leave the program.

Follow the link-

http://help.sap.com/saphelp_nw2004s/helpdata/en/71/9f893f17493c17e10000000a114084/content.htm

http://www.sapbrainsonline.com/ARTICLES/TECHNICAL/ABAP/CALL%20ANOTHER%20PROGRAM%20FROM%20LIST.html

http://help.sap.com/saphelp_nw70/helpdata/en/9f/dba50035c111d1829f0000e829fbfe/content.htm

Regards,

Sujit

Read only

S0023931147
Participant
0 Likes
8,209

The EXIT command will stop the LOOP passings, exit from the SUBROUTINES..etc.

LEAVE PROGRAM.

Effect

Leaves the current program and continues processing after CALL TRANSACTION , CALL DIALOG or SUBMIT prog AND RETURN .

If you use LEAVE TO TRANSACTION , SUBMIT prog or start the program via the transaction menu or a transaction code, you branch to the transaction selection screen.

Note

LEAVE PROGRAM always leaves the current program - there is never any processing after LEAVE PROGRAM !

Read only

Former Member
0 Likes
8,209

Hi Sridhar,

EXIT is mainly used

In Events (to leave the event and to process further) .

In Loops (to exit from the current loop).

LEAVE PROGRAM.

Leaves the current program and continues processing after CALL TRANSACTION, CALL DIALOG or SUBMIT prog AND RETURN .

If you use LEAVE TO TRANSACTION, SUBMIT prog or start the program via the transaction menu or a transaction code, you branch to the transaction selection screen.

LEAVE PROGRAM always leaves the current program - there is never any processing after LEAVE PROGRAM!

Regards,

Swapna.