Skip to Content
Technical Articles
Author's profile photo Vikas Singh

SAP S/4HANA CDS Views – MTD/YTD Using DateFunction

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-

 

  1. 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.

 

  1. C_SglGregorianCalDateFunction – Views need input parameter as Date Function & Language

 

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

 

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

 

  1. 5.Report output will be as below-

 

  • Date Function Prompt Screen-

 

  • Previous Year To Date – Date Function

 

  • Previous Year Date Function

 

Assigned Tags

      1 Comment
      You must be Logged on to comment or reply to a post.
      Author's profile photo Akula Veera Venkata Raghavendra Prasad
      Akula Veera Venkata Raghavendra Prasad

      Hi Vikas

      It is really helpful, we are trying to get period filter with list of values MTD,YTD and previous year like that. started using your view but it is asking the required function and how can we pass our own date instead of system date. will that work like this....

       

      need your urgent  reply

       

      Thanks

      Raghva