The ABAP program WHERE condition IN operator
An SAP table query can use the SQL IN operator to specify a list or range of field values in a WHERE clause. It is useful when used in conjunction with a job parameter to pass values at run time. This is implemented internally by using the ABAP statement SELECT-OPTIONS.
Value list and range format
Separate each value with a semicolon (;). If the value contains a semicolon, precede the semicolon in the value with a forward slash (/). Separate values in a list using a semicolon (;). To specify a range of values, use double colons between the low and high values.
For example,
value1;value2;valu/;e3
100::200
If the list or range specifications is too long or too complex, use the SAP system to create a variant and specify the existing variant to be used in the ABAP program.
If a value list is passed as a job parameter, specify a semicolon (;) to terminate the list. For example, if a list contains values PHILADELPHIA and DENVER, pass the value as follows:
PHILADELPHIA;DENVER;
If a job parameter is used in the IN Clause of the SQL query and no value is passed to the job parameter at run time, the IN Clause is ignored. For example, in the following SQL query, data is selected from the KNA1 table with the WHERE condition only containing a parametrized IN Clause on the field ORT01:
SELECT * FROM KNA1 WHERE ORT01 IN PARAM_1
If no value is specified for the PARAM_1 paremeter, the IN clause is ignored and the ABAP Extract Stage extracts all data from the table, as it would if there was no WHERE clause.