*&---------------------------------------------------------------------*
*& Report Z1807SAPBC401_AIRS_MAIN_B
*&
*&---------------------------------------------------------------------*
*&
*&Constructors
*&---------------------------------------------------------------------*
REPORT Z1807SAPBC401_AIRS_MAIN_B.
TYPE-POOLS ICON.
*------------------------------------------------------------------*
* CLASS lcl_airplane DEFINITION *
*------------------------------------------------------------------*
CLASS LCL_AIRPLANE DEFINITION.
PUBLIC SECTION.
"--------------------------------
CONSTANTS: POS_1 TYPE I VALUE 30.
METHODS: CONSTRUCTOR IMPORTING
IM_NAME TYPE STRING
IM_PLANETYPE TYPE SAPLANE-PLANETYPE,
DISPLAY_ATTRIBUTES.
CLASS-METHODS: DISPLAY_N_O_AIRPLANES.
PRIVATE SECTION.
"----------------------------------
DATA: NAME TYPE STRING,
PLANETYPE TYPE SAPLANE-PLANETYPE.
CLASS-DATA: N_O_AIRPLANES TYPE I.
ENDCLASS. "lcl_airplane DEFINITION
*------------------------------------------------------------------*
* CLASS lcl_airplane IMPLEMENTATION *
*------------------------------------------------------------------*
CLASS LCL_AIRPLANE IMPLEMENTATION.
METHOD CONSTRUCTOR.
NAME = IM_NAME.
PLANETYPE = IM_PLANETYPE.
N_O_AIRPLANES = N_O_AIRPLANES + 1.
ENDMETHOD. "constructor
METHOD DISPLAY_ATTRIBUTES.
WRITE: / ICON_WS_PLANE AS ICON,
/ 'NAME DES FLUGZEUGS:'(001),AT POS_1 NAME,
/ 'FLUGZEUGTYP'(002),AT POS_1 PLANETYPE.
ENDMETHOD. "display_attributes
METHOD DISPLAY_N_O_AIRPLANES.
WRITE:/ 'Gesamtzahl der Flugzeuge',
AT POS_1 N_O_AIRPLANES LEFT-JUSTIFIED.
ENDMETHOD. "display_n_o_airplanes
ENDCLASS. "lcl_airplane IMPLEMENTATION
DATA: R_PLANE TYPE REF TO LCL_AIRPLANE,
PLANE_LIST TYPE TABLE OF REF TO LCL_AIRPLANE.
START-OF-SELECTION.
*##############################
LCL_AIRPLANE=>DISPLAY_N_O_AIRPLANES( ).
CREATE OBJECT R_PLANE EXPORTING IM_NAME = 'LH BERLIN'
IM_PLANETYPE = 'A321'.
APPEND R_PLANE TO PLANE_LIST.
R_PLANE->DISPLAY_ATTRIBUTES( ).
CREATE OBJECT R_PLANE EXPORTING IM_NAME = 'AA NEW YORK'
IM_PLANETYPE = '747-400'.
APPEND R_PLANE TO PLANE_LIST.
R_PLANE->DISPLAY_ATTRIBUTES( ).
CREATE OBJECT R_PLANE EXPORTING IM_NAME = 'US HERCULES'
IM_PLANETYPE = '747-500'.
APPEND R_PLANE TO PLANE_LIST.
R_PLANE->DISPLAY_ATTRIBUTES( ).
LCL_AIRPLANE=>DISPLAY_N_O_AIRPLANES( ).