FUNCTION z_bapi_flight_getlist_small.
*"----------------------------------------------------------------------
*"*"Lokale Schnittstelle:
*"  IMPORTING
*"     VALUE(FLUG_INPUT) LIKE  ZFLUG_INPUT STRUCTURE  ZFLUG_INPUT
*"       OPTIONAL
*"  TABLES
*"      ITAB STRUCTURE  ZFLUG
*"      RETURN STRUCTURE  BAPIRET2 OPTIONAL
*"----------------------------------------------------------------------

* 3. Variante: BAPI-Aufruf
  DATA:
    from TYPE bapisfldst,
    to   TYPE bapisfldst,
    date TYPE TABLE OF bapisfldra WITH HEADER LINE,
    bapi_tab TYPE TABLE OF zbapisfldat WITH HEADER LINE.
  DATA:
    wa TYPE zflug.
  CLEAR: wa, itab.

*
  from-city = flug_input-cityfrom.
  to-city   = flug_input-cityto.
* Abfrage, ob 0, 1 oder 2 Datums-Felder gefüllt wurden
  IF flug_input-vondatum IS INITIAL AND
     flug_input-bisdatum IS INITIAL. "kein Feld gefüllt
*   do nothing!
  ELSEIF flug_input-vondatum IS INITIAL OR
    flug_input-bisdatum IS INITIAL. "praktisch: 2. Feld gefüllt
    date-option = 'EQ'. date-sign = 'I'.
    date-low  = flug_input-bisdatum.
    APPEND date.
  ELSE. "beide Felder gefüllt
    date-option = 'BT'. date-sign = 'I'.
    date-low  = flug_input-vondatum.
    date-high = flug_input-bisdatum.
    APPEND date.
  ENDIF.
*
  CALL FUNCTION 'Z_BAPI_FLIGHT_GETLIST'
    EXPORTING
      destination_from = from
      destination_to   = to
    TABLES
      date_range       = date
      return           = return
      flug_list        = bapi_tab.
  LOOP AT bapi_tab.
    wa-fldate    = bapi_tab-flightdate.
    wa-carrid    = bapi_tab-airlineid.
    wa-connid    = bapi_tab-connectid.
    wa-fltime    = bapi_tab-flighttime.
    wa-price     = bapi_tab-price.
    wa-currency  = bapi_tab-curr.
    wa-seatsfree = bapi_tab-seatsfree.
    APPEND wa TO itab.
  ENDLOOP.

ENDFUNCTION.