Escolar Documentos
Profissional Documentos
Cultura Documentos
Workshop Goals
z Position of ABAP Objects within the R/3 System z Overview of the syntax of ABAP Objects z Working with existing classes and interfaces z Defining classes and interfaces z Creating objects z Reacting to events z Understanding the polymorphism provided by
Workshop Goals
Contents
z Introduction z From Function Groups to Classes z Classes z Objects z Events z Interfaces z Inheritance z Using Global Classes z Exercises
Introduction
Object Orientiation
Data
Data
Data
Data Data
Attributes
Data
Abstraction
Function
Methods
Function Function Function
Data
Function
Function Function
Function
Real-world objects
Objects
Interface
Private components
Flight
Public attributes
Airline Flight number
Private access
Customer
Address
Passengerlist
Public methods
BOOK
Public access
FLIGHT
Public events
ABAP Objects
z z ABAP ABAPObjects Objectsis isan anupwards-compatible upwards-compatibleextension extensionof ofthe the existing existingABAP ABAPlanguage language z z You Youcan canuse useexisting existingABAP ABAPstatements statementswithin withinABAP ABAPObjects Objects z z You Youcan canuse useABAP ABAPObjects Objectswithin withinexisting existingprograms programs z z ABAP ABAPObjects Objectsis isfully fullyintegrated integratedin inthe theABAP ABAPDebugger Debugger
Data
...
Data
...
FUNCTION-POOL COUNTER. DATA COUNT TYPE I. FUNCTION SET_COUNTER. * Local Interface IMPORTING VALUE(SET_VALUE) COUNT = SET_VALUE. ENDFUNCTION. FUNCTION INCREMENT_COUNTER. COUNT = COUNT + 1. ENDFUNCTION. FUNCTION GET_COUNTER. * Local Interface: EXPORTING VALUE(GET_VALUE) GET_VALUE = COUNT. ENDFUNCTION.
DATA NUMBER TYPE I VALUE 5. CALL FUNCTION 'SET_COUNTER' EXPORTING SET_VALUE = NUMBER. DO 3 TIMES. CALL FUNCTION 'INCREMENT_COUNTER'. ENDDO. CALL FUNCTION 'GET_COUNTER' IMPORTING GET_VALUE = NUMBER.
nth instance, class 1 1st instance, class 1 Daten SchnittData stelle Data Interface
... ... ...
nth instance, class m 1st instance, Daten class m Funktions- Data baustein Data Interface
... ... ...
z Example: Class as counter z Reference variables z Creating objects z Calling methods z Working with references
CLASS counter DEFINITION. PUBLIC SECTION. METHODS: set IMPORTING VALUE(set_value) TYPE i, increment, get EXPORTING VALUE(get_value) TYPE i. PRIVATE SECTION. DATA count TYPE i. CLASS ENDCLASS. CLASS counter counter IMPLEMENTATION. IMPLEMENTATION. METHOD set. METHOD set. count count = = set_value. set_value. ENDMETHOD. ENDMETHOD. METHOD METHOD increment. increment. count count = = count count + + 1. 1. ENDMETHOD. ENDMETHOD. METHOD METHOD get. get. get_value get_value = = count. count. ENDMETHOD. ENDMETHOD. ENDCLASS. ENDCLASS.
SAP AG 1999 ABAP Objects - Introduction (Horst Keller) / 15
Reference Variables
DATA: DATA: cnt_1 cnt_1 TYPE TYPE REF REF TO TO counter. counter.
CNT_1
SAP AG 1999 ABAP Objects - Introduction (Horst Keller) / 16
Creating an Object
DATA: DATA: cnt_1 cnt_1 TYPE TYPE REF REF TO TO counter. counter.
CREATE CREATE OBJECT OBJECT cnt_1 cnt_1 TYPE TYPE counter. counter.
1<COUNTER>
CNT_1
SAP AG 1999 ABAP Objects - Introduction (Horst Keller) / 17
Calling Methods
DATA: DATA: cnt_1 cnt_1 TYPE TYPE REF REF TO TO counter. counter. DATA DATA number number TYPE TYPE I I VALUE VALUE 5. 5. CREATE CREATE OBJECT OBJECT cnt_1 cnt_1 TYPE TYPE counter. counter. CALL CALL METHOD METHOD cnt_1->set cnt_1->set EXPORTING EXPORTING set_value set_value = = number. number. DO DO 3 3 TIMES. TIMES. CALL CALL METHOD METHOD cnt_1->increment. cnt_1->increment. ENDDO. ENDDO. 1<COUNTER> CALL CALL METHOD METHOD cnt_1->get cnt_1->get IMPORTING IMPORTING get_value get_value = = number. number.
CNT_1
DATA: DATA: cnt_1 cnt_1 TYPE TYPE cnt_2 cnt_2 TYPE TYPE cnt_3 cnt_3 TYPE TYPE
TO TO TO TO TO TO
Several Objects
DATA: DATA: cnt_1 cnt_1 TYPE TYPE cnt_2 cnt_2 TYPE TYPE cnt_3 cnt_3 TYPE TYPE
TO TO TO TO TO TO
1<COUNTER>
DATA: DATA: cnt_1 cnt_1 TYPE TYPE cnt_2 cnt_2 TYPE TYPE cnt_3 cnt_3 TYPE TYPE
TO TO TO TO TO TO
CREATE CREATE OBJECT: OBJECT: cnt_1, cnt_1, cnt_2. cnt_2. MOVE MOVE cnt_2 cnt_2 TO TO cnt_3. cnt_3. 2<COUNTER>
1<COUNTER>
DATA: DATA: cnt_1 cnt_1 TYPE TYPE cnt_2 cnt_2 TYPE TYPE cnt_3 cnt_3 TYPE TYPE
TO TO TO TO TO TO
CREATE CREATE OBJECT: OBJECT: cnt_1, cnt_1, cnt_2. cnt_2. MOVE MOVE cnt_2 cnt_2 TO TO cnt_3. cnt_3. CLEAR CLEAR cnt_2. cnt_2. 2<COUNTER>
1<COUNTER>
Garbage Collection
DATA: DATA: cnt_1 cnt_1 TYPE TYPE cnt_2 cnt_2 TYPE TYPE cnt_3 cnt_3 TYPE TYPE
TO TO TO TO TO TO
CREATE CREATE OBJECT: OBJECT: cnt_1, cnt_1, cnt_2. cnt_2. MOVE MOVE cnt_2 cnt_2 TO TO cnt_3. cnt_3. CLEAR CLEAR cnt_2. cnt_2. cnt_3 cnt_3 = = cnt_1. cnt_1. 1<COUNTER> 2<COUNTER>
Garbage Collection
DATA: DATA: cnt_1 cnt_1 TYPE TYPE cnt_2 cnt_2 TYPE TYPE cnt_3 cnt_3 TYPE TYPE
TO TO TO TO TO TO
CREATE CREATE OBJECT: OBJECT: cnt_1, cnt_1, cnt_2. cnt_2. MOVE MOVE cnt_2 cnt_2 TO TO cnt_3. cnt_3. CLEAR CLEAR cnt_2. cnt_2. cnt_3 cnt_3 = = cnt_1. cnt_1. 1<COUNTER> CLEAR CLEAR cnt_3. cnt_3. CNT_3 CNT_2 CNT_1
SAP AG 1999 ABAP Objects - Introduction (Horst Keller) / 24
New Objects
DATA: DATA: cnt_1 cnt_1 TYPE TYPE cnt_2 cnt_2 TYPE TYPE cnt_3 cnt_3 TYPE TYPE
TO TO TO TO TO TO
CREATE CREATE OBJECT: OBJECT: cnt_1, cnt_1, cnt_2. cnt_2. MOVE MOVE cnt_2 cnt_2 TO TO cnt_3. cnt_3. CLEAR CLEAR cnt_2. cnt_2. cnt_3 cnt_3 = = cnt_1. cnt_1. 1<COUNTER> CLEAR CLEAR cnt_3. cnt_3. CREATE CREATE OBJECT: OBJECT: cnt_2, cnt_2, cnt_3. cnt_3. CNT_3 CNT_2 CNT_1
SAP AG 1999 ABAP Objects - Introduction (Horst Keller) / 25
2<COUNTER>
DATA: DATA: cnt_1 cnt_1 TYPE TYPE cnt_2 cnt_2 TYPE TYPE cnt_3 cnt_3 TYPE TYPE
TO TO TO TO TO TO
CREATE CREATE OBJECT: OBJECT: cnt_1, cnt_1, cnt_2, cnt_2, cnt_3. cnt_3. CALL CALL METHOD METHOD cnt_1->set cnt_1->set EXPORTING EXPORTING set_value set_value = = 1. 1. CALL CALL METHOD METHOD cnt_2->set cnt_2->set EXPORTING EXPORTING set_value set_value = = 10. 10.
2<COUNTER>
1<COUNTER> CALL CALL METHOD METHOD cnt_3->set cnt_3->set EXPORTING EXPORTING set_value set_value = = 100. 100. CNT_3 CNT_2
CNT_1
Objects: Summary
z Creating objects
CREATE CREATE OBJECT: OBJECT: ref1, ref1, ref2. ref2.
x x = = ref1->attr ref1->attr + + ref2->attr. ref2->attr. CALL CALL METHOD METHOD ref1->method ref1->method EXPORTING EXPORTING ... ...
Classes in Detail
CLASS c1 DEFINITION. PUBLIC SECTION. DATA: a1 METHODS: m1 EVENTS: e1 PROTECTED SECTION. DATA: a2 METHODS: m2 EVENTS: e2 PRIVATE SECTION. DATA: a3 METHODS: m3 EVENTS: e3 ENDCLASS. CLASS c1 IMPLEMENTATION. METHOD m1. ENDMETHOD. METHOD m2. ENDMETHOD. METHOD m3. ENDMETHOD. ENDCLASS.
Protected components
a2, m2, e2,
CLASS CLASS ... ... DEFINITION. DEFINITION. ... ... ... ... SECTION. SECTION. DATA ... DATA ... TYPE TYPE CLASS-DATA CLASS-DATA ... ... TYPE TYPE CONSTANTS CONSTANTS ... ... TYPE TYPE ... ... ENDCLASS. ENDCLASS.
z DATA:
Instance attributes
CLASS CLASS c c DEFINITION. DEFINITION. PUBLIC PUBLIC SECTION. SECTION. ... ... CLASS-DATA CLASS-DATA a1(10) a1(10) TYPE TYPE C C VALUE VALUE 'Static'. 'Static'. DATA a2(10) DATA a2(10) TYPE TYPE C C VALUE VALUE 'Instance'. 'Instance'. ... ... ENDCLASS. ENDCLASS. DATA: DATA: cref cref TYPE TYPE REF REF TO TO c. c.
CLASS a1
...
1<CLASS> a2
...
WRITE WRITE c=>a1. c=>a1. CREATE CREATE OBJECT OBJECT cref cref TYPE TYPE c. c. WRITE WRITE cref->a2. cref->a2. CREF
[VALUE] [VALUE] ... ... [VALUE] [VALUE] ... ... [VALUE] [VALUE] ... ... VALUE(...) VALUE(...) ... ...
... ... [OPTIONAL] [OPTIONAL] ... ... ... ... [OPTIONAL] [OPTIONAL] ... ...
z METHODS:
Instance methods
Constructors
CLASS CLASS c c DEFINITION. DEFINITION. PUBLIC PUBLIC SECTION. SECTION. METHODS METHODS CONSTRUCTOR CONSTRUCTOR [IMPORTING [IMPORTING arg1 arg1 TYPE TYPE type type ... ... ]. ]. CLASS-METHODS CLASS-METHODS CLASS_CONSTRUCTOR. CLASS_CONSTRUCTOR. ENDCLASS. ENDCLASS. CLASS CLASS c c IMPLEMENTATION. IMPLEMENTATION. METHOD METHOD CONSTRUCTOR. CONSTRUCTOR. ... ... ENDMETHOD. ENDMETHOD. METHOD METHOD CLASS_CONSTRUCTOR. CLASS_CONSTRUCTOR. ... ... ENDMETHOD. ENDMETHOD. ENDCLASS. ENDCLASS. PROGRAM PROGRAM . . DATA DATA o1 o1 TYPE TYPE REF REF CREATE CREATE OBJECT OBJECT o1 o1 TO TO c. c. EXPORTING EXPORTING arg1 arg1 = = v1 v1 ... ...
z Instance components Instance attribute Instance method: z Static components Static attribute: Static method:
ref>comp ref->attr call method ref->meth class=>comp class=>attr call method class=>meth
n<class>
ME
Inheritance
z Introduction z Overview z Single inheritance z Redefining methods z Example: Subclass of superclass counter
Inheritance: Introduction
z Definition of a class by inheriting the components from a superclass (Reuse) z Specialization by adding own components and redefining methods in subclasses z Polymorphism by accessing subclass objects
n<class3> class1 CREF1
class2 CREF2
class3 CREF3
SAP AG 1999 ABAP Objects - Introduction (Horst Keller) / 36
Inheritance - Overview
Class OBJECT ...
CLASS c1 DEFINITION INHERITING FROM ... ... ENDCLASS. CLASS c1 IMPLEMENTATION. ... ENDCLASS.
Class c1
Class c2
CLASS c2 DEFINITION INHERITING FROM c1. ... ENDCLASS. CLASS c2 IMPLEMENTATION. ... ENDCLASS.
Single Inheritance
OBJECT
C1
...
...
C2
...
SAP AG 1999 ABAP Objects - Introduction (Horst Keller) / 38
Redefining Methods
CLASS CLASS ... ... DEFINITION DEFINITION INHERITING INHERITING FROM FROM ... ... ... ... SECTION. SECTION. METHODS METHODS ... ... REDEFINITON REDEFINITON ... ... ... ... ... ... ENDCLASS. ENDCLASS.
CLASS CLASS ... ... IMPLEMENTATION. IMPLEMENTATION. METHOD METHOD ... ... ... ... ENDMETHOD. ENDMETHOD. ENDCLASS. ENDCLASS.
Semantic rules
z Subclasses must behave just like their superclass for all users of
inherited components
z A redefined method must observe the original semantics z Inheritance should only be used to specialize
SAP AG 1999 ABAP Objects - Introduction (Horst Keller) / 39
CLASS CLASS subclass subclass DEFINITION DEFINITION INHERITING INHERITING FROM FROM superclass. superclass. PUBLIC PUBLIC SECTION. SECTION. METHODS METHODS CONSTRUCTOR CONSTRUCTOR IMPORTING IMPORTING ... ... ... ... ENDCLASS. ENDCLASS. CLASS CLASS subclass subclass IMPLEMENTATION. IMPLEMENTATION. METHOD METHOD CONSTRUCTOR. CONSTRUCTOR. Access to static ... ... attributes only CALL CALL METHOD METHOD SUPER->CONSTRUCTOR SUPER->CONSTRUCTOR EXPORTING EXPORTING ... ... ... ... ENDMETHOD. ENDMETHOD. Accress to instance ... ... attributes also ENDCLASS. ENDCLASS.
PROGRAM PROGRAM ... ... DATA DATA o1 o1 TYPE TYPE REF REF CREATE CREATE OBJECT OBJECT o1 o1 TO TO subclass. subclass. TYPE TYPE subclass subclass EXPORTING EXPORTING ... ...
Interfaces
z Introduction z Overview z Definition z Implementation z Interface references z Example: Interface for counter
Interfaces: Introduction
z Definition of an interface without implementation z Classes can implement several interfaces z Uniform access with interface references z Polymorphism independent from inheritance
n<class3>
iref_tab
Interface
Interfaces - Overview
Private components
a2, m2, e2 Method implementations
CLASS c1 DEFINITION. PUBLIC SECTION. DATA a1 ... INTERFACES i1 ... PROTECTED SECTION. PRIVATE SECTION. ENDCLASS. CLASS c1 IMPLEMENTATION. METHOD i1~m1. ENDMETHOD. ENDCLASS.
SAP AG 1999 ABAP Objects - Introduction (Horst Keller) / 44
Interfaces - Definition
INTERFACE INTERFACE ... ... ... ... DATA: DATA: CLASS-DATA: CLASS-DATA: CONSTANTS: CONSTANTS:
. . ... ... ... ... ... ... TYPE TYPE TYPE TYPE TYPE TYPE ... ... ... ... ... ... [READ-ONLY] [READ-ONLY] ... ... [READ-ONLY] [READ-ONLY] ... ... [VALUE [VALUE ...] ...] TYPE TYPE TYPE TYPE TYPE TYPE TYPE TYPE ... ... [OPTIONAL] [OPTIONAL] ... ... ... ... [OPTIONAL] [OPTIONAL] ... ...
METHODS: METHODS: ... ... IMPORTING IMPORTING EXPORTING EXPORTING CHANGING CHANGING RETURNING RETURNING EXCEPTIONS EXCEPTIONS CLASS-METHODS: CLASS-METHODS: ... ...
[VALUE] [VALUE] ... ... [VALUE] [VALUE] ... ... [VALUE] [VALUE] ... ... VALUE(...) VALUE(...) ... ...
EVENTS: EVENTS: ... ... [EXPORTING [EXPORTING VALUE(...) VALUE(...) TYPE TYPE ... ... [OPTIONAL]]. [OPTIONAL]]. CLASS-EVENTS:... CLASS-EVENTS:... INTERFACES: INTERFACES: ... ... ENDINTERFACE. ENDINTERFACE.
Interfaces - Implementation
CLASS CLASS ... ... DEFINITION. DEFINITION. PUBLIC PUBLIC SECTION. SECTION. INTERFACES: INTERFACES: ... ... ... ... ... ... ENDCLASS. ENDCLASS.
CLASS CLASS ... ... IMPLEMENTATION. IMPLEMENTATION. METHOD METHOD ...~... ...~... ... ... ENDMETHOD. ENDMETHOD. ENDCLASS. ENDCLASS.
Interface References
INTERFACE INTERFACE i1. i1. ... ... ENDINTERFACE. ENDINTERFACE. CLASS CLASS c1 c1 DEFINITION. DEFINITION. PUBLIC PUBLIC SECTION. SECTION. DATA DATA a1. a1. INTERFACES INTERFACES i1. i1. ENDCLASS. ENDCLASS. CLASS CLASS c2 c2 DEFINITION. DEFINITION. PUBLIC PUBLIC SECTION. SECTION. INTERFACES INTERFACES i1. i1. ENDCLASS. ENDCLASS. CNT_1 DATA DATA cnt_c cnt_c TYPE TYPE DATA: DATA: cnt_1 cnt_1 TYPE TYPE cnt_2 cnt_2 LIKE LIKE REF REF TO TO c1. c1. REF REF TO TO i1, i1, cnt_1. cnt_1. 1<C2>
1<C1>
CNT_C
CREATE CREATE OBJECT: OBJECT: cnt_c cnt_c TYPE TYPE c1, c1, cnt_1 cnt_1 TYPE TYPE c2. c2. CNT_2 MOVE MOVE cnt_c cnt_c to to cnt_2. cnt_2.
SAP AG 1999 ABAP Objects - Introduction (Horst Keller) / 47
CLASS CLASS bicycle bicycle DEFINITION. DEFINITION. PUBLIC SECTION. PUBLIC SECTION. INTERFACES INTERFACES status. status. METHODS drive. METHODS drive. PRIVATE PRIVATE SECTION. SECTION. DATA DATA speed speed TYPE TYPE i. i. ENDCLASS. ENDCLASS.
DATA: DATA: count count TYPE TYPE REF REF TO TO counter, counter, bike bike TYPE TYPE REF REF TO TO bicycle, bicycle, status status TYPE TYPE REF REF TO TO status. status. CREATE CREATE OBJECT: OBJECT: count, count, bike. bike. DO DO 5 5 TIMES. TIMES. CALL CALL METHOD: METHOD: count->increment, count->increment, bike->drive. bike->drive. ENDDO. ENDDO. status status = = count. count. CALL METHOD CALL METHOD status->write. status->write. status status = = bike. bike. CALL METHOD CALL METHOD status->write. status->write.
Counter status
Bike speed
SAP AG 1999 ABAP Objects - Introduction (Horst Keller) / 49
Events
Events - Introduction
z Events are components of classes z Methods can raise the events of their class z Handler methods can be triggered by events
Events - Overview
CLASS c1 DEFINITION. PUBLIC SECTION. EVENTS e1 EXPORTING VALUE(p1) TYPE i. METHODS m1. PRIVATE SECTION. DATA a1 TYPE i. ENDCLASS. CLASS c1 IMPLEMENTATION. METHOD m1. a1 = ... RAISE EVENT e1 EXPORTING p1 = a1. ENDMETHOD. ENDCLASS.
Event trigger
SAP AG 1999 ABAP Objects - Introduction (Horst Keller) / 52
Event handler
CLASS CLASS ... ... DEFINITION. DEFINITION. ... ... SECTION. SECTION. METHODS METHODS ... ... FOR FOR EVENT EVENT ... ... OF OF ... ... [IMPORTING [IMPORTING ... ... SENDER SENDER ... ... ]. ].
ENDCLASS. ENDCLASS.
CLASS CLASS ... ... IMPLEMENTATION. IMPLEMENTATION. METHOD METHOD ... ... ... ... ENDMETHOD. ENDMETHOD. ENDCLASS. ENDCLASS.
PROGRAM PROGRAM ... ... DATA: DATA: trigger trigger handler_1 handler_1 handler_2 handler_2 TYPE TYPE TYPE TYPE TYPE TYPE REF REF REF REF REF REF TO TO TO TO TO TO trigger, trigger, handler, handler, handler. handler.
CREATE CREATE OBJECT: OBJECT: trigger, trigger, handler_1, handler_1, handler_2. handler_2. SET SET HANDLER HANDLER handler_1->handle_event handler_1->handle_event handler_2->handle_event handler_2->handle_event FOR FOR trigger. trigger. CALL CALL METHOD METHOD trigger->raise_event. trigger->raise_event.
2<HANDLER>
1<HANDLER>
.
1<TRIGGER>
z Class pools z Class Browser and Class Builder z Class Builder z Example: Using CL_GUI_PICTURE
Class Pools
CLASS-POOL ... TYPES TYPES CLASS CLASS ... ... ENDCLASS. ENDCLASS. INTERFACE INTERFACE ... ... ENDINTERFACE. ENDINTERFACE.
Visibility
CLASS CLASS DEFINITION DEFINITION PUBLIC. PUBLIC. ... ... ENDCLASS. ENDCLASS. CLASS CLASS IMPLEMENTATION. IMPLEMENTATION. ... ... ENDCLASS. ENDCLASS.
SAP AG 1999 ABAP Objects - Introduction (Horst Keller) / 60
Class Builder
Example of CL_GUI_PICTURE
Mouse Click
Further Information
Further Information
Transaction
ABAPDOCU
Further Information
Keyword Documentation
Exercises
1. Defining classes 2. Creating objects 3. Deriving classes using inheritance 4. Using interfaces 5. Triggering and handling events
Exercises - Scenario
Interface Status With methods for displaying attributes
Class "Vehicle" with attribute for speed, and a method for changing it
Class "Helicopter" Can handle events from ship Class "Truck" with its own maximum speed and attribute output
Class "Ship" with its own maximum speed and attribute output, a name, and an event
Exercise 1 - Classes
z Copy the template ABAP_OBJECTS_ENJOY_0 into an own program. z Define a local class VEHICLE in the designated area in front of the
MAX_SPEED for its speed and maximum speed, and the public methods SPEED_UP, STOP, and WRITE.
z SPEED_UP should have an IMPORTING parameter STEP. The method
should increase the speed by STEP, but not allow it to exceed the maximum speed.
z STOP should reset the speed to zero.
z WRITE should display a list line containing the speed and the maximum speed.
Exercise 2 - Objects
z Continuing the program from exercise 1, create objects from the class
VEHICLE.
z Program the respective coding in the predefined method START of class
MAIN.
z Define a reference variable VEHICLE with type VEHICLE, and an internal
table VEHICLE_TAB, whose line type is also a reference variable to this class.
z In a DO loop, create a number of instances of the class VEHICLE and
each entry in the internal table. When you call SPEED_UP, pass the value SY-TABIX * 10 to the parameter STEP.
Exercise 3 - Inheritance
z Change your program from exercise 2 to define classes TRUCK and SHIP
method WRITE.
z The class SHIP should have an IMPORTING parameter NAME, a new
public attribute NAME, and should also redefine the method WRITE.
z The instance constructor of each class should change the maximum
speed. The instance constructor of SHIP should set the attribute NAME to the actual parameter that you imported.
z The WRITE method should show the class from which the display comes.
one instance of each of your new classes and place the corresponding reference into VEHICLE_TAB.
z Call the method SPEED_UP for both classes using the correct subclass
Exercise 4 - Interfaces
z Change your program from exercise 3 so that the method WRITE is
WRITE method. The name must be changed accordingly in each implementation (including the subclasses), but the function remains the same.
z Replace the reference variables VEHICLE and the table VEHICLE_TAB
corresponding object, and insert the reference variable into the table STATUS_TAB.
Exercise 5 - Events
z Change your program from exercise 4 to include an event DAMAGED for