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: 

Form in the Include Program

Former Member
0 Kudos

Hi, everyone.

I have created an Include Program named Z_INCLUDE_TEST, it's code is:

DATA base TYPE i VALUE 100.

FORM add USING value(augend) TYPE i

value(addend) TYPE i

sum TYPE i.

sum = augend + addend + base.

ENDFORM. "ADD

And in other program, I want to call this form, my code is:

REPORT ztest_li.

INCLUDE Z_INCLUDE_TEST.

DATA: PRICE TYPE I VALUE 100,

TAX TYPE I VALUE 50,

SUM TYPE I.

PERFORM ADD USING PRICE TAX SUM.

WRITE / SUM.

But the compiler give me an error: Statement is not accessible. Can you explain this?

Thanks in advance!

Regards,

feng.

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi Feng,

I shall Explain that.

In ur program when execution starts, First Include Step is executed. Here the system checks for Start-Of-Selection in this include. But as this is an Include Program we shud explicitly state in our report program the 'Start-of-selection'.

U can try this also and this do not give error.

REPORT ZTest .

DATA: PRICE TYPE I VALUE 100,

TAX TYPE I VALUE 50,

SUM TYPE I.

PERFORM ADD USING PRICE TAX SUM.

WRITE / SUM.

INCLUDE Z_INCLUDE_TEST.

Now this doesnot give an error and executes fine because first the perform is identified by the system and this defaults to a report program's start-of-selection which further goes and process the Include and finds the form. Now as the report already gone thru the Start-of-selection so the staement can be accessed.

Awrd POints if useful

Bhupal

11 REPLIES 11

Former Member
0 Kudos

Hi,

Modify your code as below.

REPORT ztest_li.

DATA: PRICE TYPE I VALUE 100,

TAX TYPE I VALUE 50,

SUM TYPE I.

start-of-selection.

INCLUDE Z_INCLUDE_TEST.

PERFORM ADD USING PRICE TAX SUM.

WRITE / SUM.

Regards

Sailaja.

0 Kudos

Hi, Sailaja.

Thanks for your answer.I tried your method, but failed.

Regards,

feng.

Former Member
0 Kudos

Hi,

Have you tried to acticvate both the programs together. And can you tell the detailed error as which statement is not accessible(by looking at error message you will get this)

Regards,

Atish

0 Kudos

Thanks, Atish.

The error message is just that. Do you mean that my code is all right in syntax?

Regards,

feng.

Former Member
0 Kudos

Hi,

Please try calling the perform in the following way:

First Program which contains the FORM:

REPORT ztest0001 .

&----


*& Form test

&----


  • text

----


FORM test.

WRITE 'hi'.

ENDFORM. "test

Second Program from which the PERFORM is done:

REPORT ztest0002 .

DATA: rname(30) VALUE 'test'.

PERFORM test IN PROGRAM ztest0001.

Please try in the similar way.

Regards,

Michael.

0 Kudos

Thanks, Renjith Michael.

But I want to use INCLUDE.

Regards,

feng.

Former Member
0 Kudos

Hello Feng,

Here is the your solution.

REPORT znaga_test .

INCLUDE z_include_test.

DATA: price TYPE i VALUE 100,

tax TYPE i VALUE 50,

sum TYPE i.

START-OF-SELECTION.

PERFORM add USING price tax sum.

WRITE / sum.

Thanks,

Nagaraju.

0 Kudos

Thanks very much, Naga Raju.

Can you explain this? I'll give you full points.

Regards,

feng.

0 Kudos

I think with out START-OF-SELECTION we cant use subroutines --form... Endform.

Thanks,

Nagaraju.

0 Kudos

Thanks, Naga.

Can you tell me some links or some references?

Regards,

feng.

Former Member
0 Kudos

Hi Feng,

I shall Explain that.

In ur program when execution starts, First Include Step is executed. Here the system checks for Start-Of-Selection in this include. But as this is an Include Program we shud explicitly state in our report program the 'Start-of-selection'.

U can try this also and this do not give error.

REPORT ZTest .

DATA: PRICE TYPE I VALUE 100,

TAX TYPE I VALUE 50,

SUM TYPE I.

PERFORM ADD USING PRICE TAX SUM.

WRITE / SUM.

INCLUDE Z_INCLUDE_TEST.

Now this doesnot give an error and executes fine because first the perform is identified by the system and this defaults to a report program's start-of-selection which further goes and process the Include and finds the form. Now as the report already gone thru the Start-of-selection so the staement can be accessed.

Awrd POints if useful

Bhupal