REPORT ZZ_##_OBJECTS.
CLASS lcl_airplane DEFINITION.
PUBLIC SECTION.
METHODS: attribute_setzen IMPORTING
im_name TYPE string
im_planetype TYPE string,
attribut_lesen_name RETURNING
value(result) TYPE string,
attribut_lesen_planetype RETURNING
value(result) TYPE STRING,
attribute_anzeigen.
PRIVATE SECTION.
DATA: name TYPE string,
planetype TYPE string.
ENDCLASS.
CLASS lcl_airplane IMPLEMENTATION.
METHOD attribute_setzen.
name = im_name.
planetype = im_planetype.
ENDMETHOD.
METHOD attribut_lesen_name.
result = name.
ENDMETHOD.
METHOD attribut_lesen_planetype.
result = planetype.
ENDMETHOD.
METHOD attribute_anzeigen.
WRITE: / 'Name des Flugzeugs: ', name,
/ 'Typ des Flugzeugs: ', planetype.
ENDMETHOD.
ENDCLASS.
DATA: r_plane TYPE REF TO lcl_airplane,
it_plane_list TYPE TABLE OF REF TO lcl_airplane,
s_name TYPE string,
s_planetype TYPE string.
START-OF-SELECTION.
CREATE OBJECT r_plane.
r_plane->attribute_setzen( im_name = 'München'
im_planetype = 'Boeing 737' ).
APPEND r_plane TO it_plane_list.
CREATE OBJECT r_plane.
r_plane->attribute_setzen( im_name = 'Hamburg'
im_planetype = 'Airbus 380' ).
APPEND r_plane TO it_plane_list.
LOOP AT it_plane_list INTO r_plane.
s_name = r_plane->attribut_lesen_name( ).
s_planetype = r_plane->attribut_lesen_planetype( ).
write: / s_name, s_planetype.
skip.
r_plane->attribute_anzeigen( ).
skip.
ENDLOOP.