Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
An airline creates new flights and publicizes them in the media. Travel agencies
can then include these flights in their offerings.
A travel agent needs to register all the new flights, offered by a business partner, in the system
and offer the same towards their customers.
SOLUTION:
Create a local class LCL_TRAVEL_AGENCY, write a handler method for the
flight_created event and register the travel agency to the flight_created event that are
business partners of the travel agency.
The flights created by these airlines should be saved in the travel agency in a flight list .
Enter the flight type (ex_carrid) flight number (ex_connid) and the flight date (ex_fldate)
and a reference to the event trigger (sender) as IMPORTING parameters.
When implementing the add_a_new_flight method, enter the airline, the flight number
and the
flight date in the list of flights (list_of_flights). To do this, create a table work area in the
method. This table work area must have the same structure as the internal tablelist_of_flights.
Use the APPEND statement to fill the table.
Define and implement the public instance method display_list_of_flights to display the
flight list
list_of_flights. This method does not have any transfer parameters.
CODE:
CLASS lcl_plane DEFINITION.
PUBLIC SECTION.
TYPES: BEGIN OF flight_list_type,
carrid TYPE sflight-carrid,
connid TYPE sflight-connid,
fldate TYPE sflight-fldate,
END OF flight_list_type.
METHODS:
create_a_new_flight IMPORTING
im_carrid TYPE sflight-carrid
im_connid TYPE sflight-connid
im_fldate TYPE sflight-fldate.
* Definition of event FLIGHT_CREATED
EVENTS: flight_created EXPORTING
value(ex_carrid) TYPE sflight-carrid
value(ex_connid) TYPE sflight-connid
value(ex_fldate) TYPE sflight-fldate.
DATA:
list_of_flights TYPE TABLE OF flight_list_type,
wa_list_of_flights TYPE flight_list_type.
ENDCLASS.
"lcl_plane DEFINITION
"lcl_travel_agency DEFINITION
START-OF-SELECTION.
* Instantiating for class lcl_plane
CREATE OBJECT new_plane TYPE lcl_plane.
* Instantiating for class lcl_travel_agency
CREATE OBJECT ta TYPE lcl_travel_agency.
"lcl_plane IMPLEMENTATION
"lcl_travel_agency IMPLEMENTATION