Skip to Content
0
Feb 06, 2019 at 06:53 AM

SAP Application Programming Model - casting type in queries

207 Views Last edit Feb 06, 2019 at 06:57 AM 2 rev

In a .CDS query I can derive a property in a view like so

case
   PROPERTY_NAME when 'SPECIAL VALUE' then 'Information'
   else 'None'
end            as RowHighlight,

In the DB it gets mapped to the following type which is not an allowable type

View Column                  SQL Date Type
ROWHIGHLIGHT                 VARCHAR(11)
Error: Element "Service.RowHighlight" does not have a type: Elements of ODATA entities must have a type

In a query how would i cast RowHighlight to an allowable SQL Type say NVARCHAR(11) ?