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: 

Stop an Include Program

Former Member
0 Kudos

hello,

I have a main program in which i have two include programs. On a give condition i need to terminate first include and come back to the main program.

Can anyone tell me how to do this???

3 REPLIES 3

Former Member
0 Kudos

Hi,

An INCLUDE is not a logical unit of a program, it's just a way of structuring the code for navigation and reuse. You can't exit from an INCLUDE, to get out of an INCLUDE and back to the main program depends on what code is in the INCLUDE.

If the INCLUDE contains just one subroutine, say, then you can exit with, RETURN.

Regards,

Nick

jack_graus2
Active Contributor
0 Kudos

A trick could be embedding the includes by a loop statement, something like:

DO 1 TIMES.
  INCLUDE zinc1.
ENDDO.

DO 1 TIMES.
  INCLUDE zinc2.
ENDDO.

Then you can exit the include by the EXIT or CHECK statement. Somewhat 'dirty' but nevertheless also use by SAP sometimes.

regards Jack

Former Member
0 Kudos

Hi Ramakant,

INCLUDE programs are used to structure our code and are not called directly.

We usually use to to keep data declaration and subroutines seperately from main report.

In your case , there is no need to avoid any include. try to check the flow and the subroutine where this condition is required.

Hope this helps you.