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

Positioning of Include Statement in Program

Former Member
0 Likes
644

Hello everyone,

I have a simple ABAP code like the following:

REPORT  Z_TEST_INCLUDE                                              .

INCLUDE Z_TEST_INCLUDE_TOP.


INCLUDE TEST_INCLUDE.

PERFORM WRITE_TEST_NUMBER.

Here, the WRITE_TEST_NUMBER. subroutine is implemented in the INCLUDE TEST_INCLUDE. In this case when I perform a syntax check, I confront an error stating that the implementation of WRITE_TEST_NUMBER. cannot be found.

However, when I more the INCLUDE TEST_INCLUDE to the end of main program, like the following, everything will be fine, and I receive no error.

REPORT  Z_TEST_INCLUDE                                              .

INCLUDE Z_TEST_INCLUDE_TOP.


PERFORM WRITE_TEST_NUMBER.


INCLUDE TEST_INCLUDE.



Why is this the case?


Thanks,

Arman

1 ACCEPTED SOLUTION
Read only

former_member184158
Active Contributor
0 Likes
623

Hi,

it should not give you an error, you have to write START-OF-SELECTION event.


REPORT  Z_TEST_INCLUDE                                              .

INCLUDE Z_TEST_INCLUDE_TOP.


INCLUDE TEST_INCLUDE.



START-OF-SELECTION.

PERFORM WRITE_TEST_NUMBER.



so you have to write an event before perform or you have to write first

perform  and after that define a form without EVENT.

Regards

Ibrahim


4 REPLIES 4
Read only

Former Member
0 Likes
623

hi,

logically the form should be defined with perform prior to form routine.

reg,

SA.

Read only

former_member184158
Active Contributor
0 Likes
624

Hi,

it should not give you an error, you have to write START-OF-SELECTION event.


REPORT  Z_TEST_INCLUDE                                              .

INCLUDE Z_TEST_INCLUDE_TOP.


INCLUDE TEST_INCLUDE.



START-OF-SELECTION.

PERFORM WRITE_TEST_NUMBER.



so you have to write an event before perform or you have to write first

perform  and after that define a form without EVENT.

Regards

Ibrahim


Read only

Former Member
0 Likes
623

This message was moderated.

Read only

former_member185613
Contributor
0 Likes
623

Hi Arman,

I suppose it doesn't say 'Implementation can not be found'. It should be giving the error 'statement is not accessible'. In case there are no sub-routines defined in the program, implicit START-OF-SELECTION will be placed and the program works fine. If there are sub-routines being used, the program needs the event block to be explicitly placed.

Hope it helps,

~Athreya