Ansicht
Dokumentation

ABENCONSTRUCTOR_EXPR_FILTER_TABLE - CONSTRUCTOR EXPR FILTER TABLE

ABENCONSTRUCTOR_EXPR_FILTER_TABLE - CONSTRUCTOR EXPR FILTER TABLE

General Material Data   ABAP Short Reference  
This documentation is copyright by SAP AG.
SAP E-Book

FILTER, Filter Table

... FILTER type( itab ${$[EXCEPT$] IN ftab $[USING KEY keyname$]$}
                    $| ${$[USING KEY keyname$] $[EXCEPT$] IN ftab$}
                       WHERE c1 op f1 $[AND c2 op f2 $[...$]$] ) ...


Additions

1. ... USING KEY keyname

2. ... WHERE c1 op v1 $[AND c2 op v2 $[...$]$]

Effect

This variant of the filter operator FILTER filters itab using values from an internal table ftab. In the WHERE condition, the columns of itab are compared with the values of the columns of the table key of the lines of the filter table ftab. Those lines in itab are used for which at least one line in ftab meets the WHERE condition or for which there is no line in ftab when EXCEPT is specified. ftab is a functional operand position.

Depending on its position, USING KEY can be used to specify either a key of the table ftab or the table itab, which is then used to access the table. If USING KEY is not used, the filter table ftab must have a sorted key or a hash key as the primary table key, which is then used to access the filter table.

Note

The line types of itab and ftab do not need to be identical.

Example

Filtering of three lines of the internal table carriers. The filter table has a sorted primary key. This is used implicitly and the addition USING KEY does not have to be specified.

Addition 1

... USING KEY keyname

Effect

Specification of the table key keyname with which the WHERE condition is evaluated. A sorted key or a hash key of the filter table can be specified after ftab or of the source table after itab. This can be the primary table key or a secondary table key that is specified using primary_key or the corresponding name.

  • When USING KEY is specified for the filter table ftab, it must have a sorted key or a hash key. There are no requirements on the table keys of itab. The specified key is used to access the filter table.
  • When USING KEY is specified for the source table itab, it must have a sorted key or a hash key. There are no requirements on the table keys of ftab. The specified key is used to access the source table.
  • If USING KEY is not specified for ftab or itab, the filter table ftab must be a sorted table or a hashed table and the primary table key is used implicitly when accessing the filter table. There are no requirements on the table keys of itab.

Note

The tables for which a key is specified depends on the optimization to be achieved.

Example

Like the previous example, but here the addition USING KEY must be used for one of the tables, since the internal table filter is a standard table without a primary key.

Example

Like the previous example, but here the addition USING KEY is used for the other table.

Addition 2

... WHERE c1 op f1 $[AND c2 op f2 $[...$]$]

Effect

A condition for the table key used in the FILTER expression must be specified after WHERE:

Multiple comparisons can only be combined using AND only. There can be no further comparisons apart from those mentioned for key components. In the variant with the filter table, key components of the filter table ftab must be specified for the right operands f1, f2, .... On the left side, components of the internal table itab must be specified that are compatible with the right side.

Notes

  • The Boolean operators NOT, OR, and EQUIV cannot be used in the WHERE condition.






RFUMSV00 - Advance Return for Tax on Sales/Purchases   Vendor Master (General Section)  
This documentation is copyright by SAP AG.

Length: 7479 Date: 20240508 Time: 152638     sap01-206 ( 118 ms )