I'm using the following SQL script:
SELECT EXTRACT(YEAR FROM FPCOMMNPERIOD_CALC) As COMMYEAR
FROM "_SYS_BIC"."tfx.adhoc.Greg_Test/CV_SALES_W_PRICINGCV_TEST"
GROUP BY EXTRACT(YEAR FROM FPCOMMNPERIOD_CALC)
ORDER BY EXTRACT(YEAR FROM FPCOMMNPERIOD_CALC) ASC;
and it operates just fine, outputting a list from 2007 to 2018. However, if we include the below line:
WHERE EXTRACT(YEAR FROM FPCOMMNPERIOD_CALC) IN (2011, 2012, 2013)
to subset certain years, HANA returns:
Could not execute 'SELECT EXTRACT(YEAR FROM FPCOMMNPERIOD_CALC) As COMMYEAR FROM ...' in 114 ms 271 µs .
[303]: invalid DATE, TIME or TIMESTAMP value: search table error: [6931] attribute value is not a date or wrong syntax
I'm using Tableau to connect to HANA, which generates a similar filtering statement. I've tried even filtering for 1 value as text = '2018' but HANA continues to output the error.
The column FPCOMMNPERIOD_CALC is a calculated column, where ZTFPCOMN is for e.g. '2018007' (2018 period 007):
leftstr("ZTFPCOMN",4)+'-'+rightstr("ZTFPCOMN",2)+'-'+'01')