<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: OOP's concept in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/oop-s-concept/m-p/2407118#M536623</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;&amp;#149;	Calling a ststic attribute using CALL METHOD &lt;/P&gt;&lt;P&gt;&amp;#149;	Registering a static event handler &lt;/P&gt;&lt;P&gt;&amp;#149;	Registering an evetm handler method for a static event&lt;/P&gt;&lt;P&gt;The static constructor cannot be called explicitly.&lt;/P&gt;&lt;P&gt;Protected components&lt;/P&gt;&lt;P&gt;When we are talking subclassing and enheritance there is one more component than Public and Private, the Protected component. Protected components can be used by the superclass and all of the subclasses. Note that Subclasses cannot access Private components.&lt;/P&gt;&lt;P&gt;Polymorphism&lt;/P&gt;&lt;P&gt;Polymorphism: When the same method is implemented differently in different classes. This can be done using enheritance, by redefining a method from the superclass in subclasses and implement it differently.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Template for making a class&lt;/P&gt;&lt;P&gt;Delete the parts that should not be used&lt;/P&gt;&lt;P&gt;******************************************&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Definition part&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;******************************************&lt;/P&gt;&lt;P&gt;CLASS xxx DEFINITION.&lt;/P&gt;&lt;P&gt;*----&lt;/P&gt;&lt;P&gt;-&lt;/P&gt;&lt;HR originaltext="------------------------" /&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Public section&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;*----&lt;/P&gt;&lt;P&gt;-&lt;/P&gt;&lt;HR originaltext="------------------------" /&gt;&lt;P&gt;  PUBLIC SECTION.&lt;/P&gt;&lt;P&gt;    TYPES:&lt;/P&gt;&lt;P&gt;    DATA: &lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;  Static data&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;    CLASS-DATA:&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;  Methods&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;    METHODS:&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;    Using the constructor to initialize parameters&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;       constructor    IMPORTING xxx type yyy,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;    Method with parameters&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;      mm1 IMPORTING iii   TYPE ttt.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;    Method without parameters&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;      mm2.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;  Static methods&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;    CLASS-METHODS:  &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*----&lt;/P&gt;&lt;HR originaltext="---------------------------------------------" /&gt;&lt;P&gt;*&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Protected section. Also accessable by subclasses&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;*----&lt;/P&gt;&lt;P&gt;-&lt;/P&gt;&lt;HR originaltext="---------------------------------------------" /&gt;&lt;P&gt;  PROTECTED SECTION.&lt;/P&gt;&lt;P&gt;*----&lt;/P&gt;&lt;P&gt;-&lt;/P&gt;&lt;HR originaltext="---------------------------------------------" /&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Private section. Not accessable by subclasses&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;*----&lt;/P&gt;&lt;P&gt;-&lt;/P&gt;&lt;HR originaltext="---------------------------------------------" /&gt;&lt;P&gt;  PRIVATE SECTION.&lt;/P&gt;&lt;P&gt;ENDCLASS.&lt;/P&gt;&lt;P&gt;******************************************&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Implementation part&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;******************************************&lt;/P&gt;&lt;P&gt;CLASS lcl_airplane IMPLEMENTATION.&lt;/P&gt;&lt;P&gt;  METHOD constructor.&lt;/P&gt;&lt;P&gt;  ENDMETHOD.&lt;/P&gt;&lt;P&gt;  METHOD mm1.&lt;/P&gt;&lt;P&gt;  ENDMETHOD.&lt;/P&gt;&lt;P&gt;  METHOD mm2.&lt;/P&gt;&lt;P&gt;  ENDMETHOD.&lt;/P&gt;&lt;P&gt;ENDCLASS.&lt;/P&gt;&lt;P&gt;Template for calling a class&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Create reference to class lcl_airplane&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;DATA: airplane1 TYPE REF TO lcl_airplane.&lt;/P&gt;&lt;P&gt;START-OF-SELECTION.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Create instance using parameters in the cosntructor method&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;  CREATE OBJECT airplane1 exporting im_name = 'Hansemand'&lt;/P&gt;&lt;P&gt;                                    im_planetype = 'Boing 747'.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt; Calling a method with parameters&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;  CALL METHOD: airplane1-&amp;gt;display_n_o_airplanes,&lt;/P&gt;&lt;P&gt;               airplane1-&amp;gt;display_attributes.&lt;/P&gt;&lt;P&gt;Subclass&lt;/P&gt;&lt;P&gt;CLASS xxx DEFINITION INHERITING FROM yyy.&lt;/P&gt;&lt;P&gt;Using af class as a parameter for a method&lt;/P&gt;&lt;P&gt;The class LCL_AIRPLANE is used as a parameter for method add_a_new_airplane:&lt;/P&gt;&lt;P&gt;METHODS:&lt;/P&gt;&lt;P&gt;  add_a_new_airplane importing im_airplane TYPE REF to lcl_airplane.&lt;/P&gt;&lt;P&gt;Interfaces&lt;/P&gt;&lt;P&gt;In ABAP interfaces are implemented in addition to, and independently of classes. An interface only has a declaration part, &lt;/P&gt;&lt;P&gt;and do not have visibility sections. Components (Attributes, methods, constants, types) can be defined the same way as in classes.&lt;/P&gt;&lt;P&gt;&amp;#149;                Interfaces are listed in the definition part lof the class, and must always be in the PUBLIC SECTION.&lt;/P&gt;&lt;P&gt;&amp;#149;                Operations defined in the interface atre impemented as methods of the class. All methods of the interface&lt;/P&gt;&lt;P&gt;must be present in the  implementation part of the class.&lt;/P&gt;&lt;P&gt;&amp;#149;                Attributes, events, constants and types defined in the interface are automatically available to the class &lt;/P&gt;&lt;P&gt;carrying out the implementation.&lt;/P&gt;&lt;P&gt;&amp;#149;                Interface components are addressed in the class by ]&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Define, implement and use simple class | Use constructor to create an object with parameters | Subclassing | Polymorphism | Events&lt;/P&gt;&lt;P&gt; Define, implement and use simple class&lt;/P&gt;&lt;P&gt;***INCLUDE ZBC404_HF_LCL_AIRPLANE .&lt;/P&gt;&lt;P&gt;******************************************&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Definition part&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;******************************************&lt;/P&gt;&lt;P&gt;CLASS lcl_airplane DEFINITION.&lt;/P&gt;&lt;P&gt;*----&lt;/P&gt;&lt;P&gt;-&lt;/P&gt;&lt;HR originaltext="------------------------" /&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Public section&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;*----&lt;/P&gt;&lt;P&gt;-&lt;/P&gt;&lt;HR originaltext="------------------------" /&gt;&lt;P&gt;  PUBLIC SECTION.&lt;/P&gt;&lt;P&gt;    TYPES: t_name(25) TYPE c.&lt;/P&gt;&lt;P&gt;    METHODS:&lt;/P&gt;&lt;P&gt;     constructor,&lt;/P&gt;&lt;P&gt;     set_attributes IMPORTING p_name       TYPE t_name&lt;/P&gt;&lt;P&gt;                              p_planetype  TYPE saplane-planetype,&lt;/P&gt;&lt;P&gt;      display_attributes,&lt;/P&gt;&lt;P&gt;      display_n_o_airplanes.&lt;/P&gt;&lt;P&gt;*----&lt;/P&gt;&lt;P&gt;-&lt;/P&gt;&lt;HR originaltext="------------------------" /&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Private section&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;*----&lt;/P&gt;&lt;P&gt;-&lt;/P&gt;&lt;HR originaltext="------------------------" /&gt;&lt;P&gt;  PRIVATE SECTION.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;  Private attributes&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;    DATA: name(25) TYPE c,&lt;/P&gt;&lt;P&gt;          planetype TYPE saplane-planetype.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;  Private static attribute&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;    CLASS-DATA n_o_airplanes TYPE i.&lt;/P&gt;&lt;P&gt;ENDCLASS.&lt;/P&gt;&lt;P&gt;******************************************&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Implementation part&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;******************************************&lt;/P&gt;&lt;P&gt;CLASS lcl_airplane IMPLEMENTATION.&lt;/P&gt;&lt;P&gt;  METHOD constructor.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;  Counts number of instances&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;    n_o_airplanes = n_o_airplanes + 1.&lt;/P&gt;&lt;P&gt;  ENDMETHOD.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;  METHOD set_attributes.&lt;/P&gt;&lt;P&gt;    name      = p_name.&lt;/P&gt;&lt;P&gt;    planetype = p_planetype.&lt;/P&gt;&lt;P&gt;  ENDMETHOD.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;  METHOD display_attributes.&lt;/P&gt;&lt;P&gt;    WRITE:/ 'Name:', name, 'Planetype:', planetype.&lt;/P&gt;&lt;P&gt;  ENDMETHOD.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;  METHOD display_n_o_airplanes.&lt;/P&gt;&lt;P&gt;    WRITE: / 'No. planes:', n_o_airplanes.&lt;/P&gt;&lt;P&gt;  ENDMETHOD.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;ENDCLASS.&lt;/P&gt;&lt;P&gt;REPORT zbc404_hf_maintain_airplanes .&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;INCLUDE zbc404_hf_lcl_airplane.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Create reference to class lcl_airplane&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;DATA: airplane1 TYPE REF TO lcl_airplane,&lt;/P&gt;&lt;P&gt;      airplane2 TYPE REF TO lcl_airplane.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;START-OF-SELECTION.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Create instance&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;  CREATE OBJECT airplane1.&lt;/P&gt;&lt;P&gt;  CALL METHOD: airplane1-&amp;gt;display_n_o_airplanes.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;  CREATE OBJECT airplane2.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Setting attributes using a method with parameters&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;  CALL METHOD airplane1-&amp;gt;set_attributes EXPORTING p_name      = 'Kurt'&lt;/P&gt;&lt;P&gt;                                                  p_planetype = 'MD80'.&lt;/P&gt;&lt;P&gt;END-OF-SELECTION.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Using methods &lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;  CALL METHOD: airplane1-&amp;gt;display_n_o_airplanes,&lt;/P&gt;&lt;P&gt;               airplane1-&amp;gt;display_attributes.  &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The resulting report:&lt;/P&gt;&lt;P&gt;Maintain airplanes                                     &lt;/P&gt;&lt;P&gt;No. planes:          1                                 &lt;/P&gt;&lt;P&gt;No. planes:          2                                 &lt;/P&gt;&lt;P&gt;Name: Kurt                      Planetype: MD80        &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Use constructor to create an object with parameters&lt;/P&gt;&lt;P&gt;CLASS lcl_airplane DEFINITION.&lt;/P&gt;&lt;P&gt;  PUBLIC SECTION.&lt;/P&gt;&lt;P&gt;    TYPES: t_name(25) TYPE c.&lt;/P&gt;&lt;P&gt;METHODS:&lt;/P&gt;&lt;P&gt;      constructor    importing p2_name      type t_name&lt;/P&gt;&lt;P&gt;                               p2_planetype  TYPE saplane-planetype,&lt;/P&gt;&lt;P&gt;..... more code .......&lt;/P&gt;&lt;P&gt;CLASS lcl_airplane IMPLEMENTATION.&lt;/P&gt;&lt;P&gt;  METHOD constructor.&lt;/P&gt;&lt;P&gt;    name      = p2_name.&lt;/P&gt;&lt;P&gt;    planetype = p2_planetype.&lt;/P&gt;&lt;P&gt;..... more code .......&lt;/P&gt;&lt;P&gt;START-OF-SELECTION.&lt;/P&gt;&lt;P&gt;  CREATE OBJECT airplane1 exporting p2_name = 'Hansemand'&lt;/P&gt;&lt;P&gt;                                    p2_planetype = 'Boing 747'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Subclassing&lt;/P&gt;&lt;P&gt;This example uses a superclass LCL_AIRPLANE and subclasses it into LCL_PASSENGER_AIRPLANE and LCL_CARGO_PLANE.&lt;/P&gt;&lt;P&gt;LCL_AIRPLANE has a method display_n_o_airplanes that displays the number of object instances.&lt;/P&gt;&lt;P&gt;LCL_PASSENGER_AIRPLANE has the private instance attribute n_o_seats, and redefines the superclass method display_attributes, &lt;/P&gt;&lt;P&gt;so it also displays n_o_seats.&lt;/P&gt;&lt;P&gt;LCL_CARGO_PLANE has the private instance attribute cargomax, and redefines the superclass method&lt;/P&gt;&lt;P&gt; display_attributes, so it also displays cargomax.&lt;/P&gt;&lt;P&gt;All instance attributes are provided by the cunstructor method.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Superclass LCL_AIRPLANE&lt;/P&gt;&lt;P&gt;***INCLUDE ZBC404_HF_LCL_AIRPLANE .&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;******************************************&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Definition part&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;******************************************&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CLASS lcl_airplane DEFINITION.&lt;/P&gt;&lt;P&gt;*----&lt;/P&gt;&lt;P&gt;-&lt;/P&gt;&lt;HR originaltext="------------------------" /&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Public section&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;*----&lt;/P&gt;&lt;P&gt;-&lt;/P&gt;&lt;HR originaltext="------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  PUBLIC SECTION.&lt;/P&gt;&lt;P&gt;    TYPES: t_name(25) TYPE c.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    METHODS:&lt;/P&gt;&lt;P&gt;      constructor    IMPORTING im_name      TYPE t_name&lt;/P&gt;&lt;P&gt;                               im_planetype  TYPE saplane-planetype,&lt;/P&gt;&lt;P&gt;      display_attributes.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;  Static methods&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;    CLASS-METHODS:&lt;/P&gt;&lt;P&gt;      display_n_o_airplanes.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;*----&lt;/P&gt;&lt;P&gt;-&lt;/P&gt;&lt;HR originaltext="------------------------" /&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Protected section&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;*----&lt;/P&gt;&lt;P&gt;-&lt;/P&gt;&lt;HR originaltext="------------------------" /&gt;&lt;P&gt;  PROTECTED SECTION.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;  Private attributes&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;    DATA: name(25) TYPE c,&lt;/P&gt;&lt;P&gt;          planetype TYPE saplane-planetype.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;  Private static attribute&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;    CLASS-DATA n_o_airplanes TYPE i.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ENDCLASS.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;******************************************&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Implementation part&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;******************************************&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CLASS lcl_airplane IMPLEMENTATION.&lt;/P&gt;&lt;P&gt;  METHOD constructor.&lt;/P&gt;&lt;P&gt;    name      = im_name.&lt;/P&gt;&lt;P&gt;    planetype = im_planetype.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;  Counts number of instances&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;    n_o_airplanes = n_o_airplanes + 1.&lt;/P&gt;&lt;P&gt;  ENDMETHOD.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;  METHOD display_attributes.&lt;/P&gt;&lt;P&gt;    WRITE:/ 'Name:', name, 'Planetype:', planetype.&lt;/P&gt;&lt;P&gt;  ENDMETHOD.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;  METHOD display_n_o_airplanes.&lt;/P&gt;&lt;P&gt;    WRITE: / 'No. planes:', n_o_airplanes.&lt;/P&gt;&lt;P&gt;  ENDMETHOD.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;ENDCLASS.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Sub class LCL_PASSENGER_AIRPLANE&lt;/P&gt;&lt;P&gt;***INCLUDE ZBC404_HF_LCL_PASSENGER_PLANE .&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;*******************************************************************&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;This is a subclass of class lcl_airplane&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;*******************************************************************&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CLASS lcl_passenger_airplane DEFINITION INHERITING FROM lcl_airplane.&lt;/P&gt;&lt;P&gt;  PUBLIC SECTION.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;  The constructor contains the parameters from the superclass&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;  plus the parameters from the subclass&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    METHODS:&lt;/P&gt;&lt;P&gt;      constructor IMPORTING im_name      TYPE t_name&lt;/P&gt;&lt;P&gt;                            im_planetype TYPE saplane-planetype&lt;/P&gt;&lt;P&gt;                            im_n_o_seats TYPE sflight-seatsmax,&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;    Redefinition of superclass method display_attributes&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;      display_attributes REDEFINITION.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  PRIVATE SECTION.&lt;/P&gt;&lt;P&gt;    DATA: n_o_seats TYPE sflight-seatsmax.&lt;/P&gt;&lt;P&gt;ENDCLASS.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;CLASS lcl_passenger_airplane IMPLEMENTATION.&lt;/P&gt;&lt;P&gt;  METHOD constructor.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;  The constructor method of the superclass MUST be called withing the&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;  construtor&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;    CALL METHOD super-&amp;gt;constructor&lt;/P&gt;&lt;P&gt;                          EXPORTING im_name      = im_name&lt;/P&gt;&lt;P&gt;                                    im_planetype = im_planetype.&lt;/P&gt;&lt;P&gt;    n_o_seats = im_n_o_seats.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  ENDMETHOD.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;  The redefined  display_attributes method&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;  METHOD display_attributes.&lt;/P&gt;&lt;P&gt;    CALL METHOD super-&amp;gt;display_attributes.&lt;/P&gt;&lt;P&gt;    WRITE: / 'No. seats:', n_o_seats.&lt;/P&gt;&lt;P&gt;  ENDMETHOD.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ENDCLASS.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Sub class LCL_CARGO_PLANE&lt;/P&gt;&lt;P&gt;***INCLUDE ZBC404_HF_LCL_CARGO_PLANE .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*******************************************************************&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;This is a subclass of class lcl_airplane&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;*******************************************************************&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CLASS lcl_cargo_plane DEFINITION INHERITING FROM lcl_airplane.&lt;/P&gt;&lt;P&gt;  PUBLIC SECTION.&lt;/P&gt;&lt;P&gt;    METHODS:&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;    The constructor contains the parameters from the superclass&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;    plus the parameters from the subclass&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;      constructor IMPORTING im_name      TYPE t_name&lt;/P&gt;&lt;P&gt;                            im_planetype TYPE saplane-planetype&lt;/P&gt;&lt;P&gt;                            im_cargomax  type scplane-cargomax,&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;    Redefinition of superclass method display_attributes&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;      display_attributes REDEFINITION.&lt;/P&gt;&lt;P&gt;  PRIVATE SECTION.&lt;/P&gt;&lt;P&gt;    DATA:cargomax TYPE scplane-cargomax.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ENDCLASS.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CLASS lcl_cargo_plane IMPLEMENTATION.&lt;/P&gt;&lt;P&gt;  METHOD constructor.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;  The constructor method of the superclass MUST be called withing the&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;  constructor&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;    CALL METHOD super-&amp;gt;constructor&lt;/P&gt;&lt;P&gt;                          EXPORTING im_name      = im_name&lt;/P&gt;&lt;P&gt;                                    im_planetype = im_planetype.&lt;/P&gt;&lt;P&gt;    cargomax = im_cargomax.&lt;/P&gt;&lt;P&gt;  ENDMETHOD.&lt;/P&gt;&lt;P&gt;  METHOD display_attributes.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;  The redefined  display_attributes method&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;    CALL METHOD super-&amp;gt;display_attributes.&lt;/P&gt;&lt;P&gt;    WRITE: / 'Cargo max:', cargomax.&lt;/P&gt;&lt;P&gt;  ENDMETHOD.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ENDCLASS.&lt;/P&gt;&lt;P&gt;The Main program that uses the classes&lt;/P&gt;&lt;P&gt;REPORT zbc404_hf_main .&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Super class&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;INCLUDE zbc404_hf_lcl_airplane.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Sub classes&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;INCLUDE zbc404_hf_lcl_passenger_plane.&lt;/P&gt;&lt;P&gt;INCLUDE zbc404_hf_lcl_cargo_plane.&lt;/P&gt;&lt;P&gt;DATA:&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Type ref to sub classes. Note: It is not necesssary to make typeref to the superclass&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;  o_passenger_airplane TYPE REF TO lcl_passenger_airplane,&lt;/P&gt;&lt;P&gt;  o_cargo_plane        TYPE REF TO lcl_cargo_plane.&lt;/P&gt;&lt;P&gt;START-OF-SELECTION.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Display initial number of instances = 0&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  CALL METHOD  lcl_airplane=&amp;gt;display_n_o_airplanes.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Create objects&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;  CREATE OBJECT o_passenger_airplane&lt;/P&gt;&lt;P&gt;    EXPORTING&lt;/P&gt;&lt;P&gt;      im_name      = 'LH505'&lt;/P&gt;&lt;P&gt;      im_planetype = 'Boing 747'&lt;/P&gt;&lt;P&gt;      im_n_o_seats = 350.&lt;/P&gt;&lt;P&gt;  CREATE OBJECT o_cargo_plane&lt;/P&gt;&lt;P&gt;    EXPORTING&lt;/P&gt;&lt;P&gt;      im_name      = 'AR13'&lt;/P&gt;&lt;P&gt;      im_planetype = 'DC 3'&lt;/P&gt;&lt;P&gt;      im_cargomax = 35.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Display attributes&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;  CALL METHOD o_passenger_airplane-&amp;gt;display_attributes.&lt;/P&gt;&lt;P&gt;  CALL METHOD o_cargo_plane-&amp;gt;display_attributes.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Call static method display_n_o_airplanes&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Note: The syntax for calling a superclass method, differs from the syntax when calling a &lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;subclass method.&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;When calling a superclass =&amp;gt; must be used instead of -&amp;gt;&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  CALL METHOD  lcl_airplane=&amp;gt;display_n_o_airplanes.&lt;/P&gt;&lt;P&gt;Result:&lt;/P&gt;&lt;P&gt;No. planes: 0&lt;/P&gt;&lt;P&gt;Name: LH505 Planetype: Boing 747&lt;/P&gt;&lt;P&gt;No. seats: 350&lt;/P&gt;&lt;P&gt;Name: AR13 Planetype: DC 3&lt;/P&gt;&lt;P&gt;Cargo max: 35,0000&lt;/P&gt;&lt;P&gt;No. planes: 2&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Polymorphism&lt;/P&gt;&lt;P&gt;Polymorphism: When the same method is implemented differently in different classes. This can be done u&lt;/P&gt;&lt;P&gt;sing enheritance, by redefining a method from the superclass in subclasses and implement it differently.&lt;/P&gt;&lt;P&gt;Classes:&lt;/P&gt;&lt;P&gt;&amp;#149;	lcl_airplane Superclass &lt;/P&gt;&lt;P&gt;&amp;#149;	lcl_cargo_airplane Subclass &lt;/P&gt;&lt;P&gt;&amp;#149;	lcl_passenger_airplane Subclass&lt;/P&gt;&lt;P&gt;The method estimate_fuel_consumption is implemented differently in the 3 classes, as it depends on the airplane type.&lt;/P&gt;&lt;P&gt;Object from different classes are stored in an internal table (plane_list) consisting of references to the &lt;/P&gt;&lt;P&gt;superclass, and the processed &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;identically for all the classes. &lt;/P&gt;&lt;P&gt;What coding for the estimate_fuel_consumption method taht is actually executed, depends on the dynamic &lt;/P&gt;&lt;P&gt;type of the plane reference variable,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; that is, depends on which object plane points to.&lt;/P&gt;&lt;P&gt;DATA: cargo_plane            TYPE REF to lcl_cargo_airplane,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;          passenger_plane    TYPE REF to lcl_passenger_airplane,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;          plane_list                  TYPE TABLE OF REF TO lcl_airplane.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Creating the list of references&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CREATE OBJECT cargo_plane.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;APPEND cargo_plane to plane_list.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CREATE OBJECT passenger_plane&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;APPEND passenger_plane to plane list.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Generic method for calucalting required fuel&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;METHOD calculate required_fuel.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  DATA: plane TYPE REF TO lcl_airplane.&lt;/P&gt;&lt;P&gt;  LOOP AT plane_list INTO plane.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    re_fuel = re_fuel + plane-&amp;gt;estimate_fuel_consumption( distance ).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  ENDLOOP.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ENDMETHOD.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Working example:&lt;/P&gt;&lt;P&gt;This example assumes that the classes lcl_airplane,  lcl_passnger_airplane and lcl_cargo plane exists.&lt;/P&gt;&lt;P&gt;Create objects of type lcl_cargo_plane and lcl_passenger_airplane, adds them to a list in lcl_carrier, &lt;/P&gt;&lt;P&gt;and displays the list.  &lt;/P&gt;&lt;P&gt;*&amp;amp;----&lt;/P&gt;&lt;HR originaltext="---------------------------------------------------------------" /&gt;&lt;P&gt;*&lt;/P&gt;&lt;P&gt;*&amp;amp; Include  ZBC404_HF_LCL_CARRIER                                      *&lt;/P&gt;&lt;P&gt;*&amp;amp;----&lt;/P&gt;&lt;HR originaltext="---------------------------------------------------------------" /&gt;&lt;P&gt;*&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;      CLASS lcl_carrier DEFINITION                                   *&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;*----&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;*&lt;/P&gt;&lt;P&gt;CLASS lcl_carrier DEFINITION.&lt;/P&gt;&lt;P&gt;  PUBLIC SECTION.&lt;/P&gt;&lt;P&gt;    TYPES: BEGIN OF flight_list_type,&lt;/P&gt;&lt;P&gt;              connid   TYPE sflight-connid,&lt;/P&gt;&lt;P&gt;              fldate   TYPE sflight-fldate,&lt;/P&gt;&lt;P&gt;              airplane TYPE REF TO lcl_airplane,&lt;/P&gt;&lt;P&gt;              seatsocc TYPE sflight-seatsocc,&lt;/P&gt;&lt;P&gt;              cargo(5) TYPE p DECIMALS 3,&lt;/P&gt;&lt;P&gt;           END OF flight_list_type.&lt;/P&gt;&lt;P&gt;    METHODS: constructor IMPORTING im_name TYPE string,&lt;/P&gt;&lt;P&gt;             get_name RETURNING value(ex_name) TYPE string,&lt;/P&gt;&lt;P&gt;             add_a_new_airplane IMPORTING&lt;/P&gt;&lt;P&gt;                                   im_airplane TYPE REF TO lcl_airplane,&lt;/P&gt;&lt;P&gt;    create_a_new_flight importing&lt;/P&gt;&lt;P&gt;                          im_connid   type sflight-connid&lt;/P&gt;&lt;P&gt;                          im_fldate   type sflight-fldate&lt;/P&gt;&lt;P&gt;                          im_airplane type ref to lcl_airplane&lt;/P&gt;&lt;P&gt;                          im_seatsocc type sflight-seatsocc&lt;/P&gt;&lt;P&gt;                                    optional&lt;/P&gt;&lt;P&gt;                        im_cargo    type p optional,&lt;/P&gt;&lt;P&gt;     display_airplanes.&lt;/P&gt;&lt;P&gt;  PRIVATE SECTION.&lt;/P&gt;&lt;P&gt;    DATA: name              TYPE string,&lt;/P&gt;&lt;P&gt;          list_of_airplanes TYPE TABLE OF REF TO lcl_airplane,&lt;/P&gt;&lt;P&gt;          list_of_flights   TYPE TABLE OF flight_list_type.&lt;/P&gt;&lt;P&gt;ENDCLASS.&lt;/P&gt;&lt;P&gt;*----&lt;/P&gt;&lt;HR originaltext="---------------------------------------------------------------" /&gt;&lt;P&gt;*&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;      CLASS lcl_carrier IMPLEMENTATION&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;*----&lt;/P&gt;&lt;HR originaltext="---------------------------------------------------------------" /&gt;&lt;P&gt;*&lt;/P&gt;&lt;P&gt;CLASS lcl_carrier IMPLEMENTATION.&lt;/P&gt;&lt;P&gt;  METHOD constructor.&lt;/P&gt;&lt;P&gt;    name = im_name.&lt;/P&gt;&lt;P&gt;  ENDMETHOD.&lt;/P&gt;&lt;P&gt;  METHOD get_name.&lt;/P&gt;&lt;P&gt;    ex_name = name.&lt;/P&gt;&lt;P&gt;  ENDMETHOD.&lt;/P&gt;&lt;P&gt;  METHOD create_a_new_flight.&lt;/P&gt;&lt;P&gt;    DATA: wa_list_of_flights TYPE flight_list_type.&lt;/P&gt;&lt;P&gt;    wa_list_of_flights-connid   = im_connid.&lt;/P&gt;&lt;P&gt;    wa_list_of_flights-fldate   = im_fldate.&lt;/P&gt;&lt;P&gt;    wa_list_of_flights-airplane = im_airplane.&lt;/P&gt;&lt;P&gt;    IF im_seatsocc IS INITIAL.&lt;/P&gt;&lt;P&gt;      wa_list_of_flights-cargo = im_cargo.&lt;/P&gt;&lt;P&gt;    ELSE.&lt;/P&gt;&lt;P&gt;      wa_list_of_flights-seatsocc = im_seatsocc.&lt;/P&gt;&lt;P&gt;    ENDIF.&lt;/P&gt;&lt;P&gt;    APPEND wa_list_of_flights TO list_of_flights.&lt;/P&gt;&lt;P&gt;  ENDMETHOD.&lt;/P&gt;&lt;P&gt;  METHOD add_a_new_airplane.&lt;/P&gt;&lt;P&gt;    APPEND im_airplane TO list_of_airplanes.&lt;/P&gt;&lt;P&gt;  ENDMETHOD.&lt;/P&gt;&lt;P&gt;  METHOD display_airplanes.&lt;/P&gt;&lt;P&gt;    DATA: l_airplane TYPE REF TO lcl_airplane.&lt;/P&gt;&lt;P&gt;    LOOP AT list_of_airplanes INTO l_airplane.&lt;/P&gt;&lt;P&gt;      CALL METHOD l_airplane-&amp;gt;display_attributes.&lt;/P&gt;&lt;P&gt;    ENDLOOP.&lt;/P&gt;&lt;P&gt;  ENDMETHOD.&lt;/P&gt;&lt;P&gt;ENDCLASS.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;REPORT zbc404_hf_main .&lt;/P&gt;&lt;P&gt;*******************************************************************&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt; This reprort uses class LCL_AIRPLNAE and subclasses&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt; LCL_CARGO_PLANE and LCL_PASSENGER_AIRPLANE and class LCL_CARRIER&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*******************************************************************&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Super class for airplanes&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;INCLUDE zbc404_hf_lcl_airplane.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Sub classes for airplanes&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;INCLUDE zbc404_hf_lcl_passenger_plane.&lt;/P&gt;&lt;P&gt;INCLUDE zbc404_hf_lcl_cargo_plane.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Carrier class&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;INCLUDE zbc404_hf_lcl_carrier.&lt;/P&gt;&lt;P&gt;DATA:&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Type ref to classes&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;  o_passenger_airplane  TYPE REF TO lcl_passenger_airplane,&lt;/P&gt;&lt;P&gt;  o_passenger_airplane2 TYPE REF TO lcl_passenger_airplane,&lt;/P&gt;&lt;P&gt;  o_cargo_plane         TYPE REF TO lcl_cargo_plane,&lt;/P&gt;&lt;P&gt;  o_cargo_plane2        TYPE REF TO lcl_cargo_plane,&lt;/P&gt;&lt;P&gt;  o_carrier             TYPE REF TO lcl_carrier.&lt;/P&gt;&lt;P&gt;START-OF-SELECTION.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Create objects&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;  CREATE OBJECT o_passenger_airplane&lt;/P&gt;&lt;P&gt;    EXPORTING&lt;/P&gt;&lt;P&gt;      im_name      = 'LH505'&lt;/P&gt;&lt;P&gt;      im_planetype = 'Boing 747'&lt;/P&gt;&lt;P&gt;      im_n_o_seats = 350.&lt;/P&gt;&lt;P&gt;  CREATE OBJECT o_passenger_airplane2&lt;/P&gt;&lt;P&gt;    EXPORTING&lt;/P&gt;&lt;P&gt;      im_name      = 'SK333'&lt;/P&gt;&lt;P&gt;      im_planetype = 'MD80'&lt;/P&gt;&lt;P&gt;      im_n_o_seats = 110.&lt;/P&gt;&lt;P&gt;  CREATE OBJECT o_cargo_plane&lt;/P&gt;&lt;P&gt;    EXPORTING&lt;/P&gt;&lt;P&gt;      im_name      = 'AR13'&lt;/P&gt;&lt;P&gt;      im_planetype = 'DC 3'&lt;/P&gt;&lt;P&gt;      im_cargomax = 35.&lt;/P&gt;&lt;P&gt;  CREATE OBJECT o_cargo_plane2&lt;/P&gt;&lt;P&gt;    EXPORTING&lt;/P&gt;&lt;P&gt;      im_name      = 'AFL124'&lt;/P&gt;&lt;P&gt;      im_planetype = 'Iljutsin 2'&lt;/P&gt;&lt;P&gt;      im_cargomax = 35000.&lt;/P&gt;&lt;P&gt;  CREATE OBJECT o_carrier&lt;/P&gt;&lt;P&gt;    EXPORTING im_name = 'Spritisch Airways'.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Add passenger and cargo planes to the list of airplanes&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;  CALL METHOD o_carrier-&amp;gt;add_a_new_airplane&lt;/P&gt;&lt;P&gt;     EXPORTING im_airplane = o_passenger_airplane.&lt;/P&gt;&lt;P&gt;  CALL METHOD o_carrier-&amp;gt;add_a_new_airplane&lt;/P&gt;&lt;P&gt;     EXPORTING im_airplane = o_passenger_airplane2.&lt;/P&gt;&lt;P&gt;  CALL METHOD o_carrier-&amp;gt;add_a_new_airplane&lt;/P&gt;&lt;P&gt;     EXPORTING im_airplane = o_cargo_plane.&lt;/P&gt;&lt;P&gt;  CALL METHOD o_carrier-&amp;gt;add_a_new_airplane&lt;/P&gt;&lt;P&gt;     EXPORTING im_airplane = o_cargo_plane2.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Display list of airplanes&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  call method o_carrier-&amp;gt;display_airplanes.&lt;/P&gt;&lt;P&gt;Result:&lt;/P&gt;&lt;P&gt;Name: LH505                     Planetype: Boing 747         &lt;/P&gt;&lt;P&gt;No. seats:       350                                         &lt;/P&gt;&lt;P&gt;Name: SK333                     Planetype: MD80              &lt;/P&gt;&lt;P&gt;No. seats:       110                                         &lt;/P&gt;&lt;P&gt;Name: AR13                      Planetype: DC 3              &lt;/P&gt;&lt;P&gt;Cargo max:             35,0000                               &lt;/P&gt;&lt;P&gt;Name: AFL124                    Planetype: Iljutsin 2        &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Cargo max:         35.000,0000                               &lt;/P&gt;&lt;P&gt;Events&lt;/P&gt;&lt;P&gt;Below is a simple example of how to implement an event.&lt;/P&gt;&lt;P&gt;REPORT zbc404_hf_events_5.&lt;/P&gt;&lt;P&gt;*----&lt;/P&gt;&lt;HR originaltext="---------------------------------------------------------------" /&gt;&lt;P&gt;*&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;      CLASS lcl_dog DEFINITION&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;*----&lt;/P&gt;&lt;HR originaltext="---------------------------------------------------------------" /&gt;&lt;P&gt;*&lt;/P&gt;&lt;P&gt;CLASS lcl_dog DEFINITION.&lt;/P&gt;&lt;P&gt;  PUBLIC SECTION.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;  Declare events&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;    EVENTS:&lt;/P&gt;&lt;P&gt;      dog_is_hungry&lt;/P&gt;&lt;P&gt;        EXPORTING value(ex_time_since_last_meal) TYPE i.&lt;/P&gt;&lt;P&gt;    METHODS:&lt;/P&gt;&lt;P&gt;      constructor&lt;/P&gt;&lt;P&gt;          IMPORTING im_name TYPE string,&lt;/P&gt;&lt;P&gt;      set_time_since_last_meal&lt;/P&gt;&lt;P&gt;          IMPORTING im_time TYPE i,&lt;/P&gt;&lt;P&gt;      on_dog_is_hungry FOR EVENT dog_is_hungry OF lcl_dog&lt;/P&gt;&lt;P&gt;          IMPORTING ex_time_since_last_meal.&lt;/P&gt;&lt;P&gt;ENDCLASS.&lt;/P&gt;&lt;P&gt;*----&lt;/P&gt;&lt;HR originaltext="---------------------------------------------------------------" /&gt;&lt;P&gt;*&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;      CLASS lcl_dog IMPLEMENTATION&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;*----&lt;/P&gt;&lt;HR originaltext="---------------------------------------------------------------" /&gt;&lt;P&gt;*&lt;/P&gt;&lt;P&gt;CLASS lcl_dog IMPLEMENTATION.&lt;/P&gt;&lt;P&gt;  METHOD constructor.&lt;/P&gt;&lt;P&gt;    WRITE: / 'I am a dog and my name is', im_name.&lt;/P&gt;&lt;P&gt;  ENDMETHOD.&lt;/P&gt;&lt;P&gt;  METHOD set_time_since_last_meal.&lt;/P&gt;&lt;P&gt;    IF im_time &amp;lt; 4.&lt;/P&gt;&lt;P&gt;      SKIP 1.&lt;/P&gt;&lt;P&gt;      WRITE: / 'You fool, I am not hungry yet'.&lt;/P&gt;&lt;P&gt;    ELSE.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;   Subsrcribe for event:&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;   set handler &amp;lt;Event handler method&amp;gt;&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;   FOR &amp;lt;ref_sender&amp;gt;!FOR ALL INSTANCES [ACTIVATION &amp;lt;var&amp;gt;]&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;      SET HANDLER on_dog_is_hungry FOR ALL INSTANCES ACTIVATION 'X'.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;   Raise event&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;      RAISE EVENT dog_is_hungry&lt;/P&gt;&lt;P&gt;        EXPORTING ex_time_since_last_meal = im_time.&lt;/P&gt;&lt;P&gt;    ENDIF.&lt;/P&gt;&lt;P&gt;  ENDMETHOD.&lt;/P&gt;&lt;P&gt;  METHOD on_dog_is_hungry.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;  Event method, called when the event dog_is_hungry is raised&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;    SKIP 1.&lt;/P&gt;&lt;P&gt;    WRITE: /  'You son of a ****. I have not eaten for more than',&lt;/P&gt;&lt;P&gt;              ex_time_since_last_meal, ' hours'.&lt;/P&gt;&lt;P&gt;    WRITE: / 'Give me something to eat NOW!'.&lt;/P&gt;&lt;P&gt;  ENDMETHOD.&lt;/P&gt;&lt;P&gt;ENDCLASS.&lt;/P&gt;&lt;P&gt;*----&lt;/P&gt;&lt;HR originaltext="---------------------------------------------------------------" /&gt;&lt;P&gt;*&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;      R E P O R T&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;*----&lt;/P&gt;&lt;HR originaltext="---------------------------------------------------------------" /&gt;&lt;P&gt;*&lt;/P&gt;&lt;P&gt;DATA: o_dog1 TYPE REF TO lcl_dog.&lt;/P&gt;&lt;P&gt;START-OF-SELECTION.&lt;/P&gt;&lt;P&gt;  CREATE OBJECT o_dog1 EXPORTING im_name = 'Beefeater'.&lt;/P&gt;&lt;P&gt;  CALL METHOD o_dog1-&amp;gt;set_time_since_last_meal&lt;/P&gt;&lt;P&gt;    EXPORTING im_time = 2.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;This method call will raise the event dog_is_hungy&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;because time &amp;gt; 3&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;  CALL METHOD o_dog1-&amp;gt;set_time_since_last_meal&lt;/P&gt;&lt;P&gt;    EXPORTING im_time = 5.&lt;/P&gt;&lt;P&gt;Result:&lt;/P&gt;&lt;P&gt;I am a dog and my name is Beefeater&lt;/P&gt;&lt;P&gt;You fool, I am not hungry yet&lt;/P&gt;&lt;P&gt;You son of a ****. I have not eaten for more than 5 hours&lt;/P&gt;&lt;P&gt;Give me something to eat NOW&lt;/P&gt;&lt;P&gt;This example is a step by step example, moving from a simple clas to more sophisticated classes, and covers inheritance, interfaces and events. &lt;/P&gt;&lt;P&gt;Simple class | Inheritance and ploymorphism | Interfaces | Events &lt;/P&gt;&lt;P&gt; 1. Simple class&lt;/P&gt;&lt;P&gt;This example shows how to create a simple employee class. The constructor method is used to initialize number and name of thje employee when the object is created. A display_employee method can be called to show the attributes of the employee, and CLASS-METHOD dosplay_no_of_employees can be called to show the total number of employees (Number of instances of the employee class).&lt;/P&gt;&lt;P&gt; REPORT zbc404_hf_events_1.&lt;/P&gt;&lt;P&gt;*********************************************************************&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;L C L _ E M P L O Y E E&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;*********************************************************************&lt;/P&gt;&lt;P&gt;*---- LCL Employee - Definition&lt;/P&gt;&lt;P&gt;CLASS lcl_employee DEFINITION.&lt;/P&gt;&lt;P&gt;  PUBLIC SECTION.&lt;/P&gt;&lt;P&gt;*----&lt;/P&gt;&lt;P&gt;-&lt;/P&gt;&lt;HR originaltext="--------------------------------------------------------------" /&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;The public section is accesible from outside   &lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;*----&lt;/P&gt;&lt;P&gt;-&lt;/P&gt;&lt;HR originaltext="--------------------------------------------------------------" /&gt;&lt;P&gt;    TYPES:&lt;/P&gt;&lt;P&gt;      BEGIN OF t_employee,&lt;/P&gt;&lt;P&gt;        no  TYPE i,&lt;/P&gt;&lt;P&gt;        name TYPE string,&lt;/P&gt;&lt;P&gt;     END OF t_employee.&lt;/P&gt;&lt;P&gt;    METHODS:&lt;/P&gt;&lt;P&gt;      constructor&lt;/P&gt;&lt;P&gt;        IMPORTING im_employee_no TYPE i&lt;/P&gt;&lt;P&gt;                  im_employee_name TYPE string,&lt;/P&gt;&lt;P&gt;      display_employee.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;  Class methods are global for all instances       &lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;    CLASS-METHODS: display_no_of_employees.&lt;/P&gt;&lt;P&gt;  PROTECTED SECTION.&lt;/P&gt;&lt;P&gt;*----&lt;/P&gt;&lt;P&gt;-&lt;/P&gt;&lt;HR originaltext="--------------------------------------------------------------" /&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;The protecetd section is accesible from the class and its subclasses  &lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;*----&lt;/P&gt;&lt;P&gt;-&lt;/P&gt;&lt;HR originaltext="--------------------------------------------------------------" /&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;  Class data are global for all instances       &lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;    CLASS-DATA: g_no_of_employees TYPE i.&lt;/P&gt;&lt;P&gt;  PRIVATE SECTION.&lt;/P&gt;&lt;P&gt;*----&lt;/P&gt;&lt;P&gt;-&lt;/P&gt;&lt;HR originaltext="--------------------------------------------------------------" /&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;The private section is only accesible from within the classs  &lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;*----&lt;/P&gt;&lt;P&gt;-&lt;/P&gt;&lt;HR originaltext="--------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    DATA: g_employee TYPE t_employee.&lt;/P&gt;&lt;P&gt;ENDCLASS.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*--- LCL Employee - Implementation&lt;/P&gt;&lt;P&gt;CLASS lcl_employee IMPLEMENTATION.&lt;/P&gt;&lt;P&gt;  METHOD constructor.&lt;/P&gt;&lt;P&gt;    g_employee-no = im_employee_no.&lt;/P&gt;&lt;P&gt;    g_employee-name = im_employee_name.&lt;/P&gt;&lt;P&gt;    g_no_of_employees = g_no_of_employees + 1.&lt;/P&gt;&lt;P&gt;  ENDMETHOD.&lt;/P&gt;&lt;P&gt;  METHOD display_employee.&lt;/P&gt;&lt;P&gt;    WRITE:/ 'Employee', g_employee-no, g_employee-name.&lt;/P&gt;&lt;P&gt;  ENDMETHOD.&lt;/P&gt;&lt;P&gt;  METHOD display_no_of_employees.&lt;/P&gt;&lt;P&gt;    WRITE: / 'Number of employees is:', g_no_of_employees.&lt;/P&gt;&lt;P&gt;  ENDMETHOD.&lt;/P&gt;&lt;P&gt;ENDCLASS.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;************************************************************************&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;R E P O R T&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;*********************************************************************&lt;/P&gt;&lt;P&gt;DATA: g_employee1 TYPE REF TO lcl_employee,&lt;/P&gt;&lt;P&gt;      g_employee2 TYPE REF TO lcl_employee.&lt;/P&gt;&lt;P&gt;START-OF-SELECTION.&lt;/P&gt;&lt;P&gt;  CREATE OBJECT g_employee1&lt;/P&gt;&lt;P&gt;    EXPORTING im_employee_no = 1&lt;/P&gt;&lt;P&gt;              im_employee_name = 'John Jones'.&lt;/P&gt;&lt;P&gt;  CREATE OBJECT g_employee2&lt;/P&gt;&lt;P&gt;    EXPORTING im_employee_no = 2&lt;/P&gt;&lt;P&gt;              im_employee_name = 'Sally Summer'.&lt;/P&gt;&lt;P&gt;  CALL METHOD g_employee1-&amp;gt;display_employee.&lt;/P&gt;&lt;P&gt;  CALL METHOD g_employee2-&amp;gt;display_employee.&lt;/P&gt;&lt;P&gt;  CALL METHOD g_employee2-&amp;gt;display_no_of_employees.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2. Inheritance and polymorphism&lt;/P&gt;&lt;P&gt;This example uses a superclass lcl_company_employees and two subclasses lcl_bluecollar_employee and lcl_whitecollar_employee to add employees to a list and then display a list of employees and there wages. The wages are calcukated in the method add_employee, but as the wages are calculated differently for blue collar employees and white collar emplyees, the superclass method add_employee is redeifined in the subclasses.&lt;/P&gt;&lt;P&gt;Principles:&lt;/P&gt;&lt;P&gt;Create super class LCL_CompanyEmployees.&lt;/P&gt;&lt;P&gt;The class has the methods:&lt;/P&gt;&lt;P&gt;&amp;#149;	Constructor &lt;/P&gt;&lt;P&gt;&amp;#149;	Add_Employee - Adds a new employee to the list of employees &lt;/P&gt;&lt;P&gt;&amp;#149;	Display_Employee_List - Displays all employees and there wage &lt;/P&gt;&lt;P&gt;&amp;#149;	Display_no_of_employees - Displays total number of employees&lt;/P&gt;&lt;P&gt;Note the use of CLASS-DATA to keep the list of employees and number of employees the same from instance to instance.&lt;/P&gt;&lt;P&gt;Create subclasses lcl_bluecollar_employee and lcl_whitecollar_employee. The calsses are identical, except for the redifinition of the add_employee method, where the caclculation of wage is different.&lt;/P&gt;&lt;P&gt;Methodes:&lt;/P&gt;&lt;P&gt;&amp;#149;	Constructor. The constructor is used to initialize the attributes of the employee. Note that the constructor in the supclasss has to be called from within the constructor of the subclass. &lt;/P&gt;&lt;P&gt;&amp;#149;	Add_Employee. This is a redinition of the same method in the superclass. In the redefined class the wage is calcuated, and the superclass method is called to add the employees to the emploee list.:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The program&lt;/P&gt;&lt;P&gt;REPORT zbc404_hf_events_2 .&lt;/P&gt;&lt;P&gt;*******************************************************&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Super class LCL_CompanyEmployees&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;*******************************************************&lt;/P&gt;&lt;P&gt;CLASS lcl_company_employees DEFINITION.&lt;/P&gt;&lt;P&gt;  PUBLIC SECTION.&lt;/P&gt;&lt;P&gt;    TYPES:&lt;/P&gt;&lt;P&gt;      BEGIN OF t_employee,&lt;/P&gt;&lt;P&gt;        no  TYPE i,&lt;/P&gt;&lt;P&gt;        name TYPE string,&lt;/P&gt;&lt;P&gt;        wage TYPE i,&lt;/P&gt;&lt;P&gt;     END OF t_employee.&lt;/P&gt;&lt;P&gt;    METHODS:&lt;/P&gt;&lt;P&gt;      constructor,&lt;/P&gt;&lt;P&gt;      add_employee&lt;/P&gt;&lt;P&gt;        IMPORTING im_no   TYPE i&lt;/P&gt;&lt;P&gt;                  im_name TYPE string&lt;/P&gt;&lt;P&gt;                  im_wage TYPE i,&lt;/P&gt;&lt;P&gt;      display_employee_list,&lt;/P&gt;&lt;P&gt;      display_no_of_employees.&lt;/P&gt;&lt;P&gt;  PRIVATE SECTION.&lt;/P&gt;&lt;P&gt;    CLASS-DATA: i_employee_list TYPE TABLE OF t_employee,&lt;/P&gt;&lt;P&gt;                no_of_employees TYPE i.&lt;/P&gt;&lt;P&gt;ENDCLASS.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*-- CLASS LCL_CompanyEmployees IMPLEMENTATION&lt;/P&gt;&lt;P&gt;CLASS lcl_company_employees IMPLEMENTATION.&lt;/P&gt;&lt;P&gt;  METHOD constructor.&lt;/P&gt;&lt;P&gt;    no_of_employees = no_of_employees + 1.&lt;/P&gt;&lt;P&gt;  ENDMETHOD.&lt;/P&gt;&lt;P&gt;  METHOD add_employee.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;  Adds a new employee to the list of employees&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;    DATA: l_employee TYPE t_employee.&lt;/P&gt;&lt;P&gt;    l_employee-no = im_no.&lt;/P&gt;&lt;P&gt;    l_employee-name = im_name.&lt;/P&gt;&lt;P&gt;    l_employee-wage = im_wage.&lt;/P&gt;&lt;P&gt;    APPEND l_employee TO i_employee_list.&lt;/P&gt;&lt;P&gt;  ENDMETHOD.&lt;/P&gt;&lt;P&gt;  METHOD display_employee_list.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;  Displays all employees and there wage&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;    DATA: l_employee TYPE t_employee.&lt;/P&gt;&lt;P&gt;    WRITE: / 'List of Employees'.&lt;/P&gt;&lt;P&gt;    LOOP AT i_employee_list INTO l_employee.&lt;/P&gt;&lt;P&gt;      WRITE: / l_employee-no, l_employee-name, l_employee-wage.&lt;/P&gt;&lt;P&gt;    ENDLOOP.&lt;/P&gt;&lt;P&gt;  ENDMETHOD.&lt;/P&gt;&lt;P&gt;  METHOD display_no_of_employees.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;  Displays total number of employees&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;    SKIP 3.&lt;/P&gt;&lt;P&gt;    WRITE: / 'Total number of employees:', no_of_employees.&lt;/P&gt;&lt;P&gt;  ENDMETHOD.&lt;/P&gt;&lt;P&gt;ENDCLASS.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*******************************************************&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Sub class LCL_BlueCollar_Employee&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;*******************************************************&lt;/P&gt;&lt;P&gt;CLASS lcl_bluecollar_employee DEFINITION&lt;/P&gt;&lt;P&gt;          INHERITING FROM lcl_company_employees.&lt;/P&gt;&lt;P&gt;  PUBLIC SECTION.&lt;/P&gt;&lt;P&gt;    METHODS:&lt;/P&gt;&lt;P&gt;        constructor&lt;/P&gt;&lt;P&gt;          IMPORTING im_no             TYPE i&lt;/P&gt;&lt;P&gt;                    im_name           TYPE string&lt;/P&gt;&lt;P&gt;                    im_hours          TYPE i&lt;/P&gt;&lt;P&gt;                    im_hourly_payment TYPE i,&lt;/P&gt;&lt;P&gt;         add_employee REDEFINITION.&lt;/P&gt;&lt;P&gt;  PRIVATE SECTION.&lt;/P&gt;&lt;P&gt;    DATA:no             TYPE i,&lt;/P&gt;&lt;P&gt;         name           TYPE string,&lt;/P&gt;&lt;P&gt;         hours          TYPE i,&lt;/P&gt;&lt;P&gt;         hourly_payment TYPE i.&lt;/P&gt;&lt;P&gt;ENDCLASS.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*---- CLASS LCL_BlueCollar_Employee IMPLEMENTATION&lt;/P&gt;&lt;P&gt;CLASS lcl_bluecollar_employee IMPLEMENTATION.&lt;/P&gt;&lt;P&gt;  METHOD constructor.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;  The superclass constructor method must be called from the subclass&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;  constructor method&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;    CALL METHOD super-&amp;gt;constructor.&lt;/P&gt;&lt;P&gt;    no = im_no.&lt;/P&gt;&lt;P&gt;    name = im_name.&lt;/P&gt;&lt;P&gt;    hours = im_hours.&lt;/P&gt;&lt;P&gt;    hourly_payment = im_hourly_payment.&lt;/P&gt;&lt;P&gt;  ENDMETHOD.&lt;/P&gt;&lt;P&gt;  METHOD add_employee.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;  Calculate wage an call the superclass method add_employee to add&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;  the employee to the employee list&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;    DATA: l_wage TYPE i.&lt;/P&gt;&lt;P&gt;    l_wage = hours * hourly_payment.&lt;/P&gt;&lt;P&gt;    CALL METHOD super-&amp;gt;add_employee&lt;/P&gt;&lt;P&gt;      EXPORTING im_no = no&lt;/P&gt;&lt;P&gt;                im_name = name&lt;/P&gt;&lt;P&gt;                im_wage = l_wage.&lt;/P&gt;&lt;P&gt;  ENDMETHOD.&lt;/P&gt;&lt;P&gt;ENDCLASS.&lt;/P&gt;&lt;P&gt;*******************************************************&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Sub class LCL_WhiteCollar_Employee&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;*******************************************************&lt;/P&gt;&lt;P&gt;CLASS lcl_whitecollar_employee DEFINITION&lt;/P&gt;&lt;P&gt;    INHERITING FROM lcl_company_employees.&lt;/P&gt;&lt;P&gt;  PUBLIC SECTION.&lt;/P&gt;&lt;P&gt;    METHODS:&lt;/P&gt;&lt;P&gt;        constructor&lt;/P&gt;&lt;P&gt;          IMPORTING im_no                 TYPE i&lt;/P&gt;&lt;P&gt;                    im_name               TYPE string&lt;/P&gt;&lt;P&gt;                    im_monthly_salary     TYPE i&lt;/P&gt;&lt;P&gt;                    im_monthly_deducations TYPE i,&lt;/P&gt;&lt;P&gt;         add_employee REDEFINITION.&lt;/P&gt;&lt;P&gt;  PRIVATE SECTION.&lt;/P&gt;&lt;P&gt;    DATA:&lt;/P&gt;&lt;P&gt;      no                    TYPE i,&lt;/P&gt;&lt;P&gt;      name                  TYPE string,&lt;/P&gt;&lt;P&gt;      monthly_salary        TYPE i,&lt;/P&gt;&lt;P&gt;      monthly_deducations    TYPE i.&lt;/P&gt;&lt;P&gt;ENDCLASS.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*---- CLASS LCL_WhiteCollar_Employee IMPLEMENTATION&lt;/P&gt;&lt;P&gt;CLASS lcl_whitecollar_employee IMPLEMENTATION.&lt;/P&gt;&lt;P&gt;  METHOD constructor.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;  The superclass constructor method must be called from the subclass&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;  constructor method&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    CALL METHOD super-&amp;gt;constructor.&lt;/P&gt;&lt;P&gt;    no = im_no.&lt;/P&gt;&lt;P&gt;    name = im_name.&lt;/P&gt;&lt;P&gt;    monthly_salary = im_monthly_salary.&lt;/P&gt;&lt;P&gt;    monthly_deducations = im_monthly_deducations.&lt;/P&gt;&lt;P&gt;  ENDMETHOD.&lt;/P&gt;&lt;P&gt;  METHOD add_employee.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;  Calculate wage an call the superclass method add_employee to add&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;  the employee to the employee list&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;    DATA: l_wage TYPE i.&lt;/P&gt;&lt;P&gt;    l_wage = monthly_salary - monthly_deducations.&lt;/P&gt;&lt;P&gt;    CALL METHOD super-&amp;gt;add_employee&lt;/P&gt;&lt;P&gt;      EXPORTING im_no = no&lt;/P&gt;&lt;P&gt;                im_name = name&lt;/P&gt;&lt;P&gt;                im_wage = l_wage.&lt;/P&gt;&lt;P&gt;  ENDMETHOD.&lt;/P&gt;&lt;P&gt;ENDCLASS.&lt;/P&gt;&lt;P&gt;*******************************************************&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;R E P O R T&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;*******************************************************&lt;/P&gt;&lt;P&gt;DATA:&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Object references&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;  o_bluecollar_employee1  TYPE REF TO lcl_bluecollar_employee,&lt;/P&gt;&lt;P&gt;  o_whitecollar_employee1 TYPE REF TO lcl_whitecollar_employee.&lt;/P&gt;&lt;P&gt;START-OF-SELECTION.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Create bluecollar employee obeject&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;  CREATE OBJECT o_bluecollar_employee1&lt;/P&gt;&lt;P&gt;      EXPORTING im_no  = 1&lt;/P&gt;&lt;P&gt;                im_name  = 'Gylle Karen'&lt;/P&gt;&lt;P&gt;                im_hours = 38&lt;/P&gt;&lt;P&gt;                im_hourly_payment = 75.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Add bluecollar employee to employee list&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;  CALL METHOD o_bluecollar_employee1-&amp;gt;add_employee&lt;/P&gt;&lt;P&gt;      EXPORTING im_no  = 1&lt;/P&gt;&lt;P&gt;                im_name  = 'Gylle Karen'&lt;/P&gt;&lt;P&gt;                im_wage = 0.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Create whitecollar employee obeject&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;  CREATE OBJECT o_whitecollar_employee1&lt;/P&gt;&lt;P&gt;      EXPORTING im_no  = 2&lt;/P&gt;&lt;P&gt;                im_name  = 'John Dickens'&lt;/P&gt;&lt;P&gt;                im_monthly_salary = 10000&lt;/P&gt;&lt;P&gt;                im_monthly_deducations = 2500.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Add bluecollar employee to employee list&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;  CALL METHOD o_whitecollar_employee1-&amp;gt;add_employee&lt;/P&gt;&lt;P&gt;      EXPORTING im_no  = 1&lt;/P&gt;&lt;P&gt;                im_name  = 'Karen Johnson'&lt;/P&gt;&lt;P&gt;                im_wage = 0.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Display employee list and number of employees. Note that the result&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;will be the same when called from o_whitecollar_employee1 or&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;o_bluecolarcollar_employee1, because the methods are defined&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;as static (CLASS-METHODS)&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;  CALL METHOD o_whitecollar_employee1-&amp;gt;display_employee_list.&lt;/P&gt;&lt;P&gt;  CALL METHOD o_whitecollar_employee1-&amp;gt;display_no_of_employees.&lt;/P&gt;&lt;P&gt;The resulting report&lt;/P&gt;&lt;P&gt;List of Employees&lt;/P&gt;&lt;P&gt;1 Karen Johnson 2.850&lt;/P&gt;&lt;P&gt;2 John Dickens 7.500&lt;/P&gt;&lt;P&gt;Total number of employees: 2&lt;/P&gt;&lt;P&gt;3. Interfaces&lt;/P&gt;&lt;P&gt;This example is similiar to th eprevious example, however an interface is implemented with the method add_employee. Note that the interface is only implemented in the superclass ( The INTERFACE stament), but also used in the subclasses.&lt;/P&gt;&lt;P&gt;The interface in the example only contains a method, but an iterface can also contain attrbutes, constants, types and alias names.&lt;/P&gt;&lt;P&gt;The output from example 3 is similiar to the output in example 2.&lt;/P&gt;&lt;P&gt;All changes in the program compared to example 2 are marked with red.&lt;/P&gt;&lt;P&gt;REPORT zbc404_hf_events_3 .&lt;/P&gt;&lt;P&gt;*----&lt;/P&gt;&lt;HR originaltext="---------------------------------------------------------------" /&gt;&lt;P&gt;*&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;      INTERFACE lif_employee&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;*----&lt;/P&gt;&lt;HR originaltext="---------------------------------------------------------------" /&gt;&lt;P&gt;*&lt;/P&gt;&lt;P&gt;INTERFACE lif_employee.&lt;/P&gt;&lt;P&gt;  METHODS:&lt;/P&gt;&lt;P&gt;    add_employee&lt;/P&gt;&lt;P&gt;       IMPORTING im_no   TYPE i&lt;/P&gt;&lt;P&gt;                  im_name TYPE string&lt;/P&gt;&lt;P&gt;                  im_wage TYPE i.&lt;/P&gt;&lt;P&gt;ENDINTERFACE.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*******************************************************&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Super class LCL_CompanyEmployees&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;*******************************************************&lt;/P&gt;&lt;P&gt;CLASS lcl_company_employees DEFINITION.&lt;/P&gt;&lt;P&gt;  PUBLIC SECTION.&lt;/P&gt;&lt;P&gt;    INTERFACES lif_employee.&lt;/P&gt;&lt;P&gt;    TYPES:&lt;/P&gt;&lt;P&gt;      BEGIN OF t_employee,&lt;/P&gt;&lt;P&gt;        no  TYPE i,&lt;/P&gt;&lt;P&gt;        name TYPE string,&lt;/P&gt;&lt;P&gt;        wage TYPE i,&lt;/P&gt;&lt;P&gt;     END OF t_employee.&lt;/P&gt;&lt;P&gt;    METHODS:&lt;/P&gt;&lt;P&gt;      constructor,&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;     add_employee      "Removed&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;        IMPORTING im_no   TYPE i&lt;/P&gt;&lt;P&gt;                  im_name TYPE string&lt;/P&gt;&lt;P&gt;                  im_wage TYPE i,&lt;/P&gt;&lt;P&gt;      display_employee_list,&lt;/P&gt;&lt;P&gt;      display_no_of_employees.&lt;/P&gt;&lt;P&gt;  PRIVATE SECTION.&lt;/P&gt;&lt;P&gt;    CLASS-DATA: i_employee_list TYPE TABLE OF t_employee,&lt;/P&gt;&lt;P&gt;                no_of_employees TYPE i.&lt;/P&gt;&lt;P&gt;ENDCLASS.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*-- CLASS LCL_CompanyEmployees IMPLEMENTATION&lt;/P&gt;&lt;P&gt;CLASS lcl_company_employees IMPLEMENTATION.&lt;/P&gt;&lt;P&gt;  METHOD constructor.&lt;/P&gt;&lt;P&gt;    no_of_employees = no_of_employees + 1.&lt;/P&gt;&lt;P&gt;  ENDMETHOD.&lt;/P&gt;&lt;P&gt;  METHOD lif_employee~add_employee.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;  Adds a new employee to the list of employees&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;    DATA: l_employee TYPE t_employee.&lt;/P&gt;&lt;P&gt;    l_employee-no = im_no.&lt;/P&gt;&lt;P&gt;    l_employee-name = im_name.&lt;/P&gt;&lt;P&gt;    l_employee-wage = im_wage.&lt;/P&gt;&lt;P&gt;    APPEND l_employee TO i_employee_list.&lt;/P&gt;&lt;P&gt;  ENDMETHOD.&lt;/P&gt;&lt;P&gt;  METHOD display_employee_list.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;  Displays all employees and there wage&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;    DATA: l_employee TYPE t_employee.&lt;/P&gt;&lt;P&gt;    WRITE: / 'List of Employees'.&lt;/P&gt;&lt;P&gt;    LOOP AT i_employee_list INTO l_employee.&lt;/P&gt;&lt;P&gt;      WRITE: / l_employee-no, l_employee-name, l_employee-wage.&lt;/P&gt;&lt;P&gt;    ENDLOOP.&lt;/P&gt;&lt;P&gt;  ENDMETHOD.&lt;/P&gt;&lt;P&gt;  METHOD display_no_of_employees.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;  Displays total number of employees&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;    SKIP 3.&lt;/P&gt;&lt;P&gt;    WRITE: / 'Total number of employees:', no_of_employees.&lt;/P&gt;&lt;P&gt;  ENDMETHOD.&lt;/P&gt;&lt;P&gt;ENDCLASS.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;*******************************************************&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Sub class LCL_BlueCollar_Employee&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;*******************************************************&lt;/P&gt;&lt;P&gt;CLASS lcl_bluecollar_employee DEFINITION&lt;/P&gt;&lt;P&gt;          INHERITING FROM lcl_company_employees.&lt;/P&gt;&lt;P&gt;  PUBLIC SECTION.&lt;/P&gt;&lt;P&gt;    METHODS:&lt;/P&gt;&lt;P&gt;        constructor&lt;/P&gt;&lt;P&gt;          IMPORTING im_no             TYPE i&lt;/P&gt;&lt;P&gt;                    im_name           TYPE string&lt;/P&gt;&lt;P&gt;                    im_hours          TYPE i&lt;/P&gt;&lt;P&gt;                    im_hourly_payment TYPE i,&lt;/P&gt;&lt;P&gt;         lif_employee~add_employee REDEFINITION..&lt;/P&gt;&lt;P&gt;  PRIVATE SECTION.&lt;/P&gt;&lt;P&gt;    DATA:no             TYPE i,&lt;/P&gt;&lt;P&gt;         name           TYPE string,&lt;/P&gt;&lt;P&gt;         hours          TYPE i,&lt;/P&gt;&lt;P&gt;         hourly_payment TYPE i.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;ENDCLASS.&lt;/P&gt;&lt;P&gt;*---- CLASS LCL_BlueCollar_Employee IMPLEMENTATION&lt;/P&gt;&lt;P&gt;CLASS lcl_bluecollar_employee IMPLEMENTATION.&lt;/P&gt;&lt;P&gt;  METHOD constructor.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;  The superclass constructor method must be called from the subclass&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;  constructor method&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;    CALL METHOD super-&amp;gt;constructor.&lt;/P&gt;&lt;P&gt;    no = im_no.&lt;/P&gt;&lt;P&gt;    name = im_name.&lt;/P&gt;&lt;P&gt;    hours = im_hours.&lt;/P&gt;&lt;P&gt;    hourly_payment = im_hourly_payment.&lt;/P&gt;&lt;P&gt;  ENDMETHOD.&lt;/P&gt;&lt;P&gt;  METHOD lif_employee~add_employee.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;  Calculate wage an call the superclass method add_employee to add&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;  the employee to the employee list&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;    DATA: l_wage TYPE i.&lt;/P&gt;&lt;P&gt;    l_wage = hours * hourly_payment.&lt;/P&gt;&lt;P&gt;    CALL METHOD super-&amp;gt;lif_employee~add_employee&lt;/P&gt;&lt;P&gt;      EXPORTING im_no = no&lt;/P&gt;&lt;P&gt;                im_name = name&lt;/P&gt;&lt;P&gt;                im_wage = l_wage.&lt;/P&gt;&lt;P&gt;  ENDMETHOD.&lt;/P&gt;&lt;P&gt;ENDCLASS.&lt;/P&gt;&lt;P&gt;*******************************************************&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Sub class LCL_WhiteCollar_Employee&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;*******************************************************&lt;/P&gt;&lt;P&gt;CLASS lcl_whitecollar_employee DEFINITION&lt;/P&gt;&lt;P&gt;    INHERITING FROM lcl_company_employees.&lt;/P&gt;&lt;P&gt;  PUBLIC SECTION.&lt;/P&gt;&lt;P&gt;    METHODS:&lt;/P&gt;&lt;P&gt;        constructor&lt;/P&gt;&lt;P&gt;          IMPORTING im_no                 TYPE i&lt;/P&gt;&lt;P&gt;                    im_name               TYPE string&lt;/P&gt;&lt;P&gt;                    im_monthly_salary     TYPE i&lt;/P&gt;&lt;P&gt;                    im_monthly_deducations TYPE i,&lt;/P&gt;&lt;P&gt;         lif_employee~add_employee REDEFINITION.&lt;/P&gt;&lt;P&gt;  PRIVATE SECTION.&lt;/P&gt;&lt;P&gt;    DATA:&lt;/P&gt;&lt;P&gt;      no                    TYPE i,&lt;/P&gt;&lt;P&gt;      name                  TYPE string,&lt;/P&gt;&lt;P&gt;      monthly_salary        TYPE i,&lt;/P&gt;&lt;P&gt;      monthly_deducations    TYPE i.&lt;/P&gt;&lt;P&gt;ENDCLASS.&lt;/P&gt;&lt;P&gt;*---- CLASS LCL_WhiteCollar_Employee IMPLEMENTATION&lt;/P&gt;&lt;P&gt;CLASS lcl_whitecollar_employee IMPLEMENTATION.&lt;/P&gt;&lt;P&gt;  METHOD constructor.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;  The superclass constructor method must be called from the subclass&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;  constructor method&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    CALL METHOD super-&amp;gt;constructor.&lt;/P&gt;&lt;P&gt;    no = im_no.&lt;/P&gt;&lt;P&gt;    name = im_name.&lt;/P&gt;&lt;P&gt;    monthly_salary = im_monthly_salary.&lt;/P&gt;&lt;P&gt;    monthly_deducations = im_monthly_deducations.&lt;/P&gt;&lt;P&gt;  ENDMETHOD.&lt;/P&gt;&lt;P&gt;  METHOD lif_employee~add_employee.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;  Calculate wage an call the superclass method add_employee to add&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;  the employee to the employee list&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;    DATA: l_wage TYPE i.&lt;/P&gt;&lt;P&gt;    l_wage = monthly_salary - monthly_deducations.&lt;/P&gt;&lt;P&gt;    CALL METHOD super-&amp;gt;lif_employee~add_employee&lt;/P&gt;&lt;P&gt;      EXPORTING im_no = no&lt;/P&gt;&lt;P&gt;                im_name = name&lt;/P&gt;&lt;P&gt;                im_wage = l_wage.&lt;/P&gt;&lt;P&gt;  ENDMETHOD.&lt;/P&gt;&lt;P&gt;ENDCLASS.&lt;/P&gt;&lt;P&gt;*******************************************************&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;R E P O R T&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;*******************************************************&lt;/P&gt;&lt;P&gt;DATA:&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Object references&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;  o_bluecollar_employee1  TYPE REF TO lcl_bluecollar_employee,&lt;/P&gt;&lt;P&gt;  o_whitecollar_employee1 TYPE REF TO lcl_whitecollar_employee.&lt;/P&gt;&lt;P&gt;START-OF-SELECTION.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Create bluecollar employee obeject&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;  CREATE OBJECT o_bluecollar_employee1&lt;/P&gt;&lt;P&gt;      EXPORTING im_no  = 1&lt;/P&gt;&lt;P&gt;                im_name  = 'Gylle Karen'&lt;/P&gt;&lt;P&gt;                im_hours = 38&lt;/P&gt;&lt;P&gt;                im_hourly_payment = 75.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Add bluecollar employee to employee list&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;  CALL METHOD o_bluecollar_employee1-&amp;gt;lif_employee~add_employee&lt;/P&gt;&lt;P&gt;      EXPORTING im_no  = 1&lt;/P&gt;&lt;P&gt;                im_name  = 'Karen Johnson'&lt;/P&gt;&lt;P&gt;                im_wage = 0.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Create whitecollar employee obeject&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;  CREATE OBJECT o_whitecollar_employee1&lt;/P&gt;&lt;P&gt;      EXPORTING im_no  = 2&lt;/P&gt;&lt;P&gt;                im_name  = 'John Dickens'&lt;/P&gt;&lt;P&gt;                im_monthly_salary = 10000&lt;/P&gt;&lt;P&gt;                im_monthly_deducations = 2500.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Add bluecollar employee to employee list&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;  CALL METHOD o_whitecollar_employee1-&amp;gt;lif_employee~add_employee&lt;/P&gt;&lt;P&gt;      EXPORTING im_no  = 1&lt;/P&gt;&lt;P&gt;                im_name  = 'Gylle Karen'&lt;/P&gt;&lt;P&gt;                im_wage = 0.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Display employee list and number of employees. Note that the result&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;will be the same when called from o_whitecollar_employee1 or&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;o_bluecolarcollar_employee1, because the methods are defined&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;as static (CLASS-METHODS)&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;  CALL METHOD o_whitecollar_employee1-&amp;gt;display_employee_list.&lt;/P&gt;&lt;P&gt;  CALL METHOD o_whitecollar_employee1-&amp;gt;display_no_of_employees.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;4. Events&lt;/P&gt;&lt;P&gt;This is the same example as example 4. All changes are marked with red. There have been no canges to the subclasses, only to the superclass and the report, sp the code for th esubclasses is not shown.&lt;/P&gt;&lt;P&gt;For a simple example refer to Events in Examples.&lt;/P&gt;&lt;P&gt;REPORT zbc404_hf_events_4 .&lt;/P&gt;&lt;P&gt;*----&lt;/P&gt;&lt;HR originaltext="---------------------------------------------------------------" /&gt;&lt;P&gt;*&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;      INTERFACE lif_employee&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;*----&lt;/P&gt;&lt;HR originaltext="---------------------------------------------------------------" /&gt;&lt;P&gt;*&lt;/P&gt;&lt;P&gt;INTERFACE lif_employee.&lt;/P&gt;&lt;P&gt;  METHODS:&lt;/P&gt;&lt;P&gt;    add_employee&lt;/P&gt;&lt;P&gt;       IMPORTING im_no   TYPE i&lt;/P&gt;&lt;P&gt;                  im_name TYPE string&lt;/P&gt;&lt;P&gt;                  im_wage TYPE i.&lt;/P&gt;&lt;P&gt;ENDINTERFACE.&lt;/P&gt;&lt;P&gt;*******************************************************&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Super class LCL_CompanyEmployees&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;*******************************************************&lt;/P&gt;&lt;P&gt;CLASS lcl_company_employees DEFINITION.&lt;/P&gt;&lt;P&gt;  PUBLIC SECTION.&lt;/P&gt;&lt;P&gt;    TYPES:&lt;/P&gt;&lt;P&gt;    BEGIN OF t_employee,&lt;/P&gt;&lt;P&gt;      no  TYPE i,&lt;/P&gt;&lt;P&gt;      name TYPE string,&lt;/P&gt;&lt;P&gt;      wage TYPE i,&lt;/P&gt;&lt;P&gt;   END OF t_employee.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;  Declare event. Note that declaration could also be placed in the&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;  interface&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;    EVENTS: employee_added_to_list&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;        EXPORTING value(ex_employee_name) TYPE string.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt; CLASS-EVENTS: Events can also be defined as class-events&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;    INTERFACES lif_employee.&lt;/P&gt;&lt;P&gt;    METHODS:&lt;/P&gt;&lt;P&gt;      constructor,&lt;/P&gt;&lt;P&gt;      display_employee_list,&lt;/P&gt;&lt;P&gt;      display_no_of_employees,&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;    Declare event method&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;      on_employee_added_to_list FOR EVENT employee_added_to_list OF lcl_company_employees&lt;/P&gt;&lt;P&gt;         IMPORTING ex_employee_name sender.&lt;/P&gt;&lt;P&gt;  PRIVATE SECTION.&lt;/P&gt;&lt;P&gt;    CLASS-DATA:&lt;/P&gt;&lt;P&gt;      i_employee_list TYPE TABLE OF t_employee,&lt;/P&gt;&lt;P&gt;      no_of_employees TYPE i.&lt;/P&gt;&lt;P&gt;ENDCLASS.&lt;/P&gt;&lt;P&gt;*-- CLASS LCL_CompanyEmployees IMPLEMENTATION&lt;/P&gt;&lt;P&gt;CLASS lcl_company_employees IMPLEMENTATION.&lt;/P&gt;&lt;P&gt;  METHOD constructor.&lt;/P&gt;&lt;P&gt;    no_of_employees = no_of_employees + 1.&lt;/P&gt;&lt;P&gt;  ENDMETHOD.&lt;/P&gt;&lt;P&gt;  METHOD lif_employee~add_employee.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;  Adds a new employee to the list of employees&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    DATA: l_employee TYPE t_employee.&lt;/P&gt;&lt;P&gt;    l_employee-no = im_no.&lt;/P&gt;&lt;P&gt;    l_employee-name = im_name.&lt;/P&gt;&lt;P&gt;    l_employee-wage = im_wage.&lt;/P&gt;&lt;P&gt;    APPEND l_employee TO i_employee_list.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;  Raise event employee_added_to_list&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;    RAISE EVENT employee_added_to_list&lt;/P&gt;&lt;P&gt;       EXPORTING ex_employee_name =  l_employee-name.&lt;/P&gt;&lt;P&gt;  ENDMETHOD.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; METHOD display_employee_list.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;  Displays all employees and there wage&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;    DATA: l_employee TYPE t_employee.&lt;/P&gt;&lt;P&gt;    WRITE: / 'List of Employees'.&lt;/P&gt;&lt;P&gt;    LOOP AT i_employee_list INTO l_employee.&lt;/P&gt;&lt;P&gt;      WRITE: / l_employee-no, l_employee-name, l_employee-wage.&lt;/P&gt;&lt;P&gt;    ENDLOOP.&lt;/P&gt;&lt;P&gt;  ENDMETHOD.&lt;/P&gt;&lt;P&gt;  METHOD display_no_of_employees.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;  Displays total number of employees&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;    SKIP 3.&lt;/P&gt;&lt;P&gt;    WRITE: / 'Total number of employees:', no_of_employees.&lt;/P&gt;&lt;P&gt;  ENDMETHOD.&lt;/P&gt;&lt;P&gt;  METHOD on_employee_added_to_list.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;  Event method&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;    WRITE: / 'Employee added to list', ex_employee_name.&lt;/P&gt;&lt;P&gt;  ENDMETHOD.&lt;/P&gt;&lt;P&gt;ENDCLASS.&lt;/P&gt;&lt;P&gt;*******************************************************&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Sub class LCL_BlueCollar_Employee&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;*******************************************************&lt;/P&gt;&lt;P&gt;CLASS lcl_bluecollar_employee DEFINITION&lt;/P&gt;&lt;P&gt;          INHERITING FROM lcl_company_employees.&lt;/P&gt;&lt;P&gt; See code in example 3...&lt;/P&gt;&lt;P&gt;ENDCLASS.&lt;/P&gt;&lt;P&gt;CLASS lcl_bluecollar_employee IMPLEMENTATION.&lt;/P&gt;&lt;P&gt; See code in example 3...&lt;/P&gt;&lt;P&gt;ENDCLASS.&lt;/P&gt;&lt;P&gt;*******************************************************&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Sub class LCL_WhiteCollar_Employee&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;*******************************************************&lt;/P&gt;&lt;P&gt;CLASS lcl_whitecollar_employee DEFINITION&lt;/P&gt;&lt;P&gt; See code in example 3...&lt;/P&gt;&lt;P&gt;ENDCLASS.&lt;/P&gt;&lt;P&gt;CLASS lcl_whitecollar_employee IMPLEMENTATION.&lt;/P&gt;&lt;P&gt; See code in example 3...&lt;/P&gt;&lt;P&gt;ENDCLASS.&lt;/P&gt;&lt;P&gt;*******************************************************&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;R E P O R T&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;*******************************************************&lt;/P&gt;&lt;P&gt;DATA:&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Object references&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;  o_bluecollar_employee1  TYPE REF TO lcl_bluecollar_employee,&lt;/P&gt;&lt;P&gt;  o_whitecollar_employee1 TYPE REF TO lcl_whitecollar_employee.&lt;/P&gt;&lt;P&gt;START-OF-SELECTION.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Create bluecollar employee obeject&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;  CREATE OBJECT o_bluecollar_employee1&lt;/P&gt;&lt;P&gt;      EXPORTING im_no  = 1&lt;/P&gt;&lt;P&gt;                im_name  = 'Karen Johnson'&lt;/P&gt;&lt;P&gt;                im_hours = 38&lt;/P&gt;&lt;P&gt;                im_hourly_payment = 75.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Register event for o_bluecollar_employee1&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;  SET HANDLER o_bluecollar_employee1-&amp;gt;on_employee_added_to_list&lt;/P&gt;&lt;P&gt;     FOR o_bluecollar_employee1.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Add bluecollar employee to employee list&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;  CALL METHOD o_bluecollar_employee1-&amp;gt;lif_employee~add_employee&lt;/P&gt;&lt;P&gt;      EXPORTING im_no  = 1&lt;/P&gt;&lt;P&gt;                im_name  = 'Gylle Karen'&lt;/P&gt;&lt;P&gt;                im_wage = 0.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Create whitecollar employee obeject&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;  CREATE OBJECT o_whitecollar_employee1&lt;/P&gt;&lt;P&gt;      EXPORTING im_no  = 2&lt;/P&gt;&lt;P&gt;                im_name  = 'John Dickens'&lt;/P&gt;&lt;P&gt;                im_monthly_salary = 10000&lt;/P&gt;&lt;P&gt;                im_monthly_deducations = 2500.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Register event for o_whitecollar_employee1&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;  SET HANDLER o_whitecollar_employee1-&amp;gt;on_employee_added_to_list&lt;/P&gt;&lt;P&gt;     FOR o_whitecollar_employee1.´&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Add bluecollar employee to employee list&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;  CALL METHOD o_whitecollar_employee1-&amp;gt;lif_employee~add_employee&lt;/P&gt;&lt;P&gt;      EXPORTING im_no  = 1&lt;/P&gt;&lt;P&gt;                im_name  = 'Gylle Karen'&lt;/P&gt;&lt;P&gt;                im_wage = 0.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Display employee list and number of employees. Note that the result&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;will be the same when called from o_whitecollar_employee1 or&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;o_bluecolarcollar_employee1, because the methods are defined&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;as static (CLASS-METHODS)&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  CALL METHOD o_whitecollar_employee1-&amp;gt;display_employee_list.&lt;/P&gt;&lt;P&gt;  CALL METHOD o_whitecollar_employee1-&amp;gt;display_no_of_employees.&lt;/P&gt;&lt;P&gt;Result:&lt;/P&gt;&lt;P&gt;Employee added to list Karen Johnson&lt;/P&gt;&lt;P&gt;Employee added to list John Dickens&lt;/P&gt;&lt;P&gt;List of Employees&lt;/P&gt;&lt;P&gt;1 Karen Johnson 2.850&lt;/P&gt;&lt;P&gt;2 John Dickens 7.500&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Total number of employees: 2&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 05 Jul 2007 04:51:01 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2007-07-05T04:51:01Z</dc:date>
    <item>
      <title>OOP's concept</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/oop-s-concept/m-p/2407111#M536616</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I wanted to understand the basic concepts of OOP's.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Like class, instance, method??&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;How to use it??&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;anybody will pls tell me in the hierarchical form??&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 29 Jun 2007 08:56:13 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/oop-s-concept/m-p/2407111#M536616</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-06-29T08:56:13Z</dc:date>
    </item>
    <item>
      <title>Re: OOP's concept</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/oop-s-concept/m-p/2407112#M536617</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;check the below links lot of info and examples r there&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://www.sapgenie.com/abap/OO/index.htm" target="test_blank"&gt;http://www.sapgenie.com/abap/OO/index.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://www.geocities.com/victorav15/sapr3/abap_ood.html" target="test_blank"&gt;http://www.geocities.com/victorav15/sapr3/abap_ood.html&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://www.brabandt.de/html/abap_oo.html" target="test_blank"&gt;http://www.brabandt.de/html/abap_oo.html&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Check this cool weblog:&lt;/P&gt;&lt;P&gt;/people/thomas.jung3/blog/2004/12/08/abap-persistent-classes-coding-without-sql&lt;/P&gt;&lt;P&gt;/people/thomas.jung3/blog/2004/12/08/abap-persistent-classes-coding-without-sql&lt;/P&gt;&lt;P&gt;&lt;A href="http://help.sap.com/saphelp_nw04/helpdata/en/c3/225b6254f411d194a60000e8353423/frameset.htm" target="test_blank"&gt;http://help.sap.com/saphelp_nw04/helpdata/en/c3/225b6254f411d194a60000e8353423/frameset.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://www.sapgenie.com/abap/OO/" target="test_blank"&gt;http://www.sapgenie.com/abap/OO/&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://www.sapgenie.com/abap/OO/index.htm" target="test_blank"&gt;http://www.sapgenie.com/abap/OO/index.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://help.sap.com/saphelp_nw04/helpdata/en/c3/225b5654f411d194a60000e8353423/content.htm" target="test_blank"&gt;http://help.sap.com/saphelp_nw04/helpdata/en/c3/225b5654f411d194a60000e8353423/content.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://www.esnips.com/doc/375fff1b-5a62-444d-8ec1-55508c308b17/prefinalppt.ppt" target="test_blank"&gt;http://www.esnips.com/doc/375fff1b-5a62-444d-8ec1-55508c308b17/prefinalppt.ppt&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://www.esnips.com/doc/2c76dc57-e74a-4539-a20e-29383317e804/OO-abap.pdf" target="test_blank"&gt;http://www.esnips.com/doc/2c76dc57-e74a-4539-a20e-29383317e804/OO-abap.pdf&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://www.esnips.com/doc/5c65b0dd-eddf-4512-8e32-ecd26735f0f2/prefinalppt.ppt" target="test_blank"&gt;http://www.esnips.com/doc/5c65b0dd-eddf-4512-8e32-ecd26735f0f2/prefinalppt.ppt&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://www.allsaplinks.com/" target="test_blank"&gt;http://www.allsaplinks.com/&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://www.sap-img.com/" target="test_blank"&gt;http://www.sap-img.com/&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://www.sapgenie.com/" target="test_blank"&gt;http://www.sapgenie.com/&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://help.sap.com" target="test_blank"&gt;http://help.sap.com&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://www.sapgenie.com/abap/OO/" target="test_blank"&gt;http://www.sapgenie.com/abap/OO/&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://www.sapgenie.com/abap/OO/index.htm" target="test_blank"&gt;http://www.sapgenie.com/abap/OO/index.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://www.sapgenie.com/abap/controls/index.htm" target="test_blank"&gt;http://www.sapgenie.com/abap/controls/index.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://www.esnips.com/doc/2c76dc57-e74a-4539-a20e-29383317e804/OO-abap.pdf" target="test_blank"&gt;http://www.esnips.com/doc/2c76dc57-e74a-4539-a20e-29383317e804/OO-abap.pdf&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://www.esnips.com/doc/0ef39d4b-586a-4637-abbb-e4f69d2d9307/SAP-CONTROLS-WORKSHOP.pdf" target="test_blank"&gt;http://www.esnips.com/doc/0ef39d4b-586a-4637-abbb-e4f69d2d9307/SAP-CONTROLS-WORKSHOP.pdf&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://www.sapgenie.com/abap/OO/index.htm" target="test_blank"&gt;http://www.sapgenie.com/abap/OO/index.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://help.sap.com/saphelp_erp2005/helpdata/en/ce/b518b6513611d194a50000e8353423/frameset.htm" target="test_blank"&gt;http://help.sap.com/saphelp_erp2005/helpdata/en/ce/b518b6513611d194a50000e8353423/frameset.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://www.sapgenie.com/abap/OO/" target="test_blank"&gt;http://www.sapgenie.com/abap/OO/&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;these links &lt;/P&gt;&lt;P&gt;&lt;A href="http://help.sap.com/saphelp_47x200/helpdata/en/ce/b518b6513611d194a50000e8353423/content.htm" target="test_blank"&gt;http://help.sap.com/saphelp_47x200/helpdata/en/ce/b518b6513611d194a50000e8353423/content.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For funtion module to class&lt;/P&gt;&lt;P&gt;&lt;A href="http://help.sap.com/saphelp_47x200/helpdata/en/c3/225b5954f411d194a60000e8353423/content.htm" target="test_blank"&gt;http://help.sap.com/saphelp_47x200/helpdata/en/c3/225b5954f411d194a60000e8353423/content.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;for classes&lt;/P&gt;&lt;P&gt;&lt;A href="http://help.sap.com/saphelp_47x200/helpdata/en/c3/225b5c54f411d194a60000e8353423/content.htm" target="test_blank"&gt;http://help.sap.com/saphelp_47x200/helpdata/en/c3/225b5c54f411d194a60000e8353423/content.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;for methods&lt;/P&gt;&lt;P&gt;&lt;A href="http://help.sap.com/saphelp_47x200/helpdata/en/08/d27c03b81011d194f60000e8353423/content.htm" target="test_blank"&gt;http://help.sap.com/saphelp_47x200/helpdata/en/08/d27c03b81011d194f60000e8353423/content.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;for inheritance&lt;/P&gt;&lt;P&gt;&lt;A href="http://help.sap.com/saphelp_47x200/helpdata/en/dd/4049c40f4611d3b9380000e8353423/content.htm" target="test_blank"&gt;http://help.sap.com/saphelp_47x200/helpdata/en/dd/4049c40f4611d3b9380000e8353423/content.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;for interfaces&lt;/P&gt;&lt;P&gt;&lt;A href="http://help.sap.com/saphelp_47x200/helpdata/en/c3/225b6254f411d194a60000e8353423/content.htm" target="test_blank"&gt;http://help.sap.com/saphelp_47x200/helpdata/en/c3/225b6254f411d194a60000e8353423/content.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For Materials:&lt;/P&gt;&lt;P&gt;1) &lt;A href="http://help.sap.com/printdocu/core/Print46c/en/data/pdf/BCABA/BCABA.pdf" target="test_blank"&gt;http://help.sap.com/printdocu/core/Print46c/en/data/pdf/BCABA/BCABA.pdf&lt;/A&gt; -- Page no: 1291&lt;/P&gt;&lt;P&gt;2) &lt;A href="http://esnips.com/doc/5c65b0dd-eddf-4512-8e32-ecd26735f0f2/prefinalppt.ppt" target="test_blank"&gt;http://esnips.com/doc/5c65b0dd-eddf-4512-8e32-ecd26735f0f2/prefinalppt.ppt&lt;/A&gt;&lt;/P&gt;&lt;P&gt;3) &lt;A href="http://esnips.com/doc/2c76dc57-e74a-4539-a20e-29383317e804/OO-abap.pdf" target="test_blank"&gt;http://esnips.com/doc/2c76dc57-e74a-4539-a20e-29383317e804/OO-abap.pdf&lt;/A&gt;&lt;/P&gt;&lt;P&gt;4) &lt;A href="http://esnips.com/doc/0ef39d4b-586a-4637-abbb-e4f69d2d9307/SAP-CONTROLS-WORKSHOP.pdf" target="test_blank"&gt;http://esnips.com/doc/0ef39d4b-586a-4637-abbb-e4f69d2d9307/SAP-CONTROLS-WORKSHOP.pdf&lt;/A&gt;&lt;/P&gt;&lt;P&gt;5) &lt;A href="http://esnips.com/doc/92be4457-1b6e-4061-92e5-8e4b3a6e3239/Object-Oriented-ABAP.ppt" target="test_blank"&gt;http://esnips.com/doc/92be4457-1b6e-4061-92e5-8e4b3a6e3239/Object-Oriented-ABAP.ppt&lt;/A&gt;&lt;/P&gt;&lt;P&gt;6) &lt;A href="http://esnips.com/doc/448e8302-68b1-4046-9fef-8fa8808caee0/abap-objects-by-helen.pdf" target="test_blank"&gt;http://esnips.com/doc/448e8302-68b1-4046-9fef-8fa8808caee0/abap-objects-by-helen.pdf&lt;/A&gt;&lt;/P&gt;&lt;P&gt;7) &lt;A href="http://esnips.com/doc/39fdc647-1aed-4b40-a476-4d3042b6ec28/class_builder.ppt" target="test_blank"&gt;http://esnips.com/doc/39fdc647-1aed-4b40-a476-4d3042b6ec28/class_builder.ppt&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-unicode-emoji" title=":smiling_face_with_sunglasses:"&gt;😎&lt;/span&gt; &lt;A href="http://www.amazon.com/gp/explorer/0201750805/2/ref=pd_lpo_ase/102-9378020-8749710?ie=UTF8" target="test_blank"&gt;http://www.amazon.com/gp/explorer/0201750805/2/ref=pd_lpo_ase/102-9378020-8749710?ie=UTF8&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1) &lt;A href="http://www.erpgenie.com/sap/abap/OO/index.htm" target="test_blank"&gt;http://www.erpgenie.com/sap/abap/OO/index.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;2) &lt;A href="http://help.sap.com/saphelp_nw04/helpdata/en/ce/b518b6513611d194a50000e8353423/frameset.htm" target="test_blank"&gt;http://help.sap.com/saphelp_nw04/helpdata/en/ce/b518b6513611d194a50000e8353423/frameset.htm&lt;/A&gt; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Priyanka.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 29 Jun 2007 08:59:28 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/oop-s-concept/m-p/2407112#M536617</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-06-29T08:59:28Z</dc:date>
    </item>
    <item>
      <title>Re: OOP's concept</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/oop-s-concept/m-p/2407113#M536618</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi neha&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;u just see the link&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.sap.com/www.sapgenie.com" target="test_blank"&gt;www.sapgenie.com&lt;/A&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 02 Jul 2007 11:25:53 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/oop-s-concept/m-p/2407113#M536618</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-07-02T11:25:53Z</dc:date>
    </item>
    <item>
      <title>Re: OOP's concept</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/oop-s-concept/m-p/2407114#M536619</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Neha,&lt;/P&gt;&lt;P&gt;Check with the below links for OOPs concept in ABAP.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://en.wikipedia.org/wiki/ABAP" target="test_blank"&gt;http://en.wikipedia.org/wiki/ABAP&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://help.sap.com/saphelp_nw04/helpdata/en/c3/225b5654f411d194a60000e8353423/content.htm" target="test_blank"&gt;http://help.sap.com/saphelp_nw04/helpdata/en/c3/225b5654f411d194a60000e8353423/content.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Reward if useful.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;All the best.&lt;/P&gt;&lt;P&gt;Sayee&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 03 Jul 2007 03:44:33 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/oop-s-concept/m-p/2407114#M536619</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-07-03T03:44:33Z</dc:date>
    </item>
    <item>
      <title>Re: OOP's concept</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/oop-s-concept/m-p/2407115#M536620</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Object&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; Just as procedures used to build structured programs, objects are used to build Object Oriented Programs. An Object Oriented Program is a collection of objects that are organized for, and cooperate toward, the accomplishment of some goal. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In general every Object:&lt;/P&gt;&lt;P&gt;&amp;#149;	Contains Data. The data stores information that describes the state of the object.&lt;/P&gt;&lt;P&gt;&amp;#149;	Has a set of defined behaviors. These behaviors are the things that the object  &amp;#147;knows&amp;#148; how to do and are triggered by sending the object a message&lt;/P&gt;&lt;P&gt;&amp;#149;	Has an Individual identity. This makes it possible to distinguish an object from another, just as it&amp;#146;s possible to distinguish one program variable from another.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Everything is an Object&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;#149;	Everything is an object. Think of an object as a fancy variable; it stores data, but you can also ask it to perform operations on itself by making requests. In theory, you can take any conceptual component in the problem you&amp;#146;re trying to solve (dogs, buildings, services, etc.) and represent it as an object in your program. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;#149;	A program is a bunch of objects telling each other what to do by sending messages. To make a request of an object, you &amp;#147;send a message&amp;#148; to that object. More concretely, you can think of a message as a request to call a function that belongs to a particular object.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;#149;	Each object has its own memory made up of other objects. Or, you make a new kind of object by making a package containing existing objects. Thus, you can build up complexity in a program while hiding it behind the simplicity of objects.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;#149;	Every object has a type. Using the parlance, each object is an instance of a class, where &amp;#147;class&amp;#148; is synonymous with &amp;#147;type.&amp;#148; The most important distinguishing characteristic of a class is &amp;#147;what messages can you send to it?&amp;#148;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;#149;	All objects of a particular type can receive the same messages. This is actually a very loaded statement, as you will see later. Because an object of type circle is also an object of type shape, a circle is guaranteed to receive shape messages. This means you can write code that talks to shapes and automatically handle anything that fits the description of a shape. &lt;/P&gt;&lt;P&gt;This substitutability is one of the most powerful concepts in OOP.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Some language designers have decided that object-oriented programming itself is not adequate to easily solve all programming problems, and advocate the combination of various approaches into multiparadigm programming languages.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;An object has an interface. Aristotle was probably the first to begin a careful study of the concept of type. He was known to speak of &amp;#147;the class of fishes and the class of birds.&amp;#148; The concept that all objects, while being unique, are also part of a set of objects those have characteristics and behaviors in Common was directly used in the first object-oriented language, Simula, with its fundamental keyword class that introduces a new type into a program (thus class and type often used synonymously).&lt;/P&gt;&lt;P&gt;Simula, as its name implies, was created for developing simulations such as the classic &amp;#147;bank teller problem.&amp;#148; In this, you have a bunch of tellers, customers, accounts, transactions, etc.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The members (elements) of each class share some commonality: every account has a balance, every teller can accept a deposit, etc. At the same time, each member has its own state; each account has a different balance, each teller has a name. Thus the tellers, customers, accounts, transactions, etc. can each be represented with a unique entity in the computer program. This entity is the object, and each object belongs to a particular class that defines its characteristics and behaviors.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So, although what we really do in object-oriented programming is create new data types, virtually all object-oriented programming languages use the &amp;#147;class&amp;#148; keyword. When you see the word &amp;#147;type&amp;#148; think &amp;#147;class&amp;#148; and vice versa.&lt;/P&gt;&lt;P&gt;Some people make a distinction, stating that type determines the interface while class is a particular implementation of that interface. Once a type is established; you can make as many objects of that type as you like, and then manipulate those objects as the elements that exist in the problem you are trying to solve.&lt;/P&gt;&lt;P&gt;Indeed, one of the challenges of object-oriented programming is to create a one-to-one mapping between the elements in the problem space (the place where the problem actually exists) and the solution space (the place where you&amp;#146;re modeling that problem, such as a computer).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But how do you get an object to do useful work? &lt;/P&gt;&lt;P&gt;There must be a way to make a request of that object so it will do something, such as complete a transaction, draw something on the screen or turn on a switch. And each object can satisfy only certain requests. The requests you can make of an object are defined by its interface, and the type is what determines the interface. The idea of type being equivalent to interface is fundamental in object-oriented programming. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; Class&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Classes are the central element of object-orientation.&lt;/P&gt;&lt;P&gt;A Class describes a general element or a general concept, for example the abstract concepts Business Partner, Material, Transaction, Equipment or List. Classes realize an abstract data type.&lt;/P&gt;&lt;P&gt;Classes contain components: Attributes, Methods and Events.&lt;/P&gt;&lt;P&gt;Classes are templates for objects. You can either define a class locally in an ABAP program, or globally in the class library using the Class Builder tool in the ABAP Workbench. The class library is part of the R/3 repository. Class library classes are stored in special programs called class pools. A class pool is automatically generated for each global class that you create with the Class Builder. The Class Builder also generates the coding frame that defines the classes in the class pool. Global classes are visible to all ABAP programs of the R/3 System. &lt;/P&gt;&lt;P&gt;To define local classes in an ABAP program, such as a report or a function group, you must type the corresponding statements manually into the program. A local class is visible only inside the program in which it is defined. &lt;/P&gt;&lt;P&gt;The data, or variables defined within a Class are called instance variables. The code is contained within methods. Collectively, the methods and variables defined within a class are called members of the class. Thus, it is the methods that determine how a class&amp;#146;s data can be used.&lt;/P&gt;&lt;P&gt;Variables defined within a class are called instance variables because each instance of the class ( that is , each object of the class ) contains its own copy of these variables. Thus, the data for one object is separate and unique from the data for another.&lt;/P&gt;&lt;P&gt;More importantly &amp;#147; You will never actually write the code for an Object: What you write is the pattern that is used to make objects &amp;#148;&lt;/P&gt;&lt;P&gt;In ABAP Classes are defined between the CLASS and ENDCLASS statements. A class definition consists of a declaration part, in which the components are defined, and an implementation part, in which the methods are implemented. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
CLASS c_user DEFINITION.
  		PUBLIC SECTION.
		    CLASS-DATA: instance_count type i.
		     DATA: id type i.
		     METHODS:  CONSTRUCTOR,
		                      display,
             	           get_user RETURNING value(p_user)  like sy-uname.
		PRIVATE SECTION.
		      DATA:  a_user like sy-uname.
ENDCLASS.

CLASS c_user IMPLEMENTATION.
		  METHOD CONSTRUCTOR.
			      a_user = sy-uname.
		  ENDMETHOD.
		  METHOD display.
		      WRITE :/ a_user, id, instance_count.
		  ENDMETHOD.
		  METHOD get_user.
			p_user = a_user.
		 ENDMETHOD.
ENDCLASS.


 Class components
  Possible class components are attributes, methods and events. 
&amp;#149;	Attributes
They are the internal data variables within a class. They can have any ABAP data type. We distinguish between instance attributes and static attributes. Instance attributes are declared by DATA and determine the state of an instance. You cannot work with instance attributes without creating an object first. Static attributes are declared by CLASS-DATA and determine the state of a class, which in a way applies to all instances. Static attributes form a data set that is shared by the whole class and all of its objects. You do not need to create an object to work with static attributes. 
&amp;#149;	Methods
They are the class&amp;#146; procedures. They can access all class attributes and can therefore change the state of an object. They have a parameter interface similar to the interface of function modules. They can have named IMPORTING, EXPORTING, and CHANGING parameters, which can be optional or required and can be passed either by reference or by value. As with attributes, we distinguish between instance methods and static methods. Instance methods are declared by METHODS and can access all the attributes of a class. Static methods are declared by CLASS-METHODS and can only access the static attributes of a class. 
Implementing Methods

You must implement all of the methods in a class in the implementation part of the class in a 

METHOD &amp;lt;meth&amp;gt;.
 ...
ENDMETHOD. 

block. When you implement the method, you do not have to specify any interface parameters, since these are defined in the method declaration. The interface parameters of a method behave like local variables within the method implementation. You can define additional local variables within a method using the DATA statement. 
As in function modules, you can use the RAISE &amp;lt;exception&amp;gt; and MESSAGE RAISING statements to handle error situations.
When you implement a static method, remember that it can only work with the static attributes of your class. Instance methods can work with both static and instance attributes. 

Calling Methods

To call a method, use the following statement: 

CALL METHOD &amp;lt;meth&amp;gt; EXPORTING... &amp;lt;ii&amp;gt; =.&amp;lt;f i&amp;gt;... 
                   IMPORTING... &amp;lt;ei&amp;gt; =.&amp;lt;g i&amp;gt;... 
                   CHANGING ... &amp;lt;ci&amp;gt; =.&amp;lt;f i&amp;gt;... 
                   RECEIVING         r = h 
                   EXCEPTIONS... &amp;lt;ei&amp;gt; = rc i...

The way in which you address the method &amp;lt;method&amp;gt; depends on the method itself and from where you are calling it. Within the implementation part of a class, you can call the methods of the same class directly using their name &amp;lt;meth&amp;gt;.


CALL METHOD &amp;lt;meth&amp;gt;...

Outside the class, the visibility of the method depends on whether you can call it at all. Visible instance methods can be called from outside the class using

CALL METHOD &amp;lt;ref&amp;gt;-&amp;gt;&amp;lt;meth&amp;gt;...

where &amp;lt;ref&amp;gt; is a reference variable whose value points to an instance of the class. Visible instance methods can be called from outside the class using

CALL METHOD &amp;lt;class&amp;gt;=&amp;gt;&amp;lt;meth&amp;gt;...

where &amp;lt;class&amp;gt; is the name of the relevant class.
When you call a method, you must pass all non-optional input parameters using the EXPORTING or CHANGING addition in the CALL METHOD statement. You can (but do not have to) import the output parameters into your program using the IMPORTING or RECEIVING addition. Equally, you can (but do not have to) handle any exceptions triggered by the exceptions using the EXCEPTIONS addition. However, this is recommended.
You pass and receive values to and from methods in the same way as with function modules, that is, with the syntax: 

... &amp;lt;Formal parameter&amp;gt; = &amp;lt;Actual parameter&amp;gt;

after the corresponding addition. The interface parameters (formal parameters) are always on the left-hand side of the equals sign. The actual parameters are always on the right. The equals sign is not an assignment operator in this context; it merely serves to assign program variables to the interface parameters of the method. 
If the interface of a method consists only of a single IMPORTING parameter, you can use the following shortened form of the method call:

CALL METHOD &amp;lt;method&amp;gt;( f).

The actual parameter &amp;lt;f&amp;gt; is passed to the input parameters of the method. 
If the interface of a method consists only of IMPORTING parameters, you can use the following shortened form of the method call:

CALL METHOD &amp;lt;method&amp;gt;(....&amp;lt;ii&amp;gt; =.&amp;lt;f i&amp;gt;...)
.
Each actual parameter &amp;lt;f i &amp;gt; is passed to the corresponding 
formal parameter &amp;lt;i i &amp;gt;.

&amp;#149;	Events and Event Handlers  

As earlier told ABAP supports object oriented features and also in addition to  those features, ABAP supports Event handler methods.
So our primary question would be 




Event Handler Methods
 
Before we step into Event Handler Methods, it is very important to understand and know how methods work in ABAP.
Event handler methods are special methods that cannot all be called using the CALL METHOD statement. Instead, they are triggered using events. You define a method as an event handler method using the addition
... FOR EVENT &amp;lt;evt&amp;gt; OF &amp;lt;cif&amp;gt;...
in the METHODS or CLASS-METHODS statement. 
The following special rules apply to the interface of an event handler method: 
o	The interface may only consist of IMPORTING parameters. 
o	Each IMPORTING parameter must be an EXPORTING parameter of the event &amp;lt;evt&amp;gt;. 
o	The attributes of the parameters are defined in the declaration of the event &amp;lt;evt&amp;gt; (EVENTS statement) and are adopted by the event handler method. 


&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 03 Jul 2007 06:19:51 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/oop-s-concept/m-p/2407115#M536620</guid>
      <dc:creator>selvakumar_mohan</dc:creator>
      <dc:date>2007-07-03T06:19:51Z</dc:date>
    </item>
    <item>
      <title>Re: OOP's concept</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/oop-s-concept/m-p/2407116#M536621</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;seee the links below...&lt;/P&gt;&lt;P&gt;1) &lt;A href="http://help.sap.com/printdocu/core/Print46c/en/data/pdf/BCABA/BCABA.pdf" target="test_blank"&gt;http://help.sap.com/printdocu/core/Print46c/en/data/pdf/BCABA/BCABA.pdf&lt;/A&gt; -- Page no: 1291&lt;/P&gt;&lt;P&gt;2) &lt;A href="http://esnips.com/doc/5c65b0dd-eddf-4512-8e32-ecd26735f0f2/prefinalppt.ppt" target="test_blank"&gt;http://esnips.com/doc/5c65b0dd-eddf-4512-8e32-ecd26735f0f2/prefinalppt.ppt&lt;/A&gt;&lt;/P&gt;&lt;P&gt;3) &lt;A href="http://esnips.com/doc/2c76dc57-e74a-4539-a20e-29383317e804/OO-abap.pdf" target="test_blank"&gt;http://esnips.com/doc/2c76dc57-e74a-4539-a20e-29383317e804/OO-abap.pdf&lt;/A&gt;&lt;/P&gt;&lt;P&gt;4) &lt;A href="http://esnips.com/doc/0ef39d4b-586a-4637-abbb-e4f69d2d9307/SAP-CONTROLS-WORKSHOP.pdf" target="test_blank"&gt;http://esnips.com/doc/0ef39d4b-586a-4637-abbb-e4f69d2d9307/SAP-CONTROLS-WORKSHOP.pdf&lt;/A&gt;&lt;/P&gt;&lt;P&gt;5) &lt;A href="http://esnips.com/doc/92be4457-1b6e-4061-92e5-8e4b3a6e3239/Object-Oriented-ABAP.ppt" target="test_blank"&gt;http://esnips.com/doc/92be4457-1b6e-4061-92e5-8e4b3a6e3239/Object-Oriented-ABAP.ppt&lt;/A&gt;&lt;/P&gt;&lt;P&gt;6) &lt;A href="http://esnips.com/doc/448e8302-68b1-4046-9fef-8fa8808caee0/abap-objects-by-helen.pdf" target="test_blank"&gt;http://esnips.com/doc/448e8302-68b1-4046-9fef-8fa8808caee0/abap-objects-by-helen.pdf&lt;/A&gt;&lt;/P&gt;&lt;P&gt;7) &lt;A href="http://esnips.com/doc/39fdc647-1aed-4b40-a476-4d3042b6ec28/class_builder.ppt" target="test_blank"&gt;http://esnips.com/doc/39fdc647-1aed-4b40-a476-4d3042b6ec28/class_builder.ppt&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-unicode-emoji" title=":smiling_face_with_sunglasses:"&gt;😎&lt;/span&gt; &lt;A href="http://www.amazon.com/gp/explorer/0201750805/2/ref=pd_lpo_ase/102-9378020-8749710?ie=UTF8" target="test_blank"&gt;http://www.amazon.com/gp/explorer/0201750805/2/ref=pd_lpo_ase/102-9378020-8749710?ie=UTF8&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1) &lt;A href="http://www.erpgenie.com/sap/abap/OO/index.htm" target="test_blank"&gt;http://www.erpgenie.com/sap/abap/OO/index.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;2) &lt;A href="http://help.sap.com/saphelp_nw04/helpdata/en/ce/b518b6513611d194a50000e8353423/frameset.htm" target="test_blank"&gt;http://help.sap.com/saphelp_nw04/helpdata/en/ce/b518b6513611d194a50000e8353423/frameset.htm&lt;/A&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 03 Jul 2007 10:48:04 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/oop-s-concept/m-p/2407116#M536621</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-07-03T10:48:04Z</dc:date>
    </item>
    <item>
      <title>Re: OOP's concept</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/oop-s-concept/m-p/2407117#M536622</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi neha&lt;/P&gt;&lt;P&gt;  the foolowing document clearly shown the dif between class,method and interface&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;B&gt;&lt;/B&gt;&lt;/P&gt;&lt;P&gt;class&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;CLASS C1 DEFINITION.
PUBLIC SECTION.
METHODS:
EVENTS:
PROTECTED SECTION.
DATA:
METHODS:
EVENTS:
PRIVATE SECTION.
DATA:
METHODS:
EVENTS:
ENDCLASS.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;  Classes are the templates for objects&lt;/P&gt;&lt;P&gt;  A class definition declares&lt;/P&gt;&lt;P&gt;&amp;#150; Its components: Attributes, Methods, Events&lt;/P&gt;&lt;P&gt;&amp;#150; The visibility of its components: Public, Protected,&lt;/P&gt;&lt;P&gt;Private&lt;/P&gt;&lt;P&gt;  The public components form the external&lt;/P&gt;&lt;P&gt;interface of the class &amp;#150; they are visible to all&lt;/P&gt;&lt;P&gt;users of the class as well as to methods within&lt;/P&gt;&lt;P&gt;the class and to methods of subclasses*&lt;/P&gt;&lt;P&gt;  Protected components form the interface of the&lt;/P&gt;&lt;P&gt;class to its subclasses* &amp;#150; they are visible to&lt;/P&gt;&lt;P&gt;methods of the heirs of the class as well as to&lt;/P&gt;&lt;P&gt;methods within the class&lt;/P&gt;&lt;P&gt;  Private components can only be used in the&lt;/P&gt;&lt;P&gt;methods of the class itself&lt;/P&gt;&lt;P&gt;programs within the main program&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;B&gt;&lt;/B&gt;&lt;/P&gt;&lt;P&gt;Method&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;CLASS c1 DEFINITION.
PUBLIC SECTION.
METHODS:
do_something
IMPORTING &amp;#133; i1 TYPE &amp;#133;
EXPORTING &amp;#133; e1 TYPE &amp;#133;
CHANGING &amp;#133; c1 TYPE &amp;#133;
EXCEPTIONS &amp;#133; e1.
PRIVATE SECTION.
DATA:
ENDCLASS.
CLASS c1 IMPLEMENTATION.
METHOD do_something
&amp;#133;
ENDMETHOD.
ENDCLASS.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Methods are processing blocks with a parameter&lt;/P&gt;&lt;P&gt;interface very similar to function modules&lt;/P&gt;&lt;P&gt;&amp;#150; With function modules, you should type each&lt;/P&gt;&lt;P&gt;parameter but are not forced to; with methods, you&lt;/P&gt;&lt;P&gt;must type each parameter&lt;/P&gt;&lt;P&gt;  Methods are declared, with their parameter&lt;/P&gt;&lt;P&gt;interface, in the class definition part and&lt;/P&gt;&lt;P&gt;implemented in the class implementation part&lt;/P&gt;&lt;P&gt;&amp;#150; Notice that the method&amp;#146;s parameter interface is not&lt;/P&gt;&lt;P&gt;restated in the implementation part.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;B&gt;&lt;/B&gt;&lt;/P&gt;&lt;P&gt;Instance and static&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;CLASS c1 DEFINITION.
PUBLIC SECTION.
DATA:
CLASS-DATA:
CONSTANTS:
METHODS:
CLASS-METHODS:
EVENTS:
CLASS-EVENTS:
PRIVATE SECTION.
DATA:
ENDCLASS.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;  Instance components exist separately in each&lt;/P&gt;&lt;P&gt;instance (object) of the class&lt;/P&gt;&lt;P&gt;  Static components only exist once per class and&lt;/P&gt;&lt;P&gt;are valid for all instances of the class&lt;/P&gt;&lt;P&gt;  Static components are declared with the CLASS-&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;keywords&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;  Static components can be used without even&lt;/P&gt;&lt;P&gt;creating an instance of the class&lt;/P&gt;&lt;P&gt;  Static methods can only access static attributes&lt;/P&gt;&lt;P&gt;of their class&lt;/P&gt;&lt;P&gt;  Constants cannot be modified during compile&lt;/P&gt;&lt;P&gt;time or runtime and hence are somewhat like&lt;/P&gt;&lt;P&gt;static attributes&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Cheers&lt;/P&gt;&lt;P&gt;Srinu&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 03 Jul 2007 12:44:16 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/oop-s-concept/m-p/2407117#M536622</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-07-03T12:44:16Z</dc:date>
    </item>
    <item>
      <title>Re: OOP's concept</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/oop-s-concept/m-p/2407118#M536623</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;&amp;#149;	Calling a ststic attribute using CALL METHOD &lt;/P&gt;&lt;P&gt;&amp;#149;	Registering a static event handler &lt;/P&gt;&lt;P&gt;&amp;#149;	Registering an evetm handler method for a static event&lt;/P&gt;&lt;P&gt;The static constructor cannot be called explicitly.&lt;/P&gt;&lt;P&gt;Protected components&lt;/P&gt;&lt;P&gt;When we are talking subclassing and enheritance there is one more component than Public and Private, the Protected component. Protected components can be used by the superclass and all of the subclasses. Note that Subclasses cannot access Private components.&lt;/P&gt;&lt;P&gt;Polymorphism&lt;/P&gt;&lt;P&gt;Polymorphism: When the same method is implemented differently in different classes. This can be done using enheritance, by redefining a method from the superclass in subclasses and implement it differently.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Template for making a class&lt;/P&gt;&lt;P&gt;Delete the parts that should not be used&lt;/P&gt;&lt;P&gt;******************************************&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Definition part&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;******************************************&lt;/P&gt;&lt;P&gt;CLASS xxx DEFINITION.&lt;/P&gt;&lt;P&gt;*----&lt;/P&gt;&lt;P&gt;-&lt;/P&gt;&lt;HR originaltext="------------------------" /&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Public section&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;*----&lt;/P&gt;&lt;P&gt;-&lt;/P&gt;&lt;HR originaltext="------------------------" /&gt;&lt;P&gt;  PUBLIC SECTION.&lt;/P&gt;&lt;P&gt;    TYPES:&lt;/P&gt;&lt;P&gt;    DATA: &lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;  Static data&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;    CLASS-DATA:&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;  Methods&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;    METHODS:&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;    Using the constructor to initialize parameters&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;       constructor    IMPORTING xxx type yyy,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;    Method with parameters&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;      mm1 IMPORTING iii   TYPE ttt.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;    Method without parameters&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;      mm2.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;  Static methods&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;    CLASS-METHODS:  &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*----&lt;/P&gt;&lt;HR originaltext="---------------------------------------------" /&gt;&lt;P&gt;*&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Protected section. Also accessable by subclasses&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;*----&lt;/P&gt;&lt;P&gt;-&lt;/P&gt;&lt;HR originaltext="---------------------------------------------" /&gt;&lt;P&gt;  PROTECTED SECTION.&lt;/P&gt;&lt;P&gt;*----&lt;/P&gt;&lt;P&gt;-&lt;/P&gt;&lt;HR originaltext="---------------------------------------------" /&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Private section. Not accessable by subclasses&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;*----&lt;/P&gt;&lt;P&gt;-&lt;/P&gt;&lt;HR originaltext="---------------------------------------------" /&gt;&lt;P&gt;  PRIVATE SECTION.&lt;/P&gt;&lt;P&gt;ENDCLASS.&lt;/P&gt;&lt;P&gt;******************************************&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Implementation part&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;******************************************&lt;/P&gt;&lt;P&gt;CLASS lcl_airplane IMPLEMENTATION.&lt;/P&gt;&lt;P&gt;  METHOD constructor.&lt;/P&gt;&lt;P&gt;  ENDMETHOD.&lt;/P&gt;&lt;P&gt;  METHOD mm1.&lt;/P&gt;&lt;P&gt;  ENDMETHOD.&lt;/P&gt;&lt;P&gt;  METHOD mm2.&lt;/P&gt;&lt;P&gt;  ENDMETHOD.&lt;/P&gt;&lt;P&gt;ENDCLASS.&lt;/P&gt;&lt;P&gt;Template for calling a class&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Create reference to class lcl_airplane&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;DATA: airplane1 TYPE REF TO lcl_airplane.&lt;/P&gt;&lt;P&gt;START-OF-SELECTION.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Create instance using parameters in the cosntructor method&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;  CREATE OBJECT airplane1 exporting im_name = 'Hansemand'&lt;/P&gt;&lt;P&gt;                                    im_planetype = 'Boing 747'.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt; Calling a method with parameters&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;  CALL METHOD: airplane1-&amp;gt;display_n_o_airplanes,&lt;/P&gt;&lt;P&gt;               airplane1-&amp;gt;display_attributes.&lt;/P&gt;&lt;P&gt;Subclass&lt;/P&gt;&lt;P&gt;CLASS xxx DEFINITION INHERITING FROM yyy.&lt;/P&gt;&lt;P&gt;Using af class as a parameter for a method&lt;/P&gt;&lt;P&gt;The class LCL_AIRPLANE is used as a parameter for method add_a_new_airplane:&lt;/P&gt;&lt;P&gt;METHODS:&lt;/P&gt;&lt;P&gt;  add_a_new_airplane importing im_airplane TYPE REF to lcl_airplane.&lt;/P&gt;&lt;P&gt;Interfaces&lt;/P&gt;&lt;P&gt;In ABAP interfaces are implemented in addition to, and independently of classes. An interface only has a declaration part, &lt;/P&gt;&lt;P&gt;and do not have visibility sections. Components (Attributes, methods, constants, types) can be defined the same way as in classes.&lt;/P&gt;&lt;P&gt;&amp;#149;                Interfaces are listed in the definition part lof the class, and must always be in the PUBLIC SECTION.&lt;/P&gt;&lt;P&gt;&amp;#149;                Operations defined in the interface atre impemented as methods of the class. All methods of the interface&lt;/P&gt;&lt;P&gt;must be present in the  implementation part of the class.&lt;/P&gt;&lt;P&gt;&amp;#149;                Attributes, events, constants and types defined in the interface are automatically available to the class &lt;/P&gt;&lt;P&gt;carrying out the implementation.&lt;/P&gt;&lt;P&gt;&amp;#149;                Interface components are addressed in the class by ]&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Define, implement and use simple class | Use constructor to create an object with parameters | Subclassing | Polymorphism | Events&lt;/P&gt;&lt;P&gt; Define, implement and use simple class&lt;/P&gt;&lt;P&gt;***INCLUDE ZBC404_HF_LCL_AIRPLANE .&lt;/P&gt;&lt;P&gt;******************************************&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Definition part&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;******************************************&lt;/P&gt;&lt;P&gt;CLASS lcl_airplane DEFINITION.&lt;/P&gt;&lt;P&gt;*----&lt;/P&gt;&lt;P&gt;-&lt;/P&gt;&lt;HR originaltext="------------------------" /&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Public section&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;*----&lt;/P&gt;&lt;P&gt;-&lt;/P&gt;&lt;HR originaltext="------------------------" /&gt;&lt;P&gt;  PUBLIC SECTION.&lt;/P&gt;&lt;P&gt;    TYPES: t_name(25) TYPE c.&lt;/P&gt;&lt;P&gt;    METHODS:&lt;/P&gt;&lt;P&gt;     constructor,&lt;/P&gt;&lt;P&gt;     set_attributes IMPORTING p_name       TYPE t_name&lt;/P&gt;&lt;P&gt;                              p_planetype  TYPE saplane-planetype,&lt;/P&gt;&lt;P&gt;      display_attributes,&lt;/P&gt;&lt;P&gt;      display_n_o_airplanes.&lt;/P&gt;&lt;P&gt;*----&lt;/P&gt;&lt;P&gt;-&lt;/P&gt;&lt;HR originaltext="------------------------" /&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Private section&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;*----&lt;/P&gt;&lt;P&gt;-&lt;/P&gt;&lt;HR originaltext="------------------------" /&gt;&lt;P&gt;  PRIVATE SECTION.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;  Private attributes&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;    DATA: name(25) TYPE c,&lt;/P&gt;&lt;P&gt;          planetype TYPE saplane-planetype.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;  Private static attribute&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;    CLASS-DATA n_o_airplanes TYPE i.&lt;/P&gt;&lt;P&gt;ENDCLASS.&lt;/P&gt;&lt;P&gt;******************************************&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Implementation part&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;******************************************&lt;/P&gt;&lt;P&gt;CLASS lcl_airplane IMPLEMENTATION.&lt;/P&gt;&lt;P&gt;  METHOD constructor.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;  Counts number of instances&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;    n_o_airplanes = n_o_airplanes + 1.&lt;/P&gt;&lt;P&gt;  ENDMETHOD.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;  METHOD set_attributes.&lt;/P&gt;&lt;P&gt;    name      = p_name.&lt;/P&gt;&lt;P&gt;    planetype = p_planetype.&lt;/P&gt;&lt;P&gt;  ENDMETHOD.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;  METHOD display_attributes.&lt;/P&gt;&lt;P&gt;    WRITE:/ 'Name:', name, 'Planetype:', planetype.&lt;/P&gt;&lt;P&gt;  ENDMETHOD.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;  METHOD display_n_o_airplanes.&lt;/P&gt;&lt;P&gt;    WRITE: / 'No. planes:', n_o_airplanes.&lt;/P&gt;&lt;P&gt;  ENDMETHOD.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;ENDCLASS.&lt;/P&gt;&lt;P&gt;REPORT zbc404_hf_maintain_airplanes .&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;INCLUDE zbc404_hf_lcl_airplane.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Create reference to class lcl_airplane&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;DATA: airplane1 TYPE REF TO lcl_airplane,&lt;/P&gt;&lt;P&gt;      airplane2 TYPE REF TO lcl_airplane.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;START-OF-SELECTION.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Create instance&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;  CREATE OBJECT airplane1.&lt;/P&gt;&lt;P&gt;  CALL METHOD: airplane1-&amp;gt;display_n_o_airplanes.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;  CREATE OBJECT airplane2.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Setting attributes using a method with parameters&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;  CALL METHOD airplane1-&amp;gt;set_attributes EXPORTING p_name      = 'Kurt'&lt;/P&gt;&lt;P&gt;                                                  p_planetype = 'MD80'.&lt;/P&gt;&lt;P&gt;END-OF-SELECTION.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Using methods &lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;  CALL METHOD: airplane1-&amp;gt;display_n_o_airplanes,&lt;/P&gt;&lt;P&gt;               airplane1-&amp;gt;display_attributes.  &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The resulting report:&lt;/P&gt;&lt;P&gt;Maintain airplanes                                     &lt;/P&gt;&lt;P&gt;No. planes:          1                                 &lt;/P&gt;&lt;P&gt;No. planes:          2                                 &lt;/P&gt;&lt;P&gt;Name: Kurt                      Planetype: MD80        &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Use constructor to create an object with parameters&lt;/P&gt;&lt;P&gt;CLASS lcl_airplane DEFINITION.&lt;/P&gt;&lt;P&gt;  PUBLIC SECTION.&lt;/P&gt;&lt;P&gt;    TYPES: t_name(25) TYPE c.&lt;/P&gt;&lt;P&gt;METHODS:&lt;/P&gt;&lt;P&gt;      constructor    importing p2_name      type t_name&lt;/P&gt;&lt;P&gt;                               p2_planetype  TYPE saplane-planetype,&lt;/P&gt;&lt;P&gt;..... more code .......&lt;/P&gt;&lt;P&gt;CLASS lcl_airplane IMPLEMENTATION.&lt;/P&gt;&lt;P&gt;  METHOD constructor.&lt;/P&gt;&lt;P&gt;    name      = p2_name.&lt;/P&gt;&lt;P&gt;    planetype = p2_planetype.&lt;/P&gt;&lt;P&gt;..... more code .......&lt;/P&gt;&lt;P&gt;START-OF-SELECTION.&lt;/P&gt;&lt;P&gt;  CREATE OBJECT airplane1 exporting p2_name = 'Hansemand'&lt;/P&gt;&lt;P&gt;                                    p2_planetype = 'Boing 747'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Subclassing&lt;/P&gt;&lt;P&gt;This example uses a superclass LCL_AIRPLANE and subclasses it into LCL_PASSENGER_AIRPLANE and LCL_CARGO_PLANE.&lt;/P&gt;&lt;P&gt;LCL_AIRPLANE has a method display_n_o_airplanes that displays the number of object instances.&lt;/P&gt;&lt;P&gt;LCL_PASSENGER_AIRPLANE has the private instance attribute n_o_seats, and redefines the superclass method display_attributes, &lt;/P&gt;&lt;P&gt;so it also displays n_o_seats.&lt;/P&gt;&lt;P&gt;LCL_CARGO_PLANE has the private instance attribute cargomax, and redefines the superclass method&lt;/P&gt;&lt;P&gt; display_attributes, so it also displays cargomax.&lt;/P&gt;&lt;P&gt;All instance attributes are provided by the cunstructor method.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Superclass LCL_AIRPLANE&lt;/P&gt;&lt;P&gt;***INCLUDE ZBC404_HF_LCL_AIRPLANE .&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;******************************************&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Definition part&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;******************************************&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CLASS lcl_airplane DEFINITION.&lt;/P&gt;&lt;P&gt;*----&lt;/P&gt;&lt;P&gt;-&lt;/P&gt;&lt;HR originaltext="------------------------" /&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Public section&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;*----&lt;/P&gt;&lt;P&gt;-&lt;/P&gt;&lt;HR originaltext="------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  PUBLIC SECTION.&lt;/P&gt;&lt;P&gt;    TYPES: t_name(25) TYPE c.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    METHODS:&lt;/P&gt;&lt;P&gt;      constructor    IMPORTING im_name      TYPE t_name&lt;/P&gt;&lt;P&gt;                               im_planetype  TYPE saplane-planetype,&lt;/P&gt;&lt;P&gt;      display_attributes.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;  Static methods&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;    CLASS-METHODS:&lt;/P&gt;&lt;P&gt;      display_n_o_airplanes.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;*----&lt;/P&gt;&lt;P&gt;-&lt;/P&gt;&lt;HR originaltext="------------------------" /&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Protected section&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;*----&lt;/P&gt;&lt;P&gt;-&lt;/P&gt;&lt;HR originaltext="------------------------" /&gt;&lt;P&gt;  PROTECTED SECTION.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;  Private attributes&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;    DATA: name(25) TYPE c,&lt;/P&gt;&lt;P&gt;          planetype TYPE saplane-planetype.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;  Private static attribute&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;    CLASS-DATA n_o_airplanes TYPE i.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ENDCLASS.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;******************************************&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Implementation part&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;******************************************&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CLASS lcl_airplane IMPLEMENTATION.&lt;/P&gt;&lt;P&gt;  METHOD constructor.&lt;/P&gt;&lt;P&gt;    name      = im_name.&lt;/P&gt;&lt;P&gt;    planetype = im_planetype.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;  Counts number of instances&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;    n_o_airplanes = n_o_airplanes + 1.&lt;/P&gt;&lt;P&gt;  ENDMETHOD.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;  METHOD display_attributes.&lt;/P&gt;&lt;P&gt;    WRITE:/ 'Name:', name, 'Planetype:', planetype.&lt;/P&gt;&lt;P&gt;  ENDMETHOD.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;  METHOD display_n_o_airplanes.&lt;/P&gt;&lt;P&gt;    WRITE: / 'No. planes:', n_o_airplanes.&lt;/P&gt;&lt;P&gt;  ENDMETHOD.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;ENDCLASS.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Sub class LCL_PASSENGER_AIRPLANE&lt;/P&gt;&lt;P&gt;***INCLUDE ZBC404_HF_LCL_PASSENGER_PLANE .&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;*******************************************************************&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;This is a subclass of class lcl_airplane&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;*******************************************************************&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CLASS lcl_passenger_airplane DEFINITION INHERITING FROM lcl_airplane.&lt;/P&gt;&lt;P&gt;  PUBLIC SECTION.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;  The constructor contains the parameters from the superclass&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;  plus the parameters from the subclass&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    METHODS:&lt;/P&gt;&lt;P&gt;      constructor IMPORTING im_name      TYPE t_name&lt;/P&gt;&lt;P&gt;                            im_planetype TYPE saplane-planetype&lt;/P&gt;&lt;P&gt;                            im_n_o_seats TYPE sflight-seatsmax,&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;    Redefinition of superclass method display_attributes&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;      display_attributes REDEFINITION.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  PRIVATE SECTION.&lt;/P&gt;&lt;P&gt;    DATA: n_o_seats TYPE sflight-seatsmax.&lt;/P&gt;&lt;P&gt;ENDCLASS.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;CLASS lcl_passenger_airplane IMPLEMENTATION.&lt;/P&gt;&lt;P&gt;  METHOD constructor.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;  The constructor method of the superclass MUST be called withing the&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;  construtor&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;    CALL METHOD super-&amp;gt;constructor&lt;/P&gt;&lt;P&gt;                          EXPORTING im_name      = im_name&lt;/P&gt;&lt;P&gt;                                    im_planetype = im_planetype.&lt;/P&gt;&lt;P&gt;    n_o_seats = im_n_o_seats.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  ENDMETHOD.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;  The redefined  display_attributes method&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;  METHOD display_attributes.&lt;/P&gt;&lt;P&gt;    CALL METHOD super-&amp;gt;display_attributes.&lt;/P&gt;&lt;P&gt;    WRITE: / 'No. seats:', n_o_seats.&lt;/P&gt;&lt;P&gt;  ENDMETHOD.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ENDCLASS.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Sub class LCL_CARGO_PLANE&lt;/P&gt;&lt;P&gt;***INCLUDE ZBC404_HF_LCL_CARGO_PLANE .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*******************************************************************&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;This is a subclass of class lcl_airplane&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;*******************************************************************&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CLASS lcl_cargo_plane DEFINITION INHERITING FROM lcl_airplane.&lt;/P&gt;&lt;P&gt;  PUBLIC SECTION.&lt;/P&gt;&lt;P&gt;    METHODS:&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;    The constructor contains the parameters from the superclass&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;    plus the parameters from the subclass&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;      constructor IMPORTING im_name      TYPE t_name&lt;/P&gt;&lt;P&gt;                            im_planetype TYPE saplane-planetype&lt;/P&gt;&lt;P&gt;                            im_cargomax  type scplane-cargomax,&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;    Redefinition of superclass method display_attributes&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;      display_attributes REDEFINITION.&lt;/P&gt;&lt;P&gt;  PRIVATE SECTION.&lt;/P&gt;&lt;P&gt;    DATA:cargomax TYPE scplane-cargomax.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ENDCLASS.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CLASS lcl_cargo_plane IMPLEMENTATION.&lt;/P&gt;&lt;P&gt;  METHOD constructor.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;  The constructor method of the superclass MUST be called withing the&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;  constructor&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;    CALL METHOD super-&amp;gt;constructor&lt;/P&gt;&lt;P&gt;                          EXPORTING im_name      = im_name&lt;/P&gt;&lt;P&gt;                                    im_planetype = im_planetype.&lt;/P&gt;&lt;P&gt;    cargomax = im_cargomax.&lt;/P&gt;&lt;P&gt;  ENDMETHOD.&lt;/P&gt;&lt;P&gt;  METHOD display_attributes.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;  The redefined  display_attributes method&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;    CALL METHOD super-&amp;gt;display_attributes.&lt;/P&gt;&lt;P&gt;    WRITE: / 'Cargo max:', cargomax.&lt;/P&gt;&lt;P&gt;  ENDMETHOD.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ENDCLASS.&lt;/P&gt;&lt;P&gt;The Main program that uses the classes&lt;/P&gt;&lt;P&gt;REPORT zbc404_hf_main .&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Super class&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;INCLUDE zbc404_hf_lcl_airplane.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Sub classes&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;INCLUDE zbc404_hf_lcl_passenger_plane.&lt;/P&gt;&lt;P&gt;INCLUDE zbc404_hf_lcl_cargo_plane.&lt;/P&gt;&lt;P&gt;DATA:&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Type ref to sub classes. Note: It is not necesssary to make typeref to the superclass&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;  o_passenger_airplane TYPE REF TO lcl_passenger_airplane,&lt;/P&gt;&lt;P&gt;  o_cargo_plane        TYPE REF TO lcl_cargo_plane.&lt;/P&gt;&lt;P&gt;START-OF-SELECTION.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Display initial number of instances = 0&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  CALL METHOD  lcl_airplane=&amp;gt;display_n_o_airplanes.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Create objects&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;  CREATE OBJECT o_passenger_airplane&lt;/P&gt;&lt;P&gt;    EXPORTING&lt;/P&gt;&lt;P&gt;      im_name      = 'LH505'&lt;/P&gt;&lt;P&gt;      im_planetype = 'Boing 747'&lt;/P&gt;&lt;P&gt;      im_n_o_seats = 350.&lt;/P&gt;&lt;P&gt;  CREATE OBJECT o_cargo_plane&lt;/P&gt;&lt;P&gt;    EXPORTING&lt;/P&gt;&lt;P&gt;      im_name      = 'AR13'&lt;/P&gt;&lt;P&gt;      im_planetype = 'DC 3'&lt;/P&gt;&lt;P&gt;      im_cargomax = 35.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Display attributes&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;  CALL METHOD o_passenger_airplane-&amp;gt;display_attributes.&lt;/P&gt;&lt;P&gt;  CALL METHOD o_cargo_plane-&amp;gt;display_attributes.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Call static method display_n_o_airplanes&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Note: The syntax for calling a superclass method, differs from the syntax when calling a &lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;subclass method.&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;When calling a superclass =&amp;gt; must be used instead of -&amp;gt;&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  CALL METHOD  lcl_airplane=&amp;gt;display_n_o_airplanes.&lt;/P&gt;&lt;P&gt;Result:&lt;/P&gt;&lt;P&gt;No. planes: 0&lt;/P&gt;&lt;P&gt;Name: LH505 Planetype: Boing 747&lt;/P&gt;&lt;P&gt;No. seats: 350&lt;/P&gt;&lt;P&gt;Name: AR13 Planetype: DC 3&lt;/P&gt;&lt;P&gt;Cargo max: 35,0000&lt;/P&gt;&lt;P&gt;No. planes: 2&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Polymorphism&lt;/P&gt;&lt;P&gt;Polymorphism: When the same method is implemented differently in different classes. This can be done u&lt;/P&gt;&lt;P&gt;sing enheritance, by redefining a method from the superclass in subclasses and implement it differently.&lt;/P&gt;&lt;P&gt;Classes:&lt;/P&gt;&lt;P&gt;&amp;#149;	lcl_airplane Superclass &lt;/P&gt;&lt;P&gt;&amp;#149;	lcl_cargo_airplane Subclass &lt;/P&gt;&lt;P&gt;&amp;#149;	lcl_passenger_airplane Subclass&lt;/P&gt;&lt;P&gt;The method estimate_fuel_consumption is implemented differently in the 3 classes, as it depends on the airplane type.&lt;/P&gt;&lt;P&gt;Object from different classes are stored in an internal table (plane_list) consisting of references to the &lt;/P&gt;&lt;P&gt;superclass, and the processed &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;identically for all the classes. &lt;/P&gt;&lt;P&gt;What coding for the estimate_fuel_consumption method taht is actually executed, depends on the dynamic &lt;/P&gt;&lt;P&gt;type of the plane reference variable,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; that is, depends on which object plane points to.&lt;/P&gt;&lt;P&gt;DATA: cargo_plane            TYPE REF to lcl_cargo_airplane,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;          passenger_plane    TYPE REF to lcl_passenger_airplane,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;          plane_list                  TYPE TABLE OF REF TO lcl_airplane.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Creating the list of references&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CREATE OBJECT cargo_plane.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;APPEND cargo_plane to plane_list.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CREATE OBJECT passenger_plane&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;APPEND passenger_plane to plane list.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Generic method for calucalting required fuel&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;METHOD calculate required_fuel.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  DATA: plane TYPE REF TO lcl_airplane.&lt;/P&gt;&lt;P&gt;  LOOP AT plane_list INTO plane.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    re_fuel = re_fuel + plane-&amp;gt;estimate_fuel_consumption( distance ).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  ENDLOOP.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ENDMETHOD.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Working example:&lt;/P&gt;&lt;P&gt;This example assumes that the classes lcl_airplane,  lcl_passnger_airplane and lcl_cargo plane exists.&lt;/P&gt;&lt;P&gt;Create objects of type lcl_cargo_plane and lcl_passenger_airplane, adds them to a list in lcl_carrier, &lt;/P&gt;&lt;P&gt;and displays the list.  &lt;/P&gt;&lt;P&gt;*&amp;amp;----&lt;/P&gt;&lt;HR originaltext="---------------------------------------------------------------" /&gt;&lt;P&gt;*&lt;/P&gt;&lt;P&gt;*&amp;amp; Include  ZBC404_HF_LCL_CARRIER                                      *&lt;/P&gt;&lt;P&gt;*&amp;amp;----&lt;/P&gt;&lt;HR originaltext="---------------------------------------------------------------" /&gt;&lt;P&gt;*&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;      CLASS lcl_carrier DEFINITION                                   *&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;*----&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;*&lt;/P&gt;&lt;P&gt;CLASS lcl_carrier DEFINITION.&lt;/P&gt;&lt;P&gt;  PUBLIC SECTION.&lt;/P&gt;&lt;P&gt;    TYPES: BEGIN OF flight_list_type,&lt;/P&gt;&lt;P&gt;              connid   TYPE sflight-connid,&lt;/P&gt;&lt;P&gt;              fldate   TYPE sflight-fldate,&lt;/P&gt;&lt;P&gt;              airplane TYPE REF TO lcl_airplane,&lt;/P&gt;&lt;P&gt;              seatsocc TYPE sflight-seatsocc,&lt;/P&gt;&lt;P&gt;              cargo(5) TYPE p DECIMALS 3,&lt;/P&gt;&lt;P&gt;           END OF flight_list_type.&lt;/P&gt;&lt;P&gt;    METHODS: constructor IMPORTING im_name TYPE string,&lt;/P&gt;&lt;P&gt;             get_name RETURNING value(ex_name) TYPE string,&lt;/P&gt;&lt;P&gt;             add_a_new_airplane IMPORTING&lt;/P&gt;&lt;P&gt;                                   im_airplane TYPE REF TO lcl_airplane,&lt;/P&gt;&lt;P&gt;    create_a_new_flight importing&lt;/P&gt;&lt;P&gt;                          im_connid   type sflight-connid&lt;/P&gt;&lt;P&gt;                          im_fldate   type sflight-fldate&lt;/P&gt;&lt;P&gt;                          im_airplane type ref to lcl_airplane&lt;/P&gt;&lt;P&gt;                          im_seatsocc type sflight-seatsocc&lt;/P&gt;&lt;P&gt;                                    optional&lt;/P&gt;&lt;P&gt;                        im_cargo    type p optional,&lt;/P&gt;&lt;P&gt;     display_airplanes.&lt;/P&gt;&lt;P&gt;  PRIVATE SECTION.&lt;/P&gt;&lt;P&gt;    DATA: name              TYPE string,&lt;/P&gt;&lt;P&gt;          list_of_airplanes TYPE TABLE OF REF TO lcl_airplane,&lt;/P&gt;&lt;P&gt;          list_of_flights   TYPE TABLE OF flight_list_type.&lt;/P&gt;&lt;P&gt;ENDCLASS.&lt;/P&gt;&lt;P&gt;*----&lt;/P&gt;&lt;HR originaltext="---------------------------------------------------------------" /&gt;&lt;P&gt;*&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;      CLASS lcl_carrier IMPLEMENTATION&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;*----&lt;/P&gt;&lt;HR originaltext="---------------------------------------------------------------" /&gt;&lt;P&gt;*&lt;/P&gt;&lt;P&gt;CLASS lcl_carrier IMPLEMENTATION.&lt;/P&gt;&lt;P&gt;  METHOD constructor.&lt;/P&gt;&lt;P&gt;    name = im_name.&lt;/P&gt;&lt;P&gt;  ENDMETHOD.&lt;/P&gt;&lt;P&gt;  METHOD get_name.&lt;/P&gt;&lt;P&gt;    ex_name = name.&lt;/P&gt;&lt;P&gt;  ENDMETHOD.&lt;/P&gt;&lt;P&gt;  METHOD create_a_new_flight.&lt;/P&gt;&lt;P&gt;    DATA: wa_list_of_flights TYPE flight_list_type.&lt;/P&gt;&lt;P&gt;    wa_list_of_flights-connid   = im_connid.&lt;/P&gt;&lt;P&gt;    wa_list_of_flights-fldate   = im_fldate.&lt;/P&gt;&lt;P&gt;    wa_list_of_flights-airplane = im_airplane.&lt;/P&gt;&lt;P&gt;    IF im_seatsocc IS INITIAL.&lt;/P&gt;&lt;P&gt;      wa_list_of_flights-cargo = im_cargo.&lt;/P&gt;&lt;P&gt;    ELSE.&lt;/P&gt;&lt;P&gt;      wa_list_of_flights-seatsocc = im_seatsocc.&lt;/P&gt;&lt;P&gt;    ENDIF.&lt;/P&gt;&lt;P&gt;    APPEND wa_list_of_flights TO list_of_flights.&lt;/P&gt;&lt;P&gt;  ENDMETHOD.&lt;/P&gt;&lt;P&gt;  METHOD add_a_new_airplane.&lt;/P&gt;&lt;P&gt;    APPEND im_airplane TO list_of_airplanes.&lt;/P&gt;&lt;P&gt;  ENDMETHOD.&lt;/P&gt;&lt;P&gt;  METHOD display_airplanes.&lt;/P&gt;&lt;P&gt;    DATA: l_airplane TYPE REF TO lcl_airplane.&lt;/P&gt;&lt;P&gt;    LOOP AT list_of_airplanes INTO l_airplane.&lt;/P&gt;&lt;P&gt;      CALL METHOD l_airplane-&amp;gt;display_attributes.&lt;/P&gt;&lt;P&gt;    ENDLOOP.&lt;/P&gt;&lt;P&gt;  ENDMETHOD.&lt;/P&gt;&lt;P&gt;ENDCLASS.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;REPORT zbc404_hf_main .&lt;/P&gt;&lt;P&gt;*******************************************************************&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt; This reprort uses class LCL_AIRPLNAE and subclasses&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt; LCL_CARGO_PLANE and LCL_PASSENGER_AIRPLANE and class LCL_CARRIER&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*******************************************************************&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Super class for airplanes&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;INCLUDE zbc404_hf_lcl_airplane.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Sub classes for airplanes&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;INCLUDE zbc404_hf_lcl_passenger_plane.&lt;/P&gt;&lt;P&gt;INCLUDE zbc404_hf_lcl_cargo_plane.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Carrier class&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;INCLUDE zbc404_hf_lcl_carrier.&lt;/P&gt;&lt;P&gt;DATA:&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Type ref to classes&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;  o_passenger_airplane  TYPE REF TO lcl_passenger_airplane,&lt;/P&gt;&lt;P&gt;  o_passenger_airplane2 TYPE REF TO lcl_passenger_airplane,&lt;/P&gt;&lt;P&gt;  o_cargo_plane         TYPE REF TO lcl_cargo_plane,&lt;/P&gt;&lt;P&gt;  o_cargo_plane2        TYPE REF TO lcl_cargo_plane,&lt;/P&gt;&lt;P&gt;  o_carrier             TYPE REF TO lcl_carrier.&lt;/P&gt;&lt;P&gt;START-OF-SELECTION.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Create objects&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;  CREATE OBJECT o_passenger_airplane&lt;/P&gt;&lt;P&gt;    EXPORTING&lt;/P&gt;&lt;P&gt;      im_name      = 'LH505'&lt;/P&gt;&lt;P&gt;      im_planetype = 'Boing 747'&lt;/P&gt;&lt;P&gt;      im_n_o_seats = 350.&lt;/P&gt;&lt;P&gt;  CREATE OBJECT o_passenger_airplane2&lt;/P&gt;&lt;P&gt;    EXPORTING&lt;/P&gt;&lt;P&gt;      im_name      = 'SK333'&lt;/P&gt;&lt;P&gt;      im_planetype = 'MD80'&lt;/P&gt;&lt;P&gt;      im_n_o_seats = 110.&lt;/P&gt;&lt;P&gt;  CREATE OBJECT o_cargo_plane&lt;/P&gt;&lt;P&gt;    EXPORTING&lt;/P&gt;&lt;P&gt;      im_name      = 'AR13'&lt;/P&gt;&lt;P&gt;      im_planetype = 'DC 3'&lt;/P&gt;&lt;P&gt;      im_cargomax = 35.&lt;/P&gt;&lt;P&gt;  CREATE OBJECT o_cargo_plane2&lt;/P&gt;&lt;P&gt;    EXPORTING&lt;/P&gt;&lt;P&gt;      im_name      = 'AFL124'&lt;/P&gt;&lt;P&gt;      im_planetype = 'Iljutsin 2'&lt;/P&gt;&lt;P&gt;      im_cargomax = 35000.&lt;/P&gt;&lt;P&gt;  CREATE OBJECT o_carrier&lt;/P&gt;&lt;P&gt;    EXPORTING im_name = 'Spritisch Airways'.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Add passenger and cargo planes to the list of airplanes&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;  CALL METHOD o_carrier-&amp;gt;add_a_new_airplane&lt;/P&gt;&lt;P&gt;     EXPORTING im_airplane = o_passenger_airplane.&lt;/P&gt;&lt;P&gt;  CALL METHOD o_carrier-&amp;gt;add_a_new_airplane&lt;/P&gt;&lt;P&gt;     EXPORTING im_airplane = o_passenger_airplane2.&lt;/P&gt;&lt;P&gt;  CALL METHOD o_carrier-&amp;gt;add_a_new_airplane&lt;/P&gt;&lt;P&gt;     EXPORTING im_airplane = o_cargo_plane.&lt;/P&gt;&lt;P&gt;  CALL METHOD o_carrier-&amp;gt;add_a_new_airplane&lt;/P&gt;&lt;P&gt;     EXPORTING im_airplane = o_cargo_plane2.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Display list of airplanes&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  call method o_carrier-&amp;gt;display_airplanes.&lt;/P&gt;&lt;P&gt;Result:&lt;/P&gt;&lt;P&gt;Name: LH505                     Planetype: Boing 747         &lt;/P&gt;&lt;P&gt;No. seats:       350                                         &lt;/P&gt;&lt;P&gt;Name: SK333                     Planetype: MD80              &lt;/P&gt;&lt;P&gt;No. seats:       110                                         &lt;/P&gt;&lt;P&gt;Name: AR13                      Planetype: DC 3              &lt;/P&gt;&lt;P&gt;Cargo max:             35,0000                               &lt;/P&gt;&lt;P&gt;Name: AFL124                    Planetype: Iljutsin 2        &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Cargo max:         35.000,0000                               &lt;/P&gt;&lt;P&gt;Events&lt;/P&gt;&lt;P&gt;Below is a simple example of how to implement an event.&lt;/P&gt;&lt;P&gt;REPORT zbc404_hf_events_5.&lt;/P&gt;&lt;P&gt;*----&lt;/P&gt;&lt;HR originaltext="---------------------------------------------------------------" /&gt;&lt;P&gt;*&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;      CLASS lcl_dog DEFINITION&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;*----&lt;/P&gt;&lt;HR originaltext="---------------------------------------------------------------" /&gt;&lt;P&gt;*&lt;/P&gt;&lt;P&gt;CLASS lcl_dog DEFINITION.&lt;/P&gt;&lt;P&gt;  PUBLIC SECTION.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;  Declare events&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;    EVENTS:&lt;/P&gt;&lt;P&gt;      dog_is_hungry&lt;/P&gt;&lt;P&gt;        EXPORTING value(ex_time_since_last_meal) TYPE i.&lt;/P&gt;&lt;P&gt;    METHODS:&lt;/P&gt;&lt;P&gt;      constructor&lt;/P&gt;&lt;P&gt;          IMPORTING im_name TYPE string,&lt;/P&gt;&lt;P&gt;      set_time_since_last_meal&lt;/P&gt;&lt;P&gt;          IMPORTING im_time TYPE i,&lt;/P&gt;&lt;P&gt;      on_dog_is_hungry FOR EVENT dog_is_hungry OF lcl_dog&lt;/P&gt;&lt;P&gt;          IMPORTING ex_time_since_last_meal.&lt;/P&gt;&lt;P&gt;ENDCLASS.&lt;/P&gt;&lt;P&gt;*----&lt;/P&gt;&lt;HR originaltext="---------------------------------------------------------------" /&gt;&lt;P&gt;*&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;      CLASS lcl_dog IMPLEMENTATION&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;*----&lt;/P&gt;&lt;HR originaltext="---------------------------------------------------------------" /&gt;&lt;P&gt;*&lt;/P&gt;&lt;P&gt;CLASS lcl_dog IMPLEMENTATION.&lt;/P&gt;&lt;P&gt;  METHOD constructor.&lt;/P&gt;&lt;P&gt;    WRITE: / 'I am a dog and my name is', im_name.&lt;/P&gt;&lt;P&gt;  ENDMETHOD.&lt;/P&gt;&lt;P&gt;  METHOD set_time_since_last_meal.&lt;/P&gt;&lt;P&gt;    IF im_time &amp;lt; 4.&lt;/P&gt;&lt;P&gt;      SKIP 1.&lt;/P&gt;&lt;P&gt;      WRITE: / 'You fool, I am not hungry yet'.&lt;/P&gt;&lt;P&gt;    ELSE.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;   Subsrcribe for event:&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;   set handler &amp;lt;Event handler method&amp;gt;&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;   FOR &amp;lt;ref_sender&amp;gt;!FOR ALL INSTANCES [ACTIVATION &amp;lt;var&amp;gt;]&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;      SET HANDLER on_dog_is_hungry FOR ALL INSTANCES ACTIVATION 'X'.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;   Raise event&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;      RAISE EVENT dog_is_hungry&lt;/P&gt;&lt;P&gt;        EXPORTING ex_time_since_last_meal = im_time.&lt;/P&gt;&lt;P&gt;    ENDIF.&lt;/P&gt;&lt;P&gt;  ENDMETHOD.&lt;/P&gt;&lt;P&gt;  METHOD on_dog_is_hungry.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;  Event method, called when the event dog_is_hungry is raised&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;    SKIP 1.&lt;/P&gt;&lt;P&gt;    WRITE: /  'You son of a ****. I have not eaten for more than',&lt;/P&gt;&lt;P&gt;              ex_time_since_last_meal, ' hours'.&lt;/P&gt;&lt;P&gt;    WRITE: / 'Give me something to eat NOW!'.&lt;/P&gt;&lt;P&gt;  ENDMETHOD.&lt;/P&gt;&lt;P&gt;ENDCLASS.&lt;/P&gt;&lt;P&gt;*----&lt;/P&gt;&lt;HR originaltext="---------------------------------------------------------------" /&gt;&lt;P&gt;*&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;      R E P O R T&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;*----&lt;/P&gt;&lt;HR originaltext="---------------------------------------------------------------" /&gt;&lt;P&gt;*&lt;/P&gt;&lt;P&gt;DATA: o_dog1 TYPE REF TO lcl_dog.&lt;/P&gt;&lt;P&gt;START-OF-SELECTION.&lt;/P&gt;&lt;P&gt;  CREATE OBJECT o_dog1 EXPORTING im_name = 'Beefeater'.&lt;/P&gt;&lt;P&gt;  CALL METHOD o_dog1-&amp;gt;set_time_since_last_meal&lt;/P&gt;&lt;P&gt;    EXPORTING im_time = 2.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;This method call will raise the event dog_is_hungy&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;because time &amp;gt; 3&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;  CALL METHOD o_dog1-&amp;gt;set_time_since_last_meal&lt;/P&gt;&lt;P&gt;    EXPORTING im_time = 5.&lt;/P&gt;&lt;P&gt;Result:&lt;/P&gt;&lt;P&gt;I am a dog and my name is Beefeater&lt;/P&gt;&lt;P&gt;You fool, I am not hungry yet&lt;/P&gt;&lt;P&gt;You son of a ****. I have not eaten for more than 5 hours&lt;/P&gt;&lt;P&gt;Give me something to eat NOW&lt;/P&gt;&lt;P&gt;This example is a step by step example, moving from a simple clas to more sophisticated classes, and covers inheritance, interfaces and events. &lt;/P&gt;&lt;P&gt;Simple class | Inheritance and ploymorphism | Interfaces | Events &lt;/P&gt;&lt;P&gt; 1. Simple class&lt;/P&gt;&lt;P&gt;This example shows how to create a simple employee class. The constructor method is used to initialize number and name of thje employee when the object is created. A display_employee method can be called to show the attributes of the employee, and CLASS-METHOD dosplay_no_of_employees can be called to show the total number of employees (Number of instances of the employee class).&lt;/P&gt;&lt;P&gt; REPORT zbc404_hf_events_1.&lt;/P&gt;&lt;P&gt;*********************************************************************&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;L C L _ E M P L O Y E E&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;*********************************************************************&lt;/P&gt;&lt;P&gt;*---- LCL Employee - Definition&lt;/P&gt;&lt;P&gt;CLASS lcl_employee DEFINITION.&lt;/P&gt;&lt;P&gt;  PUBLIC SECTION.&lt;/P&gt;&lt;P&gt;*----&lt;/P&gt;&lt;P&gt;-&lt;/P&gt;&lt;HR originaltext="--------------------------------------------------------------" /&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;The public section is accesible from outside   &lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;*----&lt;/P&gt;&lt;P&gt;-&lt;/P&gt;&lt;HR originaltext="--------------------------------------------------------------" /&gt;&lt;P&gt;    TYPES:&lt;/P&gt;&lt;P&gt;      BEGIN OF t_employee,&lt;/P&gt;&lt;P&gt;        no  TYPE i,&lt;/P&gt;&lt;P&gt;        name TYPE string,&lt;/P&gt;&lt;P&gt;     END OF t_employee.&lt;/P&gt;&lt;P&gt;    METHODS:&lt;/P&gt;&lt;P&gt;      constructor&lt;/P&gt;&lt;P&gt;        IMPORTING im_employee_no TYPE i&lt;/P&gt;&lt;P&gt;                  im_employee_name TYPE string,&lt;/P&gt;&lt;P&gt;      display_employee.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;  Class methods are global for all instances       &lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;    CLASS-METHODS: display_no_of_employees.&lt;/P&gt;&lt;P&gt;  PROTECTED SECTION.&lt;/P&gt;&lt;P&gt;*----&lt;/P&gt;&lt;P&gt;-&lt;/P&gt;&lt;HR originaltext="--------------------------------------------------------------" /&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;The protecetd section is accesible from the class and its subclasses  &lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;*----&lt;/P&gt;&lt;P&gt;-&lt;/P&gt;&lt;HR originaltext="--------------------------------------------------------------" /&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;  Class data are global for all instances       &lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;    CLASS-DATA: g_no_of_employees TYPE i.&lt;/P&gt;&lt;P&gt;  PRIVATE SECTION.&lt;/P&gt;&lt;P&gt;*----&lt;/P&gt;&lt;P&gt;-&lt;/P&gt;&lt;HR originaltext="--------------------------------------------------------------" /&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;The private section is only accesible from within the classs  &lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;*----&lt;/P&gt;&lt;P&gt;-&lt;/P&gt;&lt;HR originaltext="--------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    DATA: g_employee TYPE t_employee.&lt;/P&gt;&lt;P&gt;ENDCLASS.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*--- LCL Employee - Implementation&lt;/P&gt;&lt;P&gt;CLASS lcl_employee IMPLEMENTATION.&lt;/P&gt;&lt;P&gt;  METHOD constructor.&lt;/P&gt;&lt;P&gt;    g_employee-no = im_employee_no.&lt;/P&gt;&lt;P&gt;    g_employee-name = im_employee_name.&lt;/P&gt;&lt;P&gt;    g_no_of_employees = g_no_of_employees + 1.&lt;/P&gt;&lt;P&gt;  ENDMETHOD.&lt;/P&gt;&lt;P&gt;  METHOD display_employee.&lt;/P&gt;&lt;P&gt;    WRITE:/ 'Employee', g_employee-no, g_employee-name.&lt;/P&gt;&lt;P&gt;  ENDMETHOD.&lt;/P&gt;&lt;P&gt;  METHOD display_no_of_employees.&lt;/P&gt;&lt;P&gt;    WRITE: / 'Number of employees is:', g_no_of_employees.&lt;/P&gt;&lt;P&gt;  ENDMETHOD.&lt;/P&gt;&lt;P&gt;ENDCLASS.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;************************************************************************&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;R E P O R T&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;*********************************************************************&lt;/P&gt;&lt;P&gt;DATA: g_employee1 TYPE REF TO lcl_employee,&lt;/P&gt;&lt;P&gt;      g_employee2 TYPE REF TO lcl_employee.&lt;/P&gt;&lt;P&gt;START-OF-SELECTION.&lt;/P&gt;&lt;P&gt;  CREATE OBJECT g_employee1&lt;/P&gt;&lt;P&gt;    EXPORTING im_employee_no = 1&lt;/P&gt;&lt;P&gt;              im_employee_name = 'John Jones'.&lt;/P&gt;&lt;P&gt;  CREATE OBJECT g_employee2&lt;/P&gt;&lt;P&gt;    EXPORTING im_employee_no = 2&lt;/P&gt;&lt;P&gt;              im_employee_name = 'Sally Summer'.&lt;/P&gt;&lt;P&gt;  CALL METHOD g_employee1-&amp;gt;display_employee.&lt;/P&gt;&lt;P&gt;  CALL METHOD g_employee2-&amp;gt;display_employee.&lt;/P&gt;&lt;P&gt;  CALL METHOD g_employee2-&amp;gt;display_no_of_employees.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2. Inheritance and polymorphism&lt;/P&gt;&lt;P&gt;This example uses a superclass lcl_company_employees and two subclasses lcl_bluecollar_employee and lcl_whitecollar_employee to add employees to a list and then display a list of employees and there wages. The wages are calcukated in the method add_employee, but as the wages are calculated differently for blue collar employees and white collar emplyees, the superclass method add_employee is redeifined in the subclasses.&lt;/P&gt;&lt;P&gt;Principles:&lt;/P&gt;&lt;P&gt;Create super class LCL_CompanyEmployees.&lt;/P&gt;&lt;P&gt;The class has the methods:&lt;/P&gt;&lt;P&gt;&amp;#149;	Constructor &lt;/P&gt;&lt;P&gt;&amp;#149;	Add_Employee - Adds a new employee to the list of employees &lt;/P&gt;&lt;P&gt;&amp;#149;	Display_Employee_List - Displays all employees and there wage &lt;/P&gt;&lt;P&gt;&amp;#149;	Display_no_of_employees - Displays total number of employees&lt;/P&gt;&lt;P&gt;Note the use of CLASS-DATA to keep the list of employees and number of employees the same from instance to instance.&lt;/P&gt;&lt;P&gt;Create subclasses lcl_bluecollar_employee and lcl_whitecollar_employee. The calsses are identical, except for the redifinition of the add_employee method, where the caclculation of wage is different.&lt;/P&gt;&lt;P&gt;Methodes:&lt;/P&gt;&lt;P&gt;&amp;#149;	Constructor. The constructor is used to initialize the attributes of the employee. Note that the constructor in the supclasss has to be called from within the constructor of the subclass. &lt;/P&gt;&lt;P&gt;&amp;#149;	Add_Employee. This is a redinition of the same method in the superclass. In the redefined class the wage is calcuated, and the superclass method is called to add the employees to the emploee list.:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The program&lt;/P&gt;&lt;P&gt;REPORT zbc404_hf_events_2 .&lt;/P&gt;&lt;P&gt;*******************************************************&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Super class LCL_CompanyEmployees&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;*******************************************************&lt;/P&gt;&lt;P&gt;CLASS lcl_company_employees DEFINITION.&lt;/P&gt;&lt;P&gt;  PUBLIC SECTION.&lt;/P&gt;&lt;P&gt;    TYPES:&lt;/P&gt;&lt;P&gt;      BEGIN OF t_employee,&lt;/P&gt;&lt;P&gt;        no  TYPE i,&lt;/P&gt;&lt;P&gt;        name TYPE string,&lt;/P&gt;&lt;P&gt;        wage TYPE i,&lt;/P&gt;&lt;P&gt;     END OF t_employee.&lt;/P&gt;&lt;P&gt;    METHODS:&lt;/P&gt;&lt;P&gt;      constructor,&lt;/P&gt;&lt;P&gt;      add_employee&lt;/P&gt;&lt;P&gt;        IMPORTING im_no   TYPE i&lt;/P&gt;&lt;P&gt;                  im_name TYPE string&lt;/P&gt;&lt;P&gt;                  im_wage TYPE i,&lt;/P&gt;&lt;P&gt;      display_employee_list,&lt;/P&gt;&lt;P&gt;      display_no_of_employees.&lt;/P&gt;&lt;P&gt;  PRIVATE SECTION.&lt;/P&gt;&lt;P&gt;    CLASS-DATA: i_employee_list TYPE TABLE OF t_employee,&lt;/P&gt;&lt;P&gt;                no_of_employees TYPE i.&lt;/P&gt;&lt;P&gt;ENDCLASS.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*-- CLASS LCL_CompanyEmployees IMPLEMENTATION&lt;/P&gt;&lt;P&gt;CLASS lcl_company_employees IMPLEMENTATION.&lt;/P&gt;&lt;P&gt;  METHOD constructor.&lt;/P&gt;&lt;P&gt;    no_of_employees = no_of_employees + 1.&lt;/P&gt;&lt;P&gt;  ENDMETHOD.&lt;/P&gt;&lt;P&gt;  METHOD add_employee.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;  Adds a new employee to the list of employees&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;    DATA: l_employee TYPE t_employee.&lt;/P&gt;&lt;P&gt;    l_employee-no = im_no.&lt;/P&gt;&lt;P&gt;    l_employee-name = im_name.&lt;/P&gt;&lt;P&gt;    l_employee-wage = im_wage.&lt;/P&gt;&lt;P&gt;    APPEND l_employee TO i_employee_list.&lt;/P&gt;&lt;P&gt;  ENDMETHOD.&lt;/P&gt;&lt;P&gt;  METHOD display_employee_list.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;  Displays all employees and there wage&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;    DATA: l_employee TYPE t_employee.&lt;/P&gt;&lt;P&gt;    WRITE: / 'List of Employees'.&lt;/P&gt;&lt;P&gt;    LOOP AT i_employee_list INTO l_employee.&lt;/P&gt;&lt;P&gt;      WRITE: / l_employee-no, l_employee-name, l_employee-wage.&lt;/P&gt;&lt;P&gt;    ENDLOOP.&lt;/P&gt;&lt;P&gt;  ENDMETHOD.&lt;/P&gt;&lt;P&gt;  METHOD display_no_of_employees.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;  Displays total number of employees&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;    SKIP 3.&lt;/P&gt;&lt;P&gt;    WRITE: / 'Total number of employees:', no_of_employees.&lt;/P&gt;&lt;P&gt;  ENDMETHOD.&lt;/P&gt;&lt;P&gt;ENDCLASS.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*******************************************************&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Sub class LCL_BlueCollar_Employee&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;*******************************************************&lt;/P&gt;&lt;P&gt;CLASS lcl_bluecollar_employee DEFINITION&lt;/P&gt;&lt;P&gt;          INHERITING FROM lcl_company_employees.&lt;/P&gt;&lt;P&gt;  PUBLIC SECTION.&lt;/P&gt;&lt;P&gt;    METHODS:&lt;/P&gt;&lt;P&gt;        constructor&lt;/P&gt;&lt;P&gt;          IMPORTING im_no             TYPE i&lt;/P&gt;&lt;P&gt;                    im_name           TYPE string&lt;/P&gt;&lt;P&gt;                    im_hours          TYPE i&lt;/P&gt;&lt;P&gt;                    im_hourly_payment TYPE i,&lt;/P&gt;&lt;P&gt;         add_employee REDEFINITION.&lt;/P&gt;&lt;P&gt;  PRIVATE SECTION.&lt;/P&gt;&lt;P&gt;    DATA:no             TYPE i,&lt;/P&gt;&lt;P&gt;         name           TYPE string,&lt;/P&gt;&lt;P&gt;         hours          TYPE i,&lt;/P&gt;&lt;P&gt;         hourly_payment TYPE i.&lt;/P&gt;&lt;P&gt;ENDCLASS.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*---- CLASS LCL_BlueCollar_Employee IMPLEMENTATION&lt;/P&gt;&lt;P&gt;CLASS lcl_bluecollar_employee IMPLEMENTATION.&lt;/P&gt;&lt;P&gt;  METHOD constructor.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;  The superclass constructor method must be called from the subclass&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;  constructor method&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;    CALL METHOD super-&amp;gt;constructor.&lt;/P&gt;&lt;P&gt;    no = im_no.&lt;/P&gt;&lt;P&gt;    name = im_name.&lt;/P&gt;&lt;P&gt;    hours = im_hours.&lt;/P&gt;&lt;P&gt;    hourly_payment = im_hourly_payment.&lt;/P&gt;&lt;P&gt;  ENDMETHOD.&lt;/P&gt;&lt;P&gt;  METHOD add_employee.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;  Calculate wage an call the superclass method add_employee to add&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;  the employee to the employee list&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;    DATA: l_wage TYPE i.&lt;/P&gt;&lt;P&gt;    l_wage = hours * hourly_payment.&lt;/P&gt;&lt;P&gt;    CALL METHOD super-&amp;gt;add_employee&lt;/P&gt;&lt;P&gt;      EXPORTING im_no = no&lt;/P&gt;&lt;P&gt;                im_name = name&lt;/P&gt;&lt;P&gt;                im_wage = l_wage.&lt;/P&gt;&lt;P&gt;  ENDMETHOD.&lt;/P&gt;&lt;P&gt;ENDCLASS.&lt;/P&gt;&lt;P&gt;*******************************************************&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Sub class LCL_WhiteCollar_Employee&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;*******************************************************&lt;/P&gt;&lt;P&gt;CLASS lcl_whitecollar_employee DEFINITION&lt;/P&gt;&lt;P&gt;    INHERITING FROM lcl_company_employees.&lt;/P&gt;&lt;P&gt;  PUBLIC SECTION.&lt;/P&gt;&lt;P&gt;    METHODS:&lt;/P&gt;&lt;P&gt;        constructor&lt;/P&gt;&lt;P&gt;          IMPORTING im_no                 TYPE i&lt;/P&gt;&lt;P&gt;                    im_name               TYPE string&lt;/P&gt;&lt;P&gt;                    im_monthly_salary     TYPE i&lt;/P&gt;&lt;P&gt;                    im_monthly_deducations TYPE i,&lt;/P&gt;&lt;P&gt;         add_employee REDEFINITION.&lt;/P&gt;&lt;P&gt;  PRIVATE SECTION.&lt;/P&gt;&lt;P&gt;    DATA:&lt;/P&gt;&lt;P&gt;      no                    TYPE i,&lt;/P&gt;&lt;P&gt;      name                  TYPE string,&lt;/P&gt;&lt;P&gt;      monthly_salary        TYPE i,&lt;/P&gt;&lt;P&gt;      monthly_deducations    TYPE i.&lt;/P&gt;&lt;P&gt;ENDCLASS.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*---- CLASS LCL_WhiteCollar_Employee IMPLEMENTATION&lt;/P&gt;&lt;P&gt;CLASS lcl_whitecollar_employee IMPLEMENTATION.&lt;/P&gt;&lt;P&gt;  METHOD constructor.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;  The superclass constructor method must be called from the subclass&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;  constructor method&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    CALL METHOD super-&amp;gt;constructor.&lt;/P&gt;&lt;P&gt;    no = im_no.&lt;/P&gt;&lt;P&gt;    name = im_name.&lt;/P&gt;&lt;P&gt;    monthly_salary = im_monthly_salary.&lt;/P&gt;&lt;P&gt;    monthly_deducations = im_monthly_deducations.&lt;/P&gt;&lt;P&gt;  ENDMETHOD.&lt;/P&gt;&lt;P&gt;  METHOD add_employee.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;  Calculate wage an call the superclass method add_employee to add&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;  the employee to the employee list&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;    DATA: l_wage TYPE i.&lt;/P&gt;&lt;P&gt;    l_wage = monthly_salary - monthly_deducations.&lt;/P&gt;&lt;P&gt;    CALL METHOD super-&amp;gt;add_employee&lt;/P&gt;&lt;P&gt;      EXPORTING im_no = no&lt;/P&gt;&lt;P&gt;                im_name = name&lt;/P&gt;&lt;P&gt;                im_wage = l_wage.&lt;/P&gt;&lt;P&gt;  ENDMETHOD.&lt;/P&gt;&lt;P&gt;ENDCLASS.&lt;/P&gt;&lt;P&gt;*******************************************************&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;R E P O R T&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;*******************************************************&lt;/P&gt;&lt;P&gt;DATA:&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Object references&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;  o_bluecollar_employee1  TYPE REF TO lcl_bluecollar_employee,&lt;/P&gt;&lt;P&gt;  o_whitecollar_employee1 TYPE REF TO lcl_whitecollar_employee.&lt;/P&gt;&lt;P&gt;START-OF-SELECTION.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Create bluecollar employee obeject&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;  CREATE OBJECT o_bluecollar_employee1&lt;/P&gt;&lt;P&gt;      EXPORTING im_no  = 1&lt;/P&gt;&lt;P&gt;                im_name  = 'Gylle Karen'&lt;/P&gt;&lt;P&gt;                im_hours = 38&lt;/P&gt;&lt;P&gt;                im_hourly_payment = 75.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Add bluecollar employee to employee list&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;  CALL METHOD o_bluecollar_employee1-&amp;gt;add_employee&lt;/P&gt;&lt;P&gt;      EXPORTING im_no  = 1&lt;/P&gt;&lt;P&gt;                im_name  = 'Gylle Karen'&lt;/P&gt;&lt;P&gt;                im_wage = 0.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Create whitecollar employee obeject&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;  CREATE OBJECT o_whitecollar_employee1&lt;/P&gt;&lt;P&gt;      EXPORTING im_no  = 2&lt;/P&gt;&lt;P&gt;                im_name  = 'John Dickens'&lt;/P&gt;&lt;P&gt;                im_monthly_salary = 10000&lt;/P&gt;&lt;P&gt;                im_monthly_deducations = 2500.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Add bluecollar employee to employee list&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;  CALL METHOD o_whitecollar_employee1-&amp;gt;add_employee&lt;/P&gt;&lt;P&gt;      EXPORTING im_no  = 1&lt;/P&gt;&lt;P&gt;                im_name  = 'Karen Johnson'&lt;/P&gt;&lt;P&gt;                im_wage = 0.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Display employee list and number of employees. Note that the result&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;will be the same when called from o_whitecollar_employee1 or&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;o_bluecolarcollar_employee1, because the methods are defined&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;as static (CLASS-METHODS)&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;  CALL METHOD o_whitecollar_employee1-&amp;gt;display_employee_list.&lt;/P&gt;&lt;P&gt;  CALL METHOD o_whitecollar_employee1-&amp;gt;display_no_of_employees.&lt;/P&gt;&lt;P&gt;The resulting report&lt;/P&gt;&lt;P&gt;List of Employees&lt;/P&gt;&lt;P&gt;1 Karen Johnson 2.850&lt;/P&gt;&lt;P&gt;2 John Dickens 7.500&lt;/P&gt;&lt;P&gt;Total number of employees: 2&lt;/P&gt;&lt;P&gt;3. Interfaces&lt;/P&gt;&lt;P&gt;This example is similiar to th eprevious example, however an interface is implemented with the method add_employee. Note that the interface is only implemented in the superclass ( The INTERFACE stament), but also used in the subclasses.&lt;/P&gt;&lt;P&gt;The interface in the example only contains a method, but an iterface can also contain attrbutes, constants, types and alias names.&lt;/P&gt;&lt;P&gt;The output from example 3 is similiar to the output in example 2.&lt;/P&gt;&lt;P&gt;All changes in the program compared to example 2 are marked with red.&lt;/P&gt;&lt;P&gt;REPORT zbc404_hf_events_3 .&lt;/P&gt;&lt;P&gt;*----&lt;/P&gt;&lt;HR originaltext="---------------------------------------------------------------" /&gt;&lt;P&gt;*&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;      INTERFACE lif_employee&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;*----&lt;/P&gt;&lt;HR originaltext="---------------------------------------------------------------" /&gt;&lt;P&gt;*&lt;/P&gt;&lt;P&gt;INTERFACE lif_employee.&lt;/P&gt;&lt;P&gt;  METHODS:&lt;/P&gt;&lt;P&gt;    add_employee&lt;/P&gt;&lt;P&gt;       IMPORTING im_no   TYPE i&lt;/P&gt;&lt;P&gt;                  im_name TYPE string&lt;/P&gt;&lt;P&gt;                  im_wage TYPE i.&lt;/P&gt;&lt;P&gt;ENDINTERFACE.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*******************************************************&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Super class LCL_CompanyEmployees&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;*******************************************************&lt;/P&gt;&lt;P&gt;CLASS lcl_company_employees DEFINITION.&lt;/P&gt;&lt;P&gt;  PUBLIC SECTION.&lt;/P&gt;&lt;P&gt;    INTERFACES lif_employee.&lt;/P&gt;&lt;P&gt;    TYPES:&lt;/P&gt;&lt;P&gt;      BEGIN OF t_employee,&lt;/P&gt;&lt;P&gt;        no  TYPE i,&lt;/P&gt;&lt;P&gt;        name TYPE string,&lt;/P&gt;&lt;P&gt;        wage TYPE i,&lt;/P&gt;&lt;P&gt;     END OF t_employee.&lt;/P&gt;&lt;P&gt;    METHODS:&lt;/P&gt;&lt;P&gt;      constructor,&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;     add_employee      "Removed&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;        IMPORTING im_no   TYPE i&lt;/P&gt;&lt;P&gt;                  im_name TYPE string&lt;/P&gt;&lt;P&gt;                  im_wage TYPE i,&lt;/P&gt;&lt;P&gt;      display_employee_list,&lt;/P&gt;&lt;P&gt;      display_no_of_employees.&lt;/P&gt;&lt;P&gt;  PRIVATE SECTION.&lt;/P&gt;&lt;P&gt;    CLASS-DATA: i_employee_list TYPE TABLE OF t_employee,&lt;/P&gt;&lt;P&gt;                no_of_employees TYPE i.&lt;/P&gt;&lt;P&gt;ENDCLASS.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*-- CLASS LCL_CompanyEmployees IMPLEMENTATION&lt;/P&gt;&lt;P&gt;CLASS lcl_company_employees IMPLEMENTATION.&lt;/P&gt;&lt;P&gt;  METHOD constructor.&lt;/P&gt;&lt;P&gt;    no_of_employees = no_of_employees + 1.&lt;/P&gt;&lt;P&gt;  ENDMETHOD.&lt;/P&gt;&lt;P&gt;  METHOD lif_employee~add_employee.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;  Adds a new employee to the list of employees&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;    DATA: l_employee TYPE t_employee.&lt;/P&gt;&lt;P&gt;    l_employee-no = im_no.&lt;/P&gt;&lt;P&gt;    l_employee-name = im_name.&lt;/P&gt;&lt;P&gt;    l_employee-wage = im_wage.&lt;/P&gt;&lt;P&gt;    APPEND l_employee TO i_employee_list.&lt;/P&gt;&lt;P&gt;  ENDMETHOD.&lt;/P&gt;&lt;P&gt;  METHOD display_employee_list.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;  Displays all employees and there wage&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;    DATA: l_employee TYPE t_employee.&lt;/P&gt;&lt;P&gt;    WRITE: / 'List of Employees'.&lt;/P&gt;&lt;P&gt;    LOOP AT i_employee_list INTO l_employee.&lt;/P&gt;&lt;P&gt;      WRITE: / l_employee-no, l_employee-name, l_employee-wage.&lt;/P&gt;&lt;P&gt;    ENDLOOP.&lt;/P&gt;&lt;P&gt;  ENDMETHOD.&lt;/P&gt;&lt;P&gt;  METHOD display_no_of_employees.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;  Displays total number of employees&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;    SKIP 3.&lt;/P&gt;&lt;P&gt;    WRITE: / 'Total number of employees:', no_of_employees.&lt;/P&gt;&lt;P&gt;  ENDMETHOD.&lt;/P&gt;&lt;P&gt;ENDCLASS.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;*******************************************************&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Sub class LCL_BlueCollar_Employee&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;*******************************************************&lt;/P&gt;&lt;P&gt;CLASS lcl_bluecollar_employee DEFINITION&lt;/P&gt;&lt;P&gt;          INHERITING FROM lcl_company_employees.&lt;/P&gt;&lt;P&gt;  PUBLIC SECTION.&lt;/P&gt;&lt;P&gt;    METHODS:&lt;/P&gt;&lt;P&gt;        constructor&lt;/P&gt;&lt;P&gt;          IMPORTING im_no             TYPE i&lt;/P&gt;&lt;P&gt;                    im_name           TYPE string&lt;/P&gt;&lt;P&gt;                    im_hours          TYPE i&lt;/P&gt;&lt;P&gt;                    im_hourly_payment TYPE i,&lt;/P&gt;&lt;P&gt;         lif_employee~add_employee REDEFINITION..&lt;/P&gt;&lt;P&gt;  PRIVATE SECTION.&lt;/P&gt;&lt;P&gt;    DATA:no             TYPE i,&lt;/P&gt;&lt;P&gt;         name           TYPE string,&lt;/P&gt;&lt;P&gt;         hours          TYPE i,&lt;/P&gt;&lt;P&gt;         hourly_payment TYPE i.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;ENDCLASS.&lt;/P&gt;&lt;P&gt;*---- CLASS LCL_BlueCollar_Employee IMPLEMENTATION&lt;/P&gt;&lt;P&gt;CLASS lcl_bluecollar_employee IMPLEMENTATION.&lt;/P&gt;&lt;P&gt;  METHOD constructor.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;  The superclass constructor method must be called from the subclass&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;  constructor method&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;    CALL METHOD super-&amp;gt;constructor.&lt;/P&gt;&lt;P&gt;    no = im_no.&lt;/P&gt;&lt;P&gt;    name = im_name.&lt;/P&gt;&lt;P&gt;    hours = im_hours.&lt;/P&gt;&lt;P&gt;    hourly_payment = im_hourly_payment.&lt;/P&gt;&lt;P&gt;  ENDMETHOD.&lt;/P&gt;&lt;P&gt;  METHOD lif_employee~add_employee.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;  Calculate wage an call the superclass method add_employee to add&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;  the employee to the employee list&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;    DATA: l_wage TYPE i.&lt;/P&gt;&lt;P&gt;    l_wage = hours * hourly_payment.&lt;/P&gt;&lt;P&gt;    CALL METHOD super-&amp;gt;lif_employee~add_employee&lt;/P&gt;&lt;P&gt;      EXPORTING im_no = no&lt;/P&gt;&lt;P&gt;                im_name = name&lt;/P&gt;&lt;P&gt;                im_wage = l_wage.&lt;/P&gt;&lt;P&gt;  ENDMETHOD.&lt;/P&gt;&lt;P&gt;ENDCLASS.&lt;/P&gt;&lt;P&gt;*******************************************************&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Sub class LCL_WhiteCollar_Employee&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;*******************************************************&lt;/P&gt;&lt;P&gt;CLASS lcl_whitecollar_employee DEFINITION&lt;/P&gt;&lt;P&gt;    INHERITING FROM lcl_company_employees.&lt;/P&gt;&lt;P&gt;  PUBLIC SECTION.&lt;/P&gt;&lt;P&gt;    METHODS:&lt;/P&gt;&lt;P&gt;        constructor&lt;/P&gt;&lt;P&gt;          IMPORTING im_no                 TYPE i&lt;/P&gt;&lt;P&gt;                    im_name               TYPE string&lt;/P&gt;&lt;P&gt;                    im_monthly_salary     TYPE i&lt;/P&gt;&lt;P&gt;                    im_monthly_deducations TYPE i,&lt;/P&gt;&lt;P&gt;         lif_employee~add_employee REDEFINITION.&lt;/P&gt;&lt;P&gt;  PRIVATE SECTION.&lt;/P&gt;&lt;P&gt;    DATA:&lt;/P&gt;&lt;P&gt;      no                    TYPE i,&lt;/P&gt;&lt;P&gt;      name                  TYPE string,&lt;/P&gt;&lt;P&gt;      monthly_salary        TYPE i,&lt;/P&gt;&lt;P&gt;      monthly_deducations    TYPE i.&lt;/P&gt;&lt;P&gt;ENDCLASS.&lt;/P&gt;&lt;P&gt;*---- CLASS LCL_WhiteCollar_Employee IMPLEMENTATION&lt;/P&gt;&lt;P&gt;CLASS lcl_whitecollar_employee IMPLEMENTATION.&lt;/P&gt;&lt;P&gt;  METHOD constructor.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;  The superclass constructor method must be called from the subclass&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;  constructor method&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    CALL METHOD super-&amp;gt;constructor.&lt;/P&gt;&lt;P&gt;    no = im_no.&lt;/P&gt;&lt;P&gt;    name = im_name.&lt;/P&gt;&lt;P&gt;    monthly_salary = im_monthly_salary.&lt;/P&gt;&lt;P&gt;    monthly_deducations = im_monthly_deducations.&lt;/P&gt;&lt;P&gt;  ENDMETHOD.&lt;/P&gt;&lt;P&gt;  METHOD lif_employee~add_employee.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;  Calculate wage an call the superclass method add_employee to add&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;  the employee to the employee list&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;    DATA: l_wage TYPE i.&lt;/P&gt;&lt;P&gt;    l_wage = monthly_salary - monthly_deducations.&lt;/P&gt;&lt;P&gt;    CALL METHOD super-&amp;gt;lif_employee~add_employee&lt;/P&gt;&lt;P&gt;      EXPORTING im_no = no&lt;/P&gt;&lt;P&gt;                im_name = name&lt;/P&gt;&lt;P&gt;                im_wage = l_wage.&lt;/P&gt;&lt;P&gt;  ENDMETHOD.&lt;/P&gt;&lt;P&gt;ENDCLASS.&lt;/P&gt;&lt;P&gt;*******************************************************&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;R E P O R T&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;*******************************************************&lt;/P&gt;&lt;P&gt;DATA:&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Object references&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;  o_bluecollar_employee1  TYPE REF TO lcl_bluecollar_employee,&lt;/P&gt;&lt;P&gt;  o_whitecollar_employee1 TYPE REF TO lcl_whitecollar_employee.&lt;/P&gt;&lt;P&gt;START-OF-SELECTION.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Create bluecollar employee obeject&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;  CREATE OBJECT o_bluecollar_employee1&lt;/P&gt;&lt;P&gt;      EXPORTING im_no  = 1&lt;/P&gt;&lt;P&gt;                im_name  = 'Gylle Karen'&lt;/P&gt;&lt;P&gt;                im_hours = 38&lt;/P&gt;&lt;P&gt;                im_hourly_payment = 75.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Add bluecollar employee to employee list&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;  CALL METHOD o_bluecollar_employee1-&amp;gt;lif_employee~add_employee&lt;/P&gt;&lt;P&gt;      EXPORTING im_no  = 1&lt;/P&gt;&lt;P&gt;                im_name  = 'Karen Johnson'&lt;/P&gt;&lt;P&gt;                im_wage = 0.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Create whitecollar employee obeject&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;  CREATE OBJECT o_whitecollar_employee1&lt;/P&gt;&lt;P&gt;      EXPORTING im_no  = 2&lt;/P&gt;&lt;P&gt;                im_name  = 'John Dickens'&lt;/P&gt;&lt;P&gt;                im_monthly_salary = 10000&lt;/P&gt;&lt;P&gt;                im_monthly_deducations = 2500.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Add bluecollar employee to employee list&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;  CALL METHOD o_whitecollar_employee1-&amp;gt;lif_employee~add_employee&lt;/P&gt;&lt;P&gt;      EXPORTING im_no  = 1&lt;/P&gt;&lt;P&gt;                im_name  = 'Gylle Karen'&lt;/P&gt;&lt;P&gt;                im_wage = 0.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Display employee list and number of employees. Note that the result&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;will be the same when called from o_whitecollar_employee1 or&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;o_bluecolarcollar_employee1, because the methods are defined&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;as static (CLASS-METHODS)&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;  CALL METHOD o_whitecollar_employee1-&amp;gt;display_employee_list.&lt;/P&gt;&lt;P&gt;  CALL METHOD o_whitecollar_employee1-&amp;gt;display_no_of_employees.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;4. Events&lt;/P&gt;&lt;P&gt;This is the same example as example 4. All changes are marked with red. There have been no canges to the subclasses, only to the superclass and the report, sp the code for th esubclasses is not shown.&lt;/P&gt;&lt;P&gt;For a simple example refer to Events in Examples.&lt;/P&gt;&lt;P&gt;REPORT zbc404_hf_events_4 .&lt;/P&gt;&lt;P&gt;*----&lt;/P&gt;&lt;HR originaltext="---------------------------------------------------------------" /&gt;&lt;P&gt;*&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;      INTERFACE lif_employee&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;*----&lt;/P&gt;&lt;HR originaltext="---------------------------------------------------------------" /&gt;&lt;P&gt;*&lt;/P&gt;&lt;P&gt;INTERFACE lif_employee.&lt;/P&gt;&lt;P&gt;  METHODS:&lt;/P&gt;&lt;P&gt;    add_employee&lt;/P&gt;&lt;P&gt;       IMPORTING im_no   TYPE i&lt;/P&gt;&lt;P&gt;                  im_name TYPE string&lt;/P&gt;&lt;P&gt;                  im_wage TYPE i.&lt;/P&gt;&lt;P&gt;ENDINTERFACE.&lt;/P&gt;&lt;P&gt;*******************************************************&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Super class LCL_CompanyEmployees&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;*******************************************************&lt;/P&gt;&lt;P&gt;CLASS lcl_company_employees DEFINITION.&lt;/P&gt;&lt;P&gt;  PUBLIC SECTION.&lt;/P&gt;&lt;P&gt;    TYPES:&lt;/P&gt;&lt;P&gt;    BEGIN OF t_employee,&lt;/P&gt;&lt;P&gt;      no  TYPE i,&lt;/P&gt;&lt;P&gt;      name TYPE string,&lt;/P&gt;&lt;P&gt;      wage TYPE i,&lt;/P&gt;&lt;P&gt;   END OF t_employee.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;  Declare event. Note that declaration could also be placed in the&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;  interface&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;    EVENTS: employee_added_to_list&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;        EXPORTING value(ex_employee_name) TYPE string.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt; CLASS-EVENTS: Events can also be defined as class-events&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;    INTERFACES lif_employee.&lt;/P&gt;&lt;P&gt;    METHODS:&lt;/P&gt;&lt;P&gt;      constructor,&lt;/P&gt;&lt;P&gt;      display_employee_list,&lt;/P&gt;&lt;P&gt;      display_no_of_employees,&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;    Declare event method&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;      on_employee_added_to_list FOR EVENT employee_added_to_list OF lcl_company_employees&lt;/P&gt;&lt;P&gt;         IMPORTING ex_employee_name sender.&lt;/P&gt;&lt;P&gt;  PRIVATE SECTION.&lt;/P&gt;&lt;P&gt;    CLASS-DATA:&lt;/P&gt;&lt;P&gt;      i_employee_list TYPE TABLE OF t_employee,&lt;/P&gt;&lt;P&gt;      no_of_employees TYPE i.&lt;/P&gt;&lt;P&gt;ENDCLASS.&lt;/P&gt;&lt;P&gt;*-- CLASS LCL_CompanyEmployees IMPLEMENTATION&lt;/P&gt;&lt;P&gt;CLASS lcl_company_employees IMPLEMENTATION.&lt;/P&gt;&lt;P&gt;  METHOD constructor.&lt;/P&gt;&lt;P&gt;    no_of_employees = no_of_employees + 1.&lt;/P&gt;&lt;P&gt;  ENDMETHOD.&lt;/P&gt;&lt;P&gt;  METHOD lif_employee~add_employee.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;  Adds a new employee to the list of employees&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    DATA: l_employee TYPE t_employee.&lt;/P&gt;&lt;P&gt;    l_employee-no = im_no.&lt;/P&gt;&lt;P&gt;    l_employee-name = im_name.&lt;/P&gt;&lt;P&gt;    l_employee-wage = im_wage.&lt;/P&gt;&lt;P&gt;    APPEND l_employee TO i_employee_list.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;  Raise event employee_added_to_list&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;    RAISE EVENT employee_added_to_list&lt;/P&gt;&lt;P&gt;       EXPORTING ex_employee_name =  l_employee-name.&lt;/P&gt;&lt;P&gt;  ENDMETHOD.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; METHOD display_employee_list.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;  Displays all employees and there wage&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;    DATA: l_employee TYPE t_employee.&lt;/P&gt;&lt;P&gt;    WRITE: / 'List of Employees'.&lt;/P&gt;&lt;P&gt;    LOOP AT i_employee_list INTO l_employee.&lt;/P&gt;&lt;P&gt;      WRITE: / l_employee-no, l_employee-name, l_employee-wage.&lt;/P&gt;&lt;P&gt;    ENDLOOP.&lt;/P&gt;&lt;P&gt;  ENDMETHOD.&lt;/P&gt;&lt;P&gt;  METHOD display_no_of_employees.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;  Displays total number of employees&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;    SKIP 3.&lt;/P&gt;&lt;P&gt;    WRITE: / 'Total number of employees:', no_of_employees.&lt;/P&gt;&lt;P&gt;  ENDMETHOD.&lt;/P&gt;&lt;P&gt;  METHOD on_employee_added_to_list.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;  Event method&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;    WRITE: / 'Employee added to list', ex_employee_name.&lt;/P&gt;&lt;P&gt;  ENDMETHOD.&lt;/P&gt;&lt;P&gt;ENDCLASS.&lt;/P&gt;&lt;P&gt;*******************************************************&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Sub class LCL_BlueCollar_Employee&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;*******************************************************&lt;/P&gt;&lt;P&gt;CLASS lcl_bluecollar_employee DEFINITION&lt;/P&gt;&lt;P&gt;          INHERITING FROM lcl_company_employees.&lt;/P&gt;&lt;P&gt; See code in example 3...&lt;/P&gt;&lt;P&gt;ENDCLASS.&lt;/P&gt;&lt;P&gt;CLASS lcl_bluecollar_employee IMPLEMENTATION.&lt;/P&gt;&lt;P&gt; See code in example 3...&lt;/P&gt;&lt;P&gt;ENDCLASS.&lt;/P&gt;&lt;P&gt;*******************************************************&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Sub class LCL_WhiteCollar_Employee&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;*******************************************************&lt;/P&gt;&lt;P&gt;CLASS lcl_whitecollar_employee DEFINITION&lt;/P&gt;&lt;P&gt; See code in example 3...&lt;/P&gt;&lt;P&gt;ENDCLASS.&lt;/P&gt;&lt;P&gt;CLASS lcl_whitecollar_employee IMPLEMENTATION.&lt;/P&gt;&lt;P&gt; See code in example 3...&lt;/P&gt;&lt;P&gt;ENDCLASS.&lt;/P&gt;&lt;P&gt;*******************************************************&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;R E P O R T&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;*******************************************************&lt;/P&gt;&lt;P&gt;DATA:&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Object references&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;  o_bluecollar_employee1  TYPE REF TO lcl_bluecollar_employee,&lt;/P&gt;&lt;P&gt;  o_whitecollar_employee1 TYPE REF TO lcl_whitecollar_employee.&lt;/P&gt;&lt;P&gt;START-OF-SELECTION.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Create bluecollar employee obeject&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;  CREATE OBJECT o_bluecollar_employee1&lt;/P&gt;&lt;P&gt;      EXPORTING im_no  = 1&lt;/P&gt;&lt;P&gt;                im_name  = 'Karen Johnson'&lt;/P&gt;&lt;P&gt;                im_hours = 38&lt;/P&gt;&lt;P&gt;                im_hourly_payment = 75.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Register event for o_bluecollar_employee1&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;  SET HANDLER o_bluecollar_employee1-&amp;gt;on_employee_added_to_list&lt;/P&gt;&lt;P&gt;     FOR o_bluecollar_employee1.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Add bluecollar employee to employee list&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;  CALL METHOD o_bluecollar_employee1-&amp;gt;lif_employee~add_employee&lt;/P&gt;&lt;P&gt;      EXPORTING im_no  = 1&lt;/P&gt;&lt;P&gt;                im_name  = 'Gylle Karen'&lt;/P&gt;&lt;P&gt;                im_wage = 0.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Create whitecollar employee obeject&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;  CREATE OBJECT o_whitecollar_employee1&lt;/P&gt;&lt;P&gt;      EXPORTING im_no  = 2&lt;/P&gt;&lt;P&gt;                im_name  = 'John Dickens'&lt;/P&gt;&lt;P&gt;                im_monthly_salary = 10000&lt;/P&gt;&lt;P&gt;                im_monthly_deducations = 2500.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Register event for o_whitecollar_employee1&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;  SET HANDLER o_whitecollar_employee1-&amp;gt;on_employee_added_to_list&lt;/P&gt;&lt;P&gt;     FOR o_whitecollar_employee1.´&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Add bluecollar employee to employee list&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;  CALL METHOD o_whitecollar_employee1-&amp;gt;lif_employee~add_employee&lt;/P&gt;&lt;P&gt;      EXPORTING im_no  = 1&lt;/P&gt;&lt;P&gt;                im_name  = 'Gylle Karen'&lt;/P&gt;&lt;P&gt;                im_wage = 0.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Display employee list and number of employees. Note that the result&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;will be the same when called from o_whitecollar_employee1 or&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;o_bluecolarcollar_employee1, because the methods are defined&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;as static (CLASS-METHODS)&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  CALL METHOD o_whitecollar_employee1-&amp;gt;display_employee_list.&lt;/P&gt;&lt;P&gt;  CALL METHOD o_whitecollar_employee1-&amp;gt;display_no_of_employees.&lt;/P&gt;&lt;P&gt;Result:&lt;/P&gt;&lt;P&gt;Employee added to list Karen Johnson&lt;/P&gt;&lt;P&gt;Employee added to list John Dickens&lt;/P&gt;&lt;P&gt;List of Employees&lt;/P&gt;&lt;P&gt;1 Karen Johnson 2.850&lt;/P&gt;&lt;P&gt;2 John Dickens 7.500&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Total number of employees: 2&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 05 Jul 2007 04:51:01 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/oop-s-concept/m-p/2407118#M536623</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-07-05T04:51:01Z</dc:date>
    </item>
  </channel>
</rss>

