Skip to Content
0
May 28, 2018 at 08:17 AM

Placement of local classes with types-dependencies

79 Views

Hi folks

I have a problem with the sequence of the definitions of these 2 example-classes. They are local defined in a report.

That is the full code:

REPORT zcl_dependency_test.

CLASS b DEFINITION DEFERRED.
*CLASS b DEFINITION LOAD. "this row is obsolet and doesn't function.


CLASS a DEFINITION.

 PUBLIC SECTION.
 DATA: lo_a     TYPE REF TO b,
       lt_sofm  TYPE b=>tt_sofm.

 TYPES: tt_t001 TYPE STANDARD TABLE OF t001.

ENDCLASS.


CLASS b DEFINITION.

 PUBLIC SECTION.
 DATA: lo_b     TYPE REF TO a,
       lt_t001  TYPE a=>tt_t001.

 TYPES: tt_sofm TYPE STANDARD TABLE OF sofm.

ENDCLASS.





CLASS a IMPLEMENTATION.

ENDCLASS.

CLASS b IMPLEMENTATION.

ENDCLASS.

The code has an error in this row:

lt_sofm TYPE b=>tt_sofm.

If I switch the position of the definitions (first class b and the class a) and put an "CLASS a DEFINITION DEFERRED." at the beginning, than I get an error on this line:

lt_t001 TYPE a=>tt_t001.

Does anyone has an idea how to solve this dependency?