Working with Lists in the WHERE-Clause Editor
The following article shows how to use lists and SELECT statements in the WHERE Clause Editor of the Table extraction type.
Lists can contain multiple values separated by commas e.g., 1,10
or “1”, “10”
.
List Parameters
- Create a Table extraction.
- Look up the table KNA1, see Documentation: Define the Table Extraction Type.
- Click Edit runtime parameters. The window "Edit runtime parameters" opens.
- Click [Add List] to define a list parameter, e.g., Parameter0.
- Click [OK] to save the parameter. The window "Edit runtime parameters" closes.
- Open the WHERE Clause tab and click [Editor Mode] to open the WHERE clause editor.
- Click [Add criteria], then [Default with parameter] to create an empty template in the WHERE clause editor.
- Select the column ORT01 from KNA1 as the data you want to filter.
- Select IN as the operator. IN is the only operator that can be used for lists.
- Click [Select parameter] in the static parameter component of the WHERE clause. A drop down list opens.
- Select an existing list parameter from the drop down list, e.g., Parameter0.
- Click [OK] to confirm your input.
- Click [Load live preview] or run the extraction to check the output.
When providing values for the list parameter, use multiple values separated by commas e.g.,1,10
or“1”, “10”
.
Static Lists
The depicted example statement returns all active customers (rows in the table KNA1) that have an address in one of the following cities: Berlin, Stuttgart, Paris, Seattle, Hong Kong or Dongguan.
- Create a Table extraction.
- Look up the table KNA1, see Documentation: Define the Table Extraction Type.
- Open the WHERE Clause tab and click [Editor Mode] to open the WHERE clause editor.
- Click [Add criteria], then [Default with literal] to create an empty template in the WHERE clause editor.
- Select the column ORT01 from KNA1 as the data you want to filter.
- Select IN as the operator. IN is the only operator that can be used for lists.
- Select List as the type of the static filter value.
- Click [Press to Edit] in the static value component of the WHERE clause. The window "Edit List" opens.
- Select String as the Type of the list. When working with numbers, select Number.
- Click [Add] to add items to the list. You can edit items via double-click.
- Click [OK] to confirm your input.
- Click [Load live Preview] or run the extraction to check the output.
When providing values for the list parameter, use multiple values separated by commas e.g.,1,10
or“1”, “10”
.
SELECT Statement
SELECT statements can be used to select data from SAP tables, see ABAP Documentation: Open SQL SELECT.
The depicted example statement returns all active customers (rows in the table KNA1) that have a sales document in the table VBAK for sales document header data.
Note
The usage of SELECT statements is only possible as of SAP Release 7.40, SP05.
- Create a new Table extraction.
- Look up the table KNA1, see Documentation: Define the Table Extraction Type.
- Open the WHERE Clause tab and click [Editor Mode] to open the WHERE clause editor.
- Click [Add criteria], then [Default with literal] to create an empty template in the WHERE clause editor.
- Select the column KUNNR from KNA1 as the data you want to filter.
- Select IN as the operator. IN is the only operator that can be used for lists.
- Select List as the type of the static filter value.
- Click [Press to Edit] in the static value component of the WHERE clause. The window "Edit List" opens.
- Select SELECT as the Type of the list.
-
Enter the following SELECT statement to create a list that contains all items of the column KUNNR from the SAP table VBAK:
-
Click [OK] to confirm your input.
- Click [Load live Preview] or run the extraction to check the output.
Related Links
Written by: Valerie Schipka