Ansicht
Dokumentation
ABENCDS_COND_EXPR_LIKE_V2 - CDS COND EXPR LIKE V2
General Material Data RFUMSV00 - Advance Return for Tax on Sales/PurchasesThis documentation is copyright by SAP AG.
- CDS View Entity, cds_cond, LIKE
... lhs $[NOT$] LIKE rhs $[ESCAPE esc$]...
Addition:
... ESCAPE esc
Effect
Pattern comparison in a condition in a CDS view entity. 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 - View Entity, cds_cond, Operands.
- The data types of the operands must be comparable as described in topic CDS DDL - View Entity, cds_cond, Comparable Types. Only character-like data types can be used.
- For rhs, only character-like literals 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
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 , this comparison is true (as described in topic sql_cond, LIKE).
Addition
... ESCAPE esc.
Effect
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 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.
Example
To search for the pattern '100%', the following expression can be used with # as the escape character.
... LIKE '100#%' ESCAPE '#' ...
ROGBILLS - Synchronize billing plans PERFORM Short Reference
This documentation is copyright by SAP AG.
Length: 4975 Date: 20240425 Time: 073326 sap01-206 ( 59 ms )