Skip to Content
0
Jul 24, 2020 at 02:21 PM

How to create CDS view with dynamic date in where clause using $session.system_date

1032 Views

Good day,

I'm wondering how to select with date range? but my input should be Type:Int.

In my example below I have entered parameter type date and used it in the where condition

but I wanted to do something like this one but ended up with errors

calday between ( $session.system_date - $parameters.inputInt ) and $session.system_date

I wanted to avoid sy-datum - X, then passing the result as parameter

define view ZCDS_STAT_OLAP 
with parameters from_date : rsddstatday
as select from rsddstat_olap as olap
{
  key handletp,
  key steptp,
  key stepcnt,
  key uname,
  key calday,
  runtime,
  infoprov,
  objname   
} where runtime > 20
  and calday between $parameters.from_date and $session.system_date

Thank you for your help!