‎2010 Nov 15 9:42 AM
Hi All,
In the Class Builder (SE24)when i create a new Class, There is an option of Forward declaration in the Property Tab. In this, we can add Type Group Interface and Class. What is the Purpose of this forward declaration?
The F1 help does not provide any help.
Regards,
Kapil.
‎2010 Nov 15 10:59 AM
in addition to above replies, it can be used for classes and interfaces in that case Forward declaration is equivalent to
CLASS <class_name> DEFINITION LOAD.
interface <interface_name> load
statements which are normally used in Program ( case for local classes )
use of Load from SAP docu
... LOAD
Effect
The variant with the LOAD addition loads a global class class from the Class Library. This statement was needed before Release 6.20 if you wanted to access one of the static components of class from within a program, or to declare an event handler for class before class had been loaded automatically. From Release 6.20 onwards, the LOAD addition is only needed if the compilation of an ABAP program fails because it includes recursive accesses of a globa l class. In such cases, you may be able to make the program compilable by explicitly loading the class before recursion.
Thanks,
kranthi.
‎2010 Nov 15 9:59 AM
Hello,
"Forward Declaration" is a programming style & is not specific to OO-ABAP. (Source: [http://en.wikipedia.org/wiki/Forward_declaration]).
These definitions are added in the PUBLIC SECTION of the class as TYPE-POOLS, CLASS DEFINITION LOAD, INTERFACE DEFINITION LOAD etc.
BR,
Suhas
‎2010 Nov 15 10:09 AM
Hi Suhas,
This is the thing written in the F1 Help only. I want to make use of this or need a Use case where it is used exactly.
Regards,
Kapil.
‎2010 Nov 15 10:16 AM
Hello,
If you've a look at the class CL_ABAP_TYPEDESCR you'll have a idea how this helps.
In this class the type pool ABAP is defined in the "Forward Declaration" section & its' elements are used in defining the Attributes & Types of the class.
BTW why do you think you need to use the "Forward Declaration" feature?
BR,
Suhas
‎2010 Nov 15 10:19 AM
Hi
Here u can insert the type pools or class or interface where elements you need are defined.
For example if you need the type for ALV you need to insert the type pool SLIS, in this way you'll be able to define your variablea as a type defined in SLIS
Max
‎2010 Nov 15 10:59 AM
in addition to above replies, it can be used for classes and interfaces in that case Forward declaration is equivalent to
CLASS <class_name> DEFINITION LOAD.
interface <interface_name> load
statements which are normally used in Program ( case for local classes )
use of Load from SAP docu
... LOAD
Effect
The variant with the LOAD addition loads a global class class from the Class Library. This statement was needed before Release 6.20 if you wanted to access one of the static components of class from within a program, or to declare an event handler for class before class had been loaded automatically. From Release 6.20 onwards, the LOAD addition is only needed if the compilation of an ABAP program fails because it includes recursive accesses of a globa l class. In such cases, you may be able to make the program compilable by explicitly loading the class before recursion.
Thanks,
kranthi.