‎2008 Aug 21 3:21 PM
Hi,
i build program in se80 and i want to include another program ,
i try e.g.
report ztest_1
include ztest_2
i have error :
Each ABAP program can contain only one "REPORT", "PROGRAM", or "FUNCTION-POOL". statement.
how i avoid that?
Regards
‎2008 Aug 21 3:23 PM
Hi
May be you ahve written any REPORT statement in INclude Ztest2 remove it and check it out or else post the INCLUDE code so that I can help you
Regards
Pavan
‎2008 Aug 21 3:23 PM
Hi
May be you ahve written any REPORT statement in INclude Ztest2 remove it and check it out or else post the INCLUDE code so that I can help you
Regards
Pavan
‎2008 Aug 21 3:28 PM
hi,
REPORT ztest_1.
*------------------------------------------------------------------*
* CLASS lcl_airplane DEFINITION *
*------------------------------------------------------------------*
CLASS lcl_airplane DEFINITION.
* Public section
PUBLIC SECTION.
TYPES: name_type(25) TYPE c.
CONSTANTS: pos_1 TYPE i VALUE 30.
METHODS: set_attributes IMPORTING
im_name TYPE name_type
im_planetype TYPE saplane-planetype,
display_attributes.
CLASS-METHODS: display_n_o_airplanes.
* Private section
PRIVATE SECTION.
DATA: name TYPE name_type,
planetype TYPE saplane-planetype.
CLASS-DATA: n_o_airplanes TYPE i.
ENDCLASS. "lcl_airplane DEFINITION
*------------------------------------------------------------------*
* CLASS lcl_airplane IMPLEMENTATION *
*------------------------------------------------------------------*
CLASS lcl_airplane IMPLEMENTATION.
* Method set_attributes
METHOD set_attributes.
name = im_name.
planetype = im_planetype.
n_o_airplanes = n_o_airplanes + 1.
ENDMETHOD. "set_attributes
* Method display_attributes
METHOD display_attributes.
WRITE: / 'Name of the airplane: '(001), AT pos_1 name,
/ 'Plane type: '(002), AT pos_1 planetype.
ENDMETHOD. "display_attributes
* Method display_n_o_airplanes
METHOD display_n_o_airplanes.
WRITE: /, / 'Total number of airplanes: '(ca1),
AT pos_1 n_o_airplanes LEFT-JUSTIFIED, /.
ENDMETHOD. "display_n_o_airplanes
ENDCLASS. "lcl_airplane IMPLEMENTATIONprogarm Ztest2:
REPORT ztest_2.
INCLUDE ztest_1.Regards
‎2008 Aug 21 3:30 PM
Include program ztest_1
now try this code..
*------------------------------------------------------------------*
* CLASS lcl_airplane DEFINITION *
*------------------------------------------------------------------*
CLASS lcl_airplane DEFINITION.
* Public section
PUBLIC SECTION.
TYPES: name_type(25) TYPE c.
CONSTANTS: pos_1 TYPE i VALUE 30.
METHODS: set_attributes IMPORTING
im_name TYPE name_type
im_planetype TYPE saplane-planetype,
display_attributes.
CLASS-METHODS: display_n_o_airplanes.
* Private section
PRIVATE SECTION.
DATA: name TYPE name_type,
planetype TYPE saplane-planetype.
CLASS-DATA: n_o_airplanes TYPE i.
ENDCLASS. "lcl_airplane DEFINITION
*------------------------------------------------------------------*
* CLASS lcl_airplane IMPLEMENTATION *
*------------------------------------------------------------------*
CLASS lcl_airplane IMPLEMENTATION.
* Method set_attributes
METHOD set_attributes.
name = im_name.
planetype = im_planetype.
n_o_airplanes = n_o_airplanes + 1.
ENDMETHOD. "set_attributes
* Method display_attributes
METHOD display_attributes.
WRITE: / 'Name of the airplane: '(001), AT pos_1 name,
/ 'Plane type: '(002), AT pos_1 planetype.
ENDMETHOD. "display_attributes
* Method display_n_o_airplanes
METHOD display_n_o_airplanes.
WRITE: /, / 'Total number of airplanes: '(ca1),
AT pos_1 n_o_airplanes LEFT-JUSTIFIED, /.
ENDMETHOD. "display_n_o_airplanes
ENDCLASS. "lcl_airplane IMPLEMENTATIONprogarm Ztest2:
REPORT ztest_2.
INCLUDE ztest_1.
‎2008 Aug 21 3:31 PM
ztest_1 program
should be of type Include program. you change the type of the program also. May be it is Executable now, Change it to Include program in the attributes screen.
‎2008 Aug 21 3:39 PM
ztest_1 should be of type include program so it should not contain any report statement.
* Include ztest_1
*------------------------------------------------------------------*
* CLASS lcl_airplane DEFINITION *
*------------------------------------------------------------------*
CLASS lcl_airplane DEFINITION.
* Public section
PUBLIC SECTION.
TYPES: name_type(25) TYPE c.
CONSTANTS: pos_1 TYPE i VALUE 30.
METHODS: set_attributes IMPORTING
im_name TYPE name_type
im_planetype TYPE saplane-planetype,
display_attributes.
CLASS-METHODS: display_n_o_airplanes.
* Private section
PRIVATE SECTION.
DATA: name TYPE name_type,
planetype TYPE saplane-planetype.
CLASS-DATA: n_o_airplanes TYPE i.
ENDCLASS. "lcl_airplane DEFINITION
*------------------------------------------------------------------*
* CLASS lcl_airplane IMPLEMENTATION *
*------------------------------------------------------------------*
CLASS lcl_airplane IMPLEMENTATION.
* Method set_attributes
METHOD set_attributes.
name = im_name.
planetype = im_planetype.
n_o_airplanes = n_o_airplanes + 1.
ENDMETHOD. "set_attributes
* Method display_attributes
METHOD display_attributes.
WRITE: / 'Name of the airplane: '(001), AT pos_1 name,
/ 'Plane type: '(002), AT pos_1 planetype.
ENDMETHOD. "display_attributes
* Method display_n_o_airplanes
METHOD display_n_o_airplanes.
WRITE: /, / 'Total number of airplanes: '(ca1),
AT pos_1 n_o_airplanes LEFT-JUSTIFIED, /.
ENDMETHOD. "display_n_o_airplanes
ENDCLASS. "lcl
Now include it in ur program
REPORT ztest_2.
INCLUDE ztest_1.
‎2008 Aug 21 6:34 PM
Hi Joyjit Ghosh ,
Thanks i try it ( to put include in Ztest_1 instead report) but i have Error:
Recursive INCLUDE nesting in program "Ztest_1". It contains an
INCLUDE statement which calls itself or a previously read program
("Ztest_1").
Regards
‎2008 Aug 21 9:58 PM
No need to put the include in the same include. Follow the same that I mentioned earlier...
ztest_1 should be of type include program so it should not contain any report statement.
Include ztest_1 << This is just a comment not any statement*
----
CLASS lcl_airplane DEFINITION *
----
CLASS lcl_airplane DEFINITION.
Public section
PUBLIC SECTION.
TYPES: name_type(25) TYPE c.
CONSTANTS: pos_1 TYPE i VALUE 30.
METHODS: set_attributes IMPORTING
im_name TYPE name_type
im_planetype TYPE saplane-planetype,
display_attributes.
CLASS-METHODS: display_n_o_airplanes.
Private section
PRIVATE SECTION.
DATA: name TYPE name_type,
planetype TYPE saplane-planetype.
CLASS-DATA: n_o_airplanes TYPE i.
ENDCLASS. "lcl_airplane DEFINITION
----
CLASS lcl_airplane IMPLEMENTATION *
----
CLASS lcl_airplane IMPLEMENTATION.
Method set_attributes
METHOD set_attributes.
name = im_name.
planetype = im_planetype.
n_o_airplanes = n_o_airplanes + 1.
ENDMETHOD. "set_attributes
Method display_attributes
METHOD display_attributes.
WRITE: / 'Name of the airplane: '(001), AT pos_1 name,
/ 'Plane type: '(002), AT pos_1 planetype.
ENDMETHOD. "display_attributes
Method display_n_o_airplanes
METHOD display_n_o_airplanes.
WRITE: /, / 'Total number of airplanes: '(ca1),
AT pos_1 n_o_airplanes LEFT-JUSTIFIED, /.
ENDMETHOD. "display_n_o_airplanes
ENDCLASS. "lcl
Now include it in ur program
REPORT ztest_2.
INCLUDE ztest_1.
‎2008 Aug 22 7:24 AM
Hi,
Thanks i try it but i have error :
REPORT/PROGRAM statement missing, or program type is INCLUDE.
Regards
‎2008 Aug 22 7:29 AM
Make the program ztest_1 type should be Include program.
From menu Go to ->Attributes then change the Program type to Include program and activate it and check now..
‎2008 Aug 21 3:25 PM
May be in ur inlcude program ztest_2, report or program statement is present..pl. remove it....and check the syntax.Hope it will solve ur problem.
‎2008 Aug 21 3:25 PM
> report ztest_1
> include ztest_2
if ztest_2 contains any REPORT STATEMENT then you get the same error.
‎2008 Aug 21 3:26 PM
hi,
In your include ztest_2. go to attribute and change your program type. make it include rather than executable. than only u can able to include this into your report ztest_1 .
hope this might help u.