abap 750 filter example

Example: abap 750 filter example

DATA: lt_flights_all TYPE STANDARD TABLE OF spfli
                     WITH NON-UNIQUE SORTED KEY carrid
                     COMPONENTS carrid,
      lt_flight_final TYPE STANDARD TABLE OF spfli.

SELECT *  FROM spfli
          INTO TABLE @lt_flights_all.

* Create a filter internal table with multiple values
DATA filter_tab  TYPE SORTED TABLE OF scarr-carrid
                 WITH UNIQUE KEY table_line.
filter_tab = VALUE #( ( 'AA ' ) ( 'LH ' ) ).

* Apply filters
lt_flight_final = FILTER #( lt_flights_all IN filter_tab
                                           WHERE carrid = table_line ).

cl_demo_output=>write_data( lt_flights_all ).
cl_demo_output=>write_data( lt_flight_final ).
cl_demo_output=>display( ).

Tags:

Misc Example