Skip to main content
Announcements
Jan 15, Trends 2025! Get expert guidance to thrive post-AI with After AI: REGISTER NOW
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);

2 Replies
Not applicable
Author

Think you are using exists the wrong way. This way, LIKP will only contain records where field LFARTEMP contains the value LFART.

You probably want to select records from LIKP where field LFART contains values that are also in field LFARTEMP.


[LFARTTEMP_TABLE]:
load * inline [
LFARTEMP,
ZLI,
ZLD ];

[LIKP]:
Load
MANDT,
VBELN,
VKORG,
WADAT,
LFART,
KUNNR,
LFARTEMP;
SQL SELECT MANDT VBELN VKORG WADAT LFART KUNNR
FROM LIKP LP, [LFARTTEMP_TABLE] LT
WHERE LT.LFARTEMP=LP.LFART;


Not sure if you can do this when loading from SAP. You could first load the LIKP table and use RESIDENT to link both tables.

pablolabbe
Luminary Alumni
Luminary Alumni

This is wrong.

If you want to filter the data in SAP Application Server before loading it in memory use:

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