Symptom
When previewing a Story report, the report fails to load and returns the following error:
Internal error occurred while processing
In logs we can see below error
{
"Messages": [
{
"Type": 2,
"Number": 42014,
"Text": "Internal error occurred while processing.",
"DetailedError": "Caught exception : exception 1000013: incorrect syntax near \"THEN\"\n"
}
Environment
- Query Designer - Filter, Calculated Column, Params
Reproducing the Issue
- Open an Story that contains a calculated column using an IF() formula.
- The IF() condition references a Boolean-type field from a data model.
- The formula uses either:
A bare column reference as the condition: IF([BooleanField], "Value1", "Value2")
Or a String literal comparison against a Boolean field: IF([BooleanField]="true", "Value1", "Value2") - Click Preview on the Story.
- The error 42014 – incorrect syntax near "THEN" is returned.
Cause
SAC translates IF(condition, trueValue, falseValue) into a HANA SQL CASE WHEN ... THEN ... END expression when building the temporary calculation view at preview time.
Case 1 – Bare column reference as condition: The formula IF([BooleanField], "X", "Y") generates:
CASE WHEN "BooleanField" THEN 'X' ELSE 'Y' END
SAP HANA SQL requires a boolean expression (with a comparison operator) before THEN. A raw column reference without a comparator is not accepted, causing the parser to fail at THEN.
Case 2 – Boolean field compared to a String literal: The formula IF([BooleanField]="true", "X", "Y") causes a type mismatch at the SAC formula validation layer: Function "=" expects parameters 1 and 2 to be of compatible types (found "Bool" vs. "String"). The formula cannot be saved or executed.
The root cause in both cases is using a Boolean data model field without a proper boolean literal comparison in the IF() condition.
Resolution
Edit the affected calculated column in the Story and replace the condition with a proper boolean literal comparison using true or false (lowercase, no quotes):
IF([BooleanField]=true, "X", "Y")
See Also
Keywords
Internal error occurred while processing, Internal error occurred while processing - exception 1000013: incorrect syntax near \"THEN\"\n", calculated column, Story, report, Query designer, Data, source, Boolean field , KBA , LOD-SF-ANA-SAC-QDS , Query Designer - Filter, Calculated Column, Params , Problem
SAP Knowledge Base Article - Public