Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Discover how organizations are unlocking new revenue streams: Watch here
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

sap sql WHERE CLAUSE THRWOING OPEN_SQL_KEY ERROR

load * inline [
LFARTEMP,
ZLI,
ZLD ];

[LIKP]:
Load
MANDT,
VBELN,
VKORG,
WADAT,
LFART,
KUNNR;
SQL SELECT MANDT VBELN VKORG WADAT LFART KUNNR from LIKP WHERE
Exists(LFARTEMP, LFART);

1 Reply
johnw
Champion III
Champion III

Exists() is a QlikView function, not an SQL function. It must therefore be in the LOAD, not in the SQL:

load * inline [
LFARTEMP,
ZLI,
ZLD ];

[LIKP]:
Load
MANDT,
VBELN,
VKORG,
WADAT,
LFART,
KUNNR
WHERE Exists(LFARTEMP, LFART);
SQL SELECT MANDT VBELN VKORG WADAT LFART KUNNR from LIKP ;

If you're concerned about the data select efficiency, have an index on LFART, and replace the exists with a hardcoded IN. That won't work, of course, if your desired values of LFART are being loaded earlier in the script, but if it's just a few values, it should work fine:

[LIKP]:
Load
MANDT,
VBELN,
VKORG,
WADAT,
LFART,
KUNNR;
SQL SELECT MANDT VBELN VKORG WADAT LFART KUNNR from LIKP
WHERE LFART IN ('ZLI','ZLD');