Get Example source ABAP code based on a different SAP table
ARTICLE Short Reference • LIKE WHERE • NOT LIKE WHERE • ESCAPE WHERE
sql_cond - LIKE
Syntax ... col [NOT] LIKE dobj [ESCAPE esc] ...
Effect This expression is true if the value of the column col fits (does not fit) the pattern in the data object dobj. It is not possible to specify a column ID for dobj. The data types of the column col and the data object dobj must be character-like. Wildcard characters can be used to create the pattern in dobj, where '%' represents any character string, even an empty one, and '_' represents any character. It is case-sensitive. Trailing blanks in dobj are ignored. This is also valid in particular for data objects of the type string whose trailing blanks are otherwise respected in ABAP. The addition ESCAPE can be used to define an escape character. esc must be a flat character-like data object with length one, whose content is used as an escape character. esc is always accessed like a data object of the data type c of the length 1. 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. The addition ESCAPE cannot be used when reading pooled tables.
Notes
The use of the wildcard characters '_' and '%' corresponds to the standard of SQL. Elsewhere in ABAP, the wildcard characters '+' and '*' are used in similar relational expressions, in particular when selection tables are used.
Do not use patterns that are closed by wildcard characters to search for closing blanks. The semantics of searches of this type are dependent on the database system that is used and in general do not produce the desired result.
Example Full-text search in a text table. PARAMETERS srch_str TYPE c LENGTH 20.