Symptom
When validating SQL View, you face error:
## FORMATTED CSN ERRORS ## CDS compilation failed csn.json:1:1-1: Error: Element “ELEMENT_NAME” has not been found (in entity:“VIEW_NAME”/element:“FIELD_NAME”) <recompile>.csn:267: Error: Element “ELEMENT_NAME” has not been found (in entity:“VIEW_NAME”/element:“FIELD_NAME”) <recompile>.csn:276: Error: Element “ELEMENT_NAME” has not been found (in entity:“VIEW_NAME”/element:“FIELD_NAME”) ##
Environment
SAP Datasphere
Cause
Function CONVERT_CURRENCY with incorrect format
Resolution
Make sure to perform CONVERT_CURRENCY in correct format.
INCORRECT:
to_decimal(CONVERT_CURRENCY("AMOUNT" => "VIEW_NAME"."AMOUNT", "STEPS" => 'shift,convert,round', "SOURCE_UNIT" => "VIEW_NAME"."SOURCE_UNIT", "TARGET_UNIT" => :P_TARGET_CURRENCY, "REFERENCE_DATE" => "VIEW_NAME"."REFERENCE_DATE", "CLIENT" => '000', "CONVERSION_TYPE" => '1001', "LOOKUP" => 'regular', "ACCURACY" => 'compatibility', "DATE_FORMAT" => 'auto detect', "PRECISIONS_TABLE" => 'TCURX', "CONFIGURATION_TABLE" => 'TCURV', "PREFACTORS_TABLE" => 'TCURF', "RATES_TABLE" => 'TCURR', "NOTATIONS_TABLE" => 'TCURN', "SCHEMA" => 'SCHEMA_NAME', "ERROR_HANDLING" => 'set to null'), 15, 2) AS "COLUMN_NAME"
Remove VIEW_NAME, use fields directly
CORRECT:
to_decimal(CONVERT_CURRENCY("AMOUNT" => "AMOUNT", "STEPS" => 'shift,convert,round', "SOURCE_UNIT" => "SOURCE_UNIT", "TARGET_UNIT" => :P_TARGET_CURRENCY, "REFERENCE_DATE" => "REFERENCE_DATE", "CLIENT" => '000', "CONVERSION_TYPE" => '1001', "LOOKUP" => 'regular', "ACCURACY" => 'compatibility', "DATE_FORMAT" => 'auto detect', "PRECISIONS_TABLE" => 'TCURX', "CONFIGURATION_TABLE" => 'TCURV', "PREFACTORS_TABLE" => 'TCURF', "RATES_TABLE" => 'TCURR', "NOTATIONS_TABLE" => 'TCURN', "SCHEMA" => 'SCHEMA_NAME', "ERROR_HANDLING" => 'set to null'), 15, 2) AS "COLUMN_NAME"
See Also
SAP Help Portal SQL Functions Reference
SAP Help Portal Create a Currency Conversion Column
Keywords
dwc, data warehouse cloud, currency conversion, validate, format , KBA , DS-MD-VIW , Views , Known Error