SAP CDS COND EXPR LIKE V1



Get Example source ABAP code based on a different SAP table
  


• LIKE ABAP_CDS_DDL_OPERATOR

ABAP_CDS_DDL - DDIC-Based View, cds_cond, LIKE

ABAP_SYNTAX
... lhs $[NOT$] LIKE rhs $[ESCAPE esc$]...

ABAP Addition
... ESCAPE esc

What does it do?
Pattern comparison in a condition in a ABAP_CDS_V1_VIEW . The relational expression is true if the string in lhs matches (does not match) the pattern in rhs.
Rules for the operands lhs and rhs:
The operand lhs must stick to the context-dependent rules listed in topic CDS DDL - DDIC-based View, cds_cond, Operands.
The data types of the operands must be comparable as described in topic CDS DDL - DDIC-based View, cds_cond , Comparable Types. Only character-like data types can be used.
For rhs, only character-like literals without domain prefix are allowed.
Rules for the pattern in rhs:
'%' is a wildcard character that represents any character string (including an empty string)
'_' stands for any character



Latest notes:

Do not use patterns in rhs that are closed by wildcard characters to search for trailing blanks. The semantics of searches of this type are dependent on the database system that is used and in general do not produce the required result.
If lhs contains the null value, then the comparison lhs LIKE '%' is not true. In AB_SQL , this comparison is true (as described in topic sql_cond, LIKE ).
NON_V5_HINTS
ABAP_HINT_END
• ESCAPE ABAP_CDS_DDL_OPERATOR

ABAP Addition

What does it do?
The addition ESCAPE can be used to define a single-character escape character. esc expects a character-like literal with the length 1 containing the escape character. In the pattern in rhs, the escape character in esc can be placed before a wildcard character or before the escape character itself. Then, the character directly following the escape character loses its special meaning.
If an escape character in rhs is not placed in front of one of the valid characters, a syntax error occurs.
The character # is recommended for the escape character esc .

ABAP_EXAMPLE_VX5
To search for the pattern '100%', the following expression can be used with # as the escape character. ... LIKE '100#%' ESCAPE '#' ...
ABAP_EXAMPLE_END