

The internal table on which FILTER operator is used must have at least one sorted key or one hash key used for access.Output look like below Notesīelow are some points to keep in mind when using the FILTER operator So by using the help filter table you can apply FILTERing on internal tables. Lt_flight_final = FILTER #( lt_flights_all IN filter_tabĬl_demo_output=>write_data( lt_flights_all ).Ĭl_demo_output=>write_data( lt_flight_final ). INTO TABLE Create a filter internal table with multiple valuesĭATA filter_tab TYPE SORTED TABLE OF scarr-carridįilter_tab = VALUE #( ( 'AA ' ) ( 'LH ' ) ). Lt_flight_final TYPE STANDARD TABLE OF spfli. DATA: lt_flights_all TYPE STANDARD TABLE OF spfli
Abap delete itab where not in code#
Sample code snippet will look like something below. In previous example we performed the filter with a single value, now add some more filter values. One which contains the actual data on which filtering is applied and other is filter internal table which contains the filter values used for filtering. To explain FILTER with filter table syntax form, we need two internal tables. The above example is a basic syntax form using FILTER keyword, now look at the another syntax form with filter table FILTER with filter table Yes, that is just a line of statement to filter the data using FILTER keyword. Lt_flight_lh = FILTER #( lt_flights_all USING KEY carridĪs a result, the internal table LT_FLIGHTS_ALL is filtered on WHERE condition and filtered data will be available in the internal table LT_FLIGHT_LH. Lets take the same above example and refine the internal table filtering logic with the new FILTER keyword. Lets let get to know more about it with some examples. So, as of ABAP 7.4, the FILTER keyword came into our world to save us from those extra keyboard hits. We definitely need some change here, is it ? That’s hell of a coding lines written for just simple task and if the complexity of filtering logic increase we need to write more lines of ABAP code. LOOP AT lt_flights_all INTO DATA(ls_flight) WHERE carrid = 'LH'. Lt_flight_lh TYPE STANDARD TABLE OF spfli. DATA: lt_flights_all TYPE STANDARD TABLE OF spfli,
