08-07-2017 2:50 PM
Hello there Gurus,
I've recently started practicing some CDS views with parameters and stumbled upon an odd SQL error in one of them.
Basically it inputs two parameters, Language and Employee Nr and uses language in select list and Employee Nr in Where clause.
[code]
(...)
substring( text[1: spras = $parameters.lang ].butxt, 1, 10 ) as comp_name }
where v1.pernr = $parameters.p_pernr
[/code]
If I data preview this version, I get an SQL error "-99999", "[IBM][CLI Driver] CLI0108E Communication link failure. SQLSTATE=40003, DBIF_REPO_SQL_ERROR" exception.
Seems like it's something related to connection failure, but if I replace my $parameter in the WHERE clause by a hardcoded value, it works just fine. Furthermore, if I refer to my path expression after "FROM", as an inner join, it also works.
I've also confirmed that the error is not due to lack of support from the database, since CL_ABAPDB_FEATURES works without error before performing the CDS SQL query.
Has anyone faced this?
Thanks!
Lauro
08-07-2017 4:46 PM
Do you get the same error using Open SQL in an ABAP program?
The only thing, I can think about is that your DB version is not sufficient. There are SAP notes that describe which DB version must be used with which ABAP release.
08-11-2017 9:32 PM
Hi Horst,
Thanks for answering! No, I don't get any errors while using Open SQL in ABAP programs. I will try to do a research on these Notes and update the post if I find anything.
08-21-2017 3:17 PM
So, just to record what I discovered as a final conclusion:
The issue really seems to be related to adding parameters to the CDS View along with a database version (in my case, DB2 v11.1.5 and Abap 7.40 SP16). The short dump ("Query failed" message in Eclipse's data preview functionality) will occur if more than one association is used.
To be able to determine this I used one of the EPM standard CDS Views in a brand new custom one, passing along multiple path expressions in the select list. Without parameters it works perfectly, but fails after adding them. I'm only able to preview data if I leave exactly one path expression in the select list - I can use multiple parameters without a problem in this case.
Thanks!