Filter Condition 
A filter condition is a logical expression that compares the attributes of a persistent class with free parameters or values. The syntax of a filter condition is based on the syntax of the Open SQL WHERE condition, whereby reference variables for object reference types are also supported. Like a WHERE condition, a filter condition is made up of elementary comparisons that can be linked with the logical operands AND, OR, and NOT, whereby grouping using round parentheses is supported.
When a query is executed using a class actor, the query is bound precisely to its persistent class. The attributes specified in a filter condition must be available in the persistent class as public persistent attributes, otherwise an exception occurs. On the other hand, a query that has been created can certainly be executed in succession by class actors of different persistent classes, as long as the specified attributes are available. When a query is executed, a SELECT statement is created internally with a WHERE condition, in which the attributes are replaced by concrete column identifiers and the free parameters are replaced by current values.
The elementary comparison operands below are supported in a filter condition. As the first operand in a condition, you have to specify an attribute attr of a persistent class. The second operand operand or pattern of a comparison may be an attribute, a parameter par, or a literal value.
You can freely define the names of parameters by specifying a parameter list, which is a list of parameter names that can be used in the filter condition. The parameter’s position in the parameter list defines the parameter’s index in the parameter table. If no parameter list is specified, a predefined parameter list with the three parameter names PAR1 PAR2 PAR3 is used.
Literal values are generally enclosed by quotation marks. The semantics of the relational operands are defined by the corresponding Open SQL language element into which the logical expression is converted (see the ABAP keyword documentation).
Note
The filter condition and its parameter list are analyzed when a query is executed and transformed into an internal display. To avoid parsing each time the query is executed, you can use the methods of interface IF_OS_QUERY_EXPR_FACTORY to create multiple-use filter conditions in the internal display.
attr op { operand }
attr [NOT] LIKE { pattern } [ESCAPE escape]
attr IS [NOT] NULL
attr EQUALSREF par
Comparison of two object references. When the query is executed, parameter par has to be bound to a reference variable that refers to a persistent instance of a persistent class.
The semantics of the logical operands AND, OR, and NOT are also defined by their semantics in Open SQL. Explicit parentheses are possible. If no parentheses are specified, the Open SQL priority rules apply.
NOT expr
expr AND expr
expr OR expr
price < '100' AND currency = 'EUR'
name LIKE PAR1 AND age > '45' AND age < '65'
( department EQUALSREF DEP1 OR department EQUALSREF DEP2 ) AND NOT ( salary > '50000' AND currency = 'EUR' ) )