2008 Nov 25 11:04 PM
Hi All,
Can any let me know the difference between DEFERRED AND LOAD Addition.Coz i am bit confused while understanding the both..
I got enough links with me please dont send any links.
appreciate if any one can explain it in simple words.
Thanks
Hi All,
Can any let me know the difference between DEFERRED AND LOAD Addition.Coz i am bit confused while understanding the both..
I got enough links with me please dont send any links.
appreciate if any one can explain it in simple words.
Thanks
2008 Nov 26 1:29 AM
hi,
for the key words issue ,you can just turn to the help documents by just pressing F1.
ok,
for the first one, DEFERRED:
Effect
The variant with the DEFERRED addition makes a class known provisionally in the program.
Without the PUBLIC addition, this variant makes a local class known before its actual definition. The program must contain an actual declaration part for class at a later point in the program. You cannot access individual components of the class before it is actually defined. You need to use this statement if you want to make a reference to a local class before it is defined.
With the PUBLIC addition, this variant makes a global class known and defers loading the class until the end of the current program unit. You can only access individual components of the class after it has been loaded. This statement can be used to prevent unwanted recursion when making references to global classes.
and for the key word , 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.
Example
In this example, the class c1 uses the class c2 and vice versa. This means that one of the classes must be made known before it is actually defined. The global class cl_gui_cfw is also loaded before one of its static attributes is used.
CLASS c1 DEFINITION DEFERRED.
CLASS c2 DEFINITION.
PUBLIC SECTION.
DATA c1ref TYPE REF TO c1.
ENDCLASS.
CLASS c1 DEFINITION.
PUBLIC SECTION.
DATA c2ref TYPE REF TO c2.
ENDCLASS.
CLASS cl_gui_cfw DEFINITION LOAD.
DATA state LIKE cl_gui_cfw=>system_state.
An example of using the DEFERRED PUBLIC addition would be a type group in which a reference type is declared with a reference to a global class, which itself contains components with references to this reference type. In this situation, the entire class cannot be loaded before the type group, since the types are not yet known. However, after the CLASS DEFINITION ... DEFERRED PUBLIC statement, the class name can be specified after REF TO without the class having been loaded previously.
| User | Count |
|---|---|
| 6 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |