Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
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');