Get Example source ABAP code based on a different SAP table
FILTER>, Basic Form
ABAP_SYNTAX ... FILTER type( itab $[EXCEPT$] $[USING KEY keyname>$] WHERE c1 op f1 $[AND c2 op f2 $[...$]$] ) ...>
ABAP Addition 1 ... USING KEY keyname> 2 ... WHERE c1 op v1 $[AND c2 op v2 $[...$]$]>
What does it do? This variant of the filter operator FILTER>> filters itab > using single values. The columns of a table key of itab> are compared with single values in the WHERE> condition. Those lines of itab> are used that meet the WHERE> condition or do not meet it when EXCEPT> is specified. Here, the internal table itab> must have at least one sorted key> or one hash key> used for access. This can be
either the primary table key> used without specifying USING KEY> or by specifying its name primary_key> after USING KEY>,
or a secondary table key> used by specifying its name after USING KEY>. This variant of the filter operator is not possible for an internal table itab> without a sorted key or hash key.
ABAP_EXAMPLE_VX5 Filtering of the messages of a work area from the database table T100> by language. ABEXA 00906 ABAP_EXAMPLE_END
ABAP Addition
What does it do? Specifies the table key keyname>> with which the WHERE> condition is evaluated. A sorted key or a hash key of the table itab> can be specified. If the primary key of itab > is not a sorted key or hash key, itab> must have a secondary key of this type and it must be specified using USING KEY>.
ABAP_EXAMPLE_VX5 Like the preceding example, but here a secondary table key must be specified explicitly since the internal table messages> is a standard table without a primary key. ABEXA 00907 ABAP_EXAMPLE_END
ABAP Addition
What does it do? A condition for the table key used in the FILTER> expression must be specified after WHERE>:
In the case of a hash key, exactly one comparison expression> c op f> for each key component. The only comparison operator> allowed for op > is =>>.
In the case of a sorted key, an initial part of the key must be covered by comparison expressions> c op f>. op> can be any binary comparison operator>. Multiple comparisons can be combined using AND > > only. There can be no further comparisons apart from those mentioned for key components. In the basic form, key components of the internal table itab> must be specified for the left operands c1>, c2>, ... On the right side, data objects f1>, f2>, ... must be specified that are compatible with the left side. f1>, f2>, ... are general expression positions>.
Latest notes:
The Boolean operators NOT>>, OR>>, and EQUIV> > cannot be used in the WHERE> condition. NON_V5_HINTS
The obsolete comparison operators> cannot be used in the WHERE> condition. ABAP_HINT_END
ABAP_EXAMPLE_ABEXA Table Filtering, Single Values> ABAP_EXAMPLE_END