* event handler for checking and processing user input and
* for defining navigation
  TRANSLATE:
    wa1-cityfrom TO UPPER CASE,
    wa1-cityto   TO UPPER CASE.

  CALL METHOD application->check_date
    EXPORTING
      flug_input = wa1
      page       = page
    IMPORTING
      mess       = mess
      cursor     = cursor.
  CALL METHOD application->check_city
    EXPORTING
      flug_input = wa1
      page       = page
    IMPORTING
      mess       = mess
      cursor     = cursor.

* Auswahlliste von Zielort in Abhängigkeit von ausgewähltem Abflugort!
  IF cityfrom EQ 'Abflugort' .
    cursor  = 'cityfrom'.
    MESSAGE e002(zflug) WITH cityfrom
      INTO mess.
    page->messages->add_message(
      condition = cursor
      message = mess ).
*      message = 'Wählen Sie bitte einen Ablugort!' ).
    navigation->set_parameter( 'cursor' ).
  ENDIF.
* ob der Zielort gewählt wird.
  IF cityto EQ 'Zielort' .
    cursor  = 'cityto'.
    page->messages->add_message(
      condition = cursor
      message = 'Wählen Sie bitte einen Zielort!' ).
    navigation->set_parameter( 'cursor' ).
  ENDIF.

  IF NOT mess IS INITIAL.
    navigation->set_parameter( 'cursor' ).
    navigation->set_parameter( 'wa1' ).
  ELSE.
    CASE event_id.
      WHEN 'ziel'.
        navigation->set_parameter( 'wa1-cityfrom' ).
        CALL METHOD application->get_city_couples
          EXPORTING
            cityfrom     = wa1-cityfrom
          IMPORTING
            cityfrom_tab = cityfrom_tab
            cityto_tab   = cityto_tab.

      WHEN 'find'.
        itab = application->get_flightlist_small( wa1 ).
* itab mit Daten über Server-Cookie zwischenspeichern
        username = sy-uname.
        CALL METHOD cl_bsp_server_side_cookie=>set_server_cookie
          EXPORTING
            name                  = 'HALLO'
            application_name      = runtime->application_name
            application_namespace = runtime->application_namespace
            username              = username
            session_id            = runtime->session_id
            data_value            = itab
            data_name             = 'itab'
            expiry_time_rel       = 3600.

        navigation->set_parameter( 'wa1' ).
        navigation->goto_page( 'flights.htm' ) .
      WHEN 'exit'.
        navigation->exit( 'http://www.fh-augsburg.de' ).
    ENDCASE.
  ENDIF.

