Cast Operations and Case Statements in CDS
Cast Operations Cast operations represent some of the most important fundamental SQL functions. You can use cast operations for determining the type of a calculated field and for converting the type of existing fields on the database level. The CDS syntax supports casts onto elementary ABAP types as well as onto data elements. @AbapCatalog.sqlViewName: 'zcds_cast_v' @AbapCatalog.compiler.compareFilter: true @AbapCatalog.preserveKey: true @AccessControl.authorizationCheck: #CHECK @EndUserText.label: 'View with Cast Operations' define view ZCDS_CAST as select from t000 { t000.logsys as ProjectedField, '20170809' as CharacterField, cast ( '20170809' as abap.dats ) as DateField, cast ( cast ( 'E' as abap.lang ) as sylangu preserving type ) as LanguageField, 1.2 as FloatingPointField, fltp_to_dec( 1.2 as abap.dec(4,2) ) as DecimalField } By default, a field keeps the type of its origin if it’s simply projected into a C