Using WHERE clause #
- Select and double-click an extraction of type “table” in the main window of the Designer. The window “Define data source for SAP Table “ opens.
- Navigate to tab WHERE Clause.
- Enter the WHERE clause.
- To display the results in the Preview section, click [Load live preview].
Note: When fields with the same name exist in different tables, the field names must be formatted as [table name]~[field name], e.g. MAKT~MATNR. This can be the case with table joins.
WHERE clause syntax #
Warning! Extraction fails due to incorrect syntax!
The extractions fail, if incorrect syntax is used in the WHERE clause. Make sure to use correct SAP OpenSQL syntax. Several important syntax rules are listed in this help section.
Tip: To check the syntax of the WHERE clause, click [Load live preview]. This way there is no need to run an extraction to see, if the syntax is correct.
Enter a space before and after the equal sign:
Correct: YEAR = ‘1999’
Wrong: YEAR= ‘1999 ‘, YEAR =’1999’ or YEAR=’1999’
Set floating point numbers in single quotation mark:
Correct: KMENG > ‘10.3’
Wrong: KMENG > 10.3
Note: The WHERE clause doesn’t need any line break (return key).
- Values must have the internal SAP representation:
- The date 01.01.1999 has the internal representation 19990101 (YYYYMMDD)
- The year period 001.1999 has the internal representation 1999001 (YYYYPPP)
- Numbers must contain the leading zeros, e.g., customer number 1000 has the internal representation 0000001000.
Get more information about the OpenSQL syntax on the SAP help site - Select WHERE
WHERE clause restrictions #
When using table joins, restricting the right table of a LEFT OUTER JOIN is only possible starting from SAP Release 7.40, SP05.
If your SAP System is older than Release 7.40, SP05, the following error appears: *RFC_ERROR_SYSTEM_FAILURE - Illegal access to the right table of a LEFT OUTER JOIN.
Get more information about the changes in Release 7.40, SP05 on the SAP help site.