Introduction
In SAP S/4HANA Embedded Analytics - ABAP CDS views need some customisation to have feature of Date Function in Parameter.
In this blog, we will learn on how to add date functions in custom cds views.
Environment
SAP S/4HANA ON PREMISE 2020
SAP FIORI FOR S/4HANA 2020
Solution
Let’s assume that you have a composite view with Posting Date and you need to Implement Date function on Posting Date, then follow below steps-
- There is a Standard CDS view - C_SglGregorianCalDateFunction which is based on datefunction_val transparent table.

This table contains precalculated Start Date & End Date for respective date with date functions.
- C_SglGregorianCalDateFunction - Views need input parameter as Date Function & Language

- Let’s join this CDS view with our composite view on posting date-

- In your consumption query use below code for value help on date function parameter

- 5.Report output will be as below-
- Date Function Prompt Screen-

- Previous Year To Date - Date Function

- Previous Year Date Function
