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

Include Activation Error

Former Member
0 Likes
1,779

Dear Experts,

I have a very small question.

I created a program which runs very much fine. But now I want that program to be changed as an include and use it in another program.

So, I created an include in the other program and copied the whole executable program into the include. (Deleting the report stmt.)

But for some reason it is giving me the error at the time of activation.

It says.

"Incorrect nesting Before the statement Form the structure introduced by the if must be concluded by endif."

There is no IF that is open before the form. I'm not sure why this error is coming.

The error line it is showing is just at the line of first Form (Form-Endform).

When I check for syntax it is just giving no errors. Except statement not accessible, because it is an include. so no worries here.

so can some one please guide me if there is some thing else I need to do before coping the code from executable to include.

Thanks

-Amit

8 REPLIES 8
Read only

Former Member
0 Likes
1,286

Try activating , your executable program and include together.

Read only

SuhaSaha
Product and Topic Expert
Product and Topic Expert
0 Likes
1,286

Hello Amit,

Just an idea. But did you have any EVENTS statements included in your program.

Logically thinking an INCLUDE program must not have any events. I think this may be the case.

Please check & rectify.

BR,

Suhas

Read only

matt
Active Contributor
0 Likes
1,286

Of course an include can have event statements. They can have any abap in. There's nothing to stop you, for example, putting all the code of your "AT SELECTION-SCREEN" event in an include, if you want to. Includes are just code fragments, nothing more.

To find out what the problem is when you have an outer program using an include, copy and paste the text of the include into your outer program at the point where you have the include statement (overwriting it of course).. A syntax check should reveal the nature of the problem.

If you want functionality to be reused, rather than an include it's far better to encapsulate it in a class. ( Or if you're not OO yet, then a function module ).

matt

Edited by: Matt on Jun 26, 2009 5:01 PM

Read only

SuhaSaha
Product and Topic Expert
Product and Topic Expert
0 Likes
1,286

Hello Matt,

You mean in an INCLUDE program we can have AT SELECTION-SCREEN, START-OF-SELECTION statements (for e.g.,).

This is a new info for me, 'coz i have never tried this )

BR,

Suhas

Read only

Former Member
0 Likes
1,286

Thanks Every one.

The problem is solved

Read only

Former Member
0 Likes
1,286

>

> You mean in an INCLUDE program we can have AT SELECTION-SCREEN, START-OF-SELECTION statements (for e.g.,).

If you have ever created a dynpro or function group, you'll see that all the logic (and events) are in includes.

Rob

Read only

SuhaSaha
Product and Topic Expert
Product and Topic Expert
0 Likes
1,286

>

> >

> > You mean in an INCLUDE program we can have AT SELECTION-SCREEN, START-OF-SELECTION statements (for e.g.,).

> If you have ever created a dynpro or function group, you'll see that all the logic (and events) are in includes.

>

> Rob

This is foolish of me. Thank God, weekend's coming 😛

Read only

matt
Active Contributor
0 Likes
1,286

>

> This is foolish of me. Thank God, weekend's coming :-P

We all learn...

I use includes only for organising code - not for modularisation or reuse. (There are some exceptions, but they're few and far between).

A lot of people misunderstand the use of includes. For example, if they see

IF condition.
  INCLUDE a.
ELSE.
  INCLUDE b.
ENDIF.

they think that include a is only included if the condition is met. But both includes are *always" included.

Think about the above if include a held

* Do some stuff
ENDIF.
IF some other condition.
* Do some more stuff

That would be syntactically perfectly valid. And extremely confusing...