Get Example source ABAP code based on a different SAP table
• FILTER ABAP_CONSTRUCTOR • # FILTER • USING KEY FILTER • WHERE FILTER • AND FILTER
FILTER>, Filter Operator
ABAP_SYNTAX_FORMS
Basic Form> 1 ... FILTER type( itab $[EXCEPT$] $[USING KEY keyname>$] WHERE c1 op f1 $[AND c2 op f2 $[...$]$] ) ...>
Filter Table> 2 ... FILTER type( itab $[EXCEPT$] IN ftab $[USING KEY keyname>$] WHERE c1 op f1 $[AND c2 op f2 $[...$]$] ) ...>
ABAP Addition ... EXCEPT>
What does it do? A constructor expression> with the component operator FILTER> creates a result of a table type specified using type>. The lines are taken from an existing internal table itab> in accordance with the condition after WHERE>, converted to the line type of type>, and inserted into the target table in accordance with the rules of INSERT> ... INTO TABLE>>. The order in which the lines are taken from itab> depends on its table category> and the addition USING KEY> and is the same as for LOOP AT itab>>.
In the basic form>, the condition is created with single values.
When using a filter table>, the condition is created with values from the filter table ftab>. The following can be specified for type>:
A non-generic table type>.
The #> character as a symbol for the operand type>. If the data type required in an operand position is not unique and not known completely, the type of itab> is used if known. itab> is a functional operand position>. The line type of itab> must be convertible to the line type of the target type type>. USING KEY> can or must be used to specify a table key for evaluating itab> or ftab> , depending on the variant.
Latest notes:
Table filtering can also be performed using a table comprehension> or a table reduction> with an iteration expression> for table iterations> with FOR>>. The operator FILTER> provides a shorter notation for this special case and is more efficient to execute.
A table filter constructs the result line by line. If the result contains almost all lines in the source table, this method can be slower than copying the source table and deleting the surplus lines from the target table. NON_V5_HINTS ABAP_HINT_END • EXCEPT FILTER
ABAP Addition
What does it do? If EXCEPT> is not specified, those lines from itab> are used that meet the WHERE> condition. If EXCEPT> is specified, those lines from itab> are used that do not meet the WHERE> condition.
Latest notes: The addition EXCEPT> is not the same as a negation of the WHERE> condition, particularly in the variant with a filter table>. NON_V5_HINTS ABAP_HINT_END
ABAP_EXAMPLE_VX5 Use of the addition EXCEPT> in the basic form> of the FILTER > operator. The constructed table contains messages of all languages except D>. ABEXA 00900 ABAP_EXAMPLE_END