Skip to Content
0
Feb 01, 2019 at 08:49 PM

Date Calculation in the CDS View Select

4856 Views Last edit Feb 01, 2019 at 08:52 PM 3 rev

I am working on CDS view where I need to pass the date value. This date should be current date minus 12 months.

Please see below code, where first commented line works fine in my CDS view. Now I want to pass (Current date - 12 months ) instead of '20180122'.

Please guide how can I achieve that. I am trying to use ADD_MONTHS function but it does not work. Please 2nd line of code.

Thanks!

define view ZPO

//as select from  P_OverduePO(P_StartDate : '20180122' , P_EndDate : $session.system_dat ) as P_OverduePO 

as select from  P_OverduePO(P_StartDate : ADD_MONTHS ($session.system_date, -12), P_EndDate : $session.system_date ) as P_OverduePO