ABAP Keyword Documentation → ABAP - Dictionary → ABAP CDS in ABAP Dictionary → ABAP CDS - Data Definitions → ABAP CDS - DDL for Data Definitions → ABAP CDS - DEFINE VIEW → ABAP CDS - SELECT → ABAP CDS - SELECT, Operands and Expressions → ABAP CDS - cond_expr
ABAP CDS - cond_expr, LIKE
Other versions:
7.31 | 7.40 | 7.54
Syntax
... lhs LIKE rhs [ESCAPE esc]...
Effect
Pattern comparison in a condition in a CDS view. The relational expression is true if the string in lhs matches the pattern in rhs. The same rules apply to lhs as to comparisons and only operands of the comparable types can be specified. Of these, only character-like data types can be used. Only character-like literals without domain prefix are allowed for rhs.
The wildcard characters % for any strings and _ for any character can be used in the pattern in rhs. The optional addition ESCAPE can be used to define an escape character. esc expects a single-character character-like literal without domain prefix. In the pattern in rhs, an escape character may only be placed before a wildcard character or before the escape character itself. In this case, these lose their special meaning.
Notes
- The # character is recommended for the escape character esc.
- Patterns in rhs closed by the wildcard characters % or _ should not be used to find trailing blanks, since the result is determined by the database platform in question and may be unexpected.
- Unlike the
LIKE
condition in ABAP SQL, lhs LIKE '%' is not true if lhs contains the null value.