Ansicht
Dokumentation

ABAPCLASS_DEFERRED - CLASS DEFERRED

ABAPCLASS_DEFERRED - CLASS DEFERRED

SUBST_MERGE_LIST - merge external lists to one complete list with #if... logic for R3up   SUBST_MERGE_LIST - merge external lists to one complete list with #if... logic for R3up  
This documentation is copyright by SAP AG.
SAP E-Book

CLASS, DEFERRED

Short Reference



CLASS class DEFINITION DEFERRED $[PUBLIC$].

Effect

This variant of the statement CLASS is used to make the class class known temporarily in the program, regardless of the location of the actual definition of the class in the program. It does not introduce a declaration part and must not be closed using ENDCLASS.

  • Without the addition PUBLIC, the statement makes a local class of its actual definition known before its actual definition. The program must contain a declaration part for class at a later point. It is not possible to access individual components before the actual definition. The statement is necessary if a reference to a local class is to be made before it is defined.
  • Using the addition PUBLIC, it makes a global class known and delays loading the class until the end of the current program unit. Individual components of the class can only be accessed after it has been loaded. This statement can be used to prevent unwanted recursions when referring to global classes.

Note

This variant of the statement CLASS can also only be listed in the context described under CLASS.

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.

Example

An example of using the addition DEFERRED PUBLIC would be a type pool in which a reference type is declared with 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 pool, since the types are not yet known. After the statement CLASS DEFINITION ... DEFERRED PUBLIC, however, the class name can be specified after REF TO without the class having been loaded previously.






BAL Application Log Documentation   BAL Application Log Documentation  
This documentation is copyright by SAP AG.

Length: 2382 Date: 20240426 Time: 205520     sap01-206 ( 55 ms )