[ABAP] Interne Tabelle mit VALUE und FOR kopieren, Tabellenindex der Datensätze übertragen

TYPES: BEGIN OF ty_sflight,
         carrid TYPE sflight-carrid,
         connid TYPE sflight-connid,
       END OF ty_sflight.

TYPES: BEGIN OF ty_sflight_filter,
         index  TYPE i,
         carrid TYPE sflight-carrid,
         connid TYPE sflight-connid,
       END OF ty_sflight_filter.

DATA: it_sflight TYPE STANDARD TABLE OF ty_sflight.
DATA: it_sflight_filter TYPE STANDARD TABLE OF ty_sflight_filter.
DATA: o_salv TYPE REF TO cl_salv_table.

* nach carrid und connid gruppieren und die Preise pro Gruppe summieren
SELECT carrid, connid FROM sflight INTO TABLE @it_sflight.

* alle Datensätze mit 'LH' kopieren, Index der Quelle merken
it_sflight_filter = VALUE #( FOR l IN it_sflight INDEX INTO idx WHERE ( carrid = 'LH' )
                             ( index = idx
                               carrid = l-carrid
                               connid = l-connid ) ).

cl_salv_table=>factory( IMPORTING
                          r_salv_table   = o_salv
                        CHANGING
                          t_table        = it_sflight_filter ).

o_salv->display( ).