*&---------------------------------------------------------------------*
*& Report  Z_SDN_DEBUG1
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*

REPORT  z_sdn_debug1.

DATA: isflight  TYPE TABLE OF sflight.
DATA: isflight2 TYPE TABLE OF sflight.
DATA: isflight3 TYPE TABLE OF sflight.
DATA: flight_model TYPE REF TO  zcl_sdn_debug_sflight.

START-OF-SELECTION.

  SELECT * FROM sflight INTO TABLE isflight.

  FIELD-SYMBOLS <wa_sflight> LIKE LINE OF isflight.
  LOOP AT isflight ASSIGNING <wa_sflight> .
    WRITE: / <wa_sflight>-carrid, <wa_sflight>-connid,
             <wa_sflight>-fldate.
  ENDLOOP.

  SELECT * FROM sflight INTO TABLE isflight2 WHERE carrid NE 'AA'.

  LOOP AT isflight2 ASSIGNING <wa_sflight> .
    WRITE: / <wa_sflight>-carrid, <wa_sflight>-connid,
             <wa_sflight>-fldate.
  ENDLOOP.

  CREATE OBJECT flight_model.
  isflight3 = flight_model->get_sflight( ).

  LOOP AT isflight3 ASSIGNING <wa_sflight> .
    WRITE: / <wa_sflight>-carrid, <wa_sflight>-connid,
             <wa_sflight>-fldate.
  ENDLOOP.

  DATAtable   TYPE REF TO cl_salv_table.
  DATA: salv_msg TYPE REF TO cx_salv_msg.
  DATA: error_string TYPE string.
  TRY.
      cl_salv_table=>factory(
        EXPORTING
          list_display = abap_false
        IMPORTING
          r_salv_table = table
        CHANGING
          t_table      = isflight3 ).
    CATCH cx_salv_msg INTO salv_msg.
      MESSAGE salv_msg TYPE 'E'.
  ENDTRY.
  table->display( ).

  DATA: x_sflight TYPE xstring.
  CALL TRANSFORMATION id
      SOURCE sflight = isflight3
      RESULT XML x_sflight.

  DATA: x_sflight2 TYPE xstring.
  CALL TRANSFORMATION id
      SOURCE sflight = isflight2
      RESULT XML x_sflight2.

*  CLEAR isflight3.
  ASSERT isflight3 IS NOT INITIAL.

*  SORT isflight3 BY carrid.
  SORT isflight3 BY connid.
  ASSERT ID zsdn_demo
         SUBKEY  'sflight_sorted'
         fields isflight3
         CONDITION zcl_sdn_debug_sflight=>is_sorted( isflight3 ) = `X` .

  READ TABLE isflight3 ASSIGNING <wa_sflight>
    WITH KEY carrid = 'AA'
    BINARY SEARCH.


*Dummy Logic
  IF isflight3 IS INITIAL.
  ENDIF.