1. Scenario description:
Testing a custom query.
When the application triggers the custom query, an error appears:
“DAL Exception occurred”
The DAL Exception error is an SQL error that appears when the application sends the query to the HANA server.
There can be different reasons:
- Wrong syntax
- HANA Parsing error
- Code Block in the SAP query
1. Wrong syntax
Check the syntax of your query. The parameters that you put into your query will be replaced by the application. In case the parameter does not exist on the screen, then it won’t be replaced, and you will see the unreplaced parameter in the query $[ParameterThatDoesntExist]
In case the query is too long, then you can use the SQL Trace to find the whole query or you can enable the Debug writeline log in the ServiceBroker and you will find the whole query in the log file. Don’t forget to turn off this setting, otherwise it will generate huge log files.
2. HANA Parsing error
There is a HANA parser in the application that doesn’t contain all HANA functions. If you are using some extra HANA functions, then it is possible that the parser won’t notice it. Therefore it will be interpreted as a column name.
In this case we suggest you to use a HANA stored procedure and call the procedure from the SAP query
3. Code block in the SAP query
Our experience is that SAP doesn't really like DO BEGIN in the SAP query window:
What we can suggest is to use a stored procedure or restructure the logic into one query.