"! <p class="shorttext synchronized" lang="en">OO Tutorial #5A - Tester with iTab of references</p>
CLASS ZCL_OO_TUTORIAL_5A_TESTER DEFINITION
  PUBLIC
  FINAL
  CREATE PUBLIC .

  PUBLIC SECTION.
    INTERFACES IF_OO_ADT_CLASSRUN.
  PROTECTED SECTION.
  PRIVATE SECTION.
ENDCLASS.



CLASS ZCL_OO_TUTORIAL_5A_TESTER IMPLEMENTATION.


  METHOD IF_OO_ADT_CLASSRUN~MAIN.

    TYPES: BEGIN OF T_FLIGHT_REF,
             CARRIER_ID    TYPE /DMO/CARRIER_ID,
             CONNECTION_ID TYPE /DMO/CONNECTION_ID,
             FLIGHT_DATE   TYPE /DMO/FLIGHT_DATE,
             FLIGHT_OBJECT TYPE REF TO ZCL_OO_TUTORIAL_5,
           END OF T_FLIGHT_REF.
    DATA FLIGHTS TYPE STANDARD TABLE OF T_FLIGHT_REF WITH EMPTY KEY.
    TRY.
        SELECT CARRIER_ID, CONNECTION_ID, FLIGHT_DATE
               FROM /DMO/FLIGHT
               INTO CORRESPONDING FIELDS OF TABLE @FLIGHTS.
        INSERT VALUE #( CARRIER_ID = `UA` CONNECTION_ID = `0017` FLIGHT_DATE  = `20190530` ) INTO TABLE FLIGHTS.

        LOOP AT FLIGHTS REFERENCE INTO DATA(FLIGHT).
          FLIGHT->FLIGHT_OBJECT = NEW ZCL_OO_TUTORIAL_5(
            CARRIER_ID    = FLIGHT->CARRIER_ID
            CONNECTION_ID = FLIGHT->CONNECTION_ID
            FLIGHT_DATE   = FLIGHT->FLIGHT_DATE ).
          DATA(FLIGHT_PRICE) = FLIGHT->FLIGHT_OBJECT->CALCULATE_FLIGHT_PRICE( ).
          OUT->WRITE( |Flight Price for { FLIGHT->CARRIER_ID }-{ FLIGHT->CONNECTION_ID } on { FLIGHT->FLIGHT_DATE DATE = ENVIRONMENT }: | &&
                             |{ FLIGHT_PRICE-PRICE CURRENCY = FLIGHT_PRICE-CURRENCY } { FLIGHT_PRICE-CURRENCY }| ).
          OUT->WRITE( FLIGHT->FLIGHT_OBJECT->GET_FLIGHT_DETAILS( ) ).
          OUT->WRITE( ` `).
        ENDLOOP.


      CATCH ZCX_OO_TUTORIAL INTO DATA(CX_FLIGHT).
        OUT->WRITE(  CX_FLIGHT->GET_TEXT(  ) ).
    ENDTRY.
  ENDMETHOD.
ENDCLASS.
