Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Using HANA SQL Functions in select list of CDS Views

Former Member
0 Kudos

Dear Expert,

Kindly please let me know if we can use the HANA SQL Function (Ex: ADD_DAYS, SECONDS_BETWEEN) in the select list of CDS Views?

If I create a CDS like below I get error that timestamp is not supported.

For Example:

@AbapCatalog.sqlViewName: 'ZMR_H_CA'

@EndUserText.label: 'CAG A'

define view viewname

with parameters start_ts:abap.dec( 15, 0 ) , end_ts:abap.dec( 15, 0 )

as select from table {

key resource_key,

TO_TIMESTAMP(begtstmp) as start_tmp,

TO_TIMESTAMP(begtstmp) as end_tmp

   

}

where

(begtstmp > $parameters.start_ts or endtstmp > $parameters.start_ts )

and

(begtstmp < $parameters.end_ts or endtstmp < $parameters.end_ts )

Thanks,

Giri

1 REPLY 1

jasmin_gruschke
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi Giri,
the list of provided features can be found in the ABAP Language Documentation (F1 in the CDS View).

As CDS in ABAP is abstracted from the database layer, the database features are not directly accessible. That means, you cannot use any HANA or MaxDB feature available. So the answer to your question is no. The reason for this is, that ABAP CDS views can be created on all SAP-supported databases, hence, we can only provide those features, supported by all databases.

Having said this, there are some exception, e.g. the CDS views with input parameters, which are not supported by all databases. In these cases, you'd have to additionally use the utility class CL_ABAP_DBFEATURES (see http://scn.sap.com/community/abap/blog/2014/10/10/abap-news-for-740-sp08--abap-core-data-services-cd...) for more details.

Best,

  Jasmin