02-01-2019 8:49 PM
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
02-01-2019 9:05 PM
Hi,
I think you should use function DATS_ADD_MONTHS instead of ADD_MONTHS. (which needs 3 parameters)
Maybe try using something like:
DATS_ADD_MONTHS ($session.system_date,-12,'UNCHANGED')
Documentation can be found here: https://help.sap.com/doc/abapdocu_752_index_htm/7.52/en-US/abencds_f1_date_functions.htm#!ABAP_VARIA...
Best regards,
Geert-Jan Klaps
02-08-2019 3:58 AM
Hi All,
I have requirement to pass a calculated date to the CDS view. I tried using DATS_ADD_MONTHS function but it still does not work. It gives syntax errors.
I want to pass P_StartDate as (system_date - 12 Months) in the above CDS view.
P_OverduePO1 is also another view and P_StarDate and P_EndDate are mandatory fields.
define view ZPO_ITEMS as select from P_OverduePO1 (P_StartDate : $session.system_date , P_EndDate : $session.system_date)
Please guide me on how to perform calculation on date in the CDS view.
08-21-2022 9:08 PM
12-08-2022 12:45 PM
DATS_ADD_MONTHS (cast( $session.system_date as abap.dats ), 12,'UNCHANGED')
12-08-2022 12:45 PM