4

SAP Analytics Report on Selection Screen Assign Default Date Range [ Last Month...

 2 years ago
source link: https://blogs.sap.com/2021/10/15/sap-analytics-report-on-selection-screen-assign-default-date-range-last-month-range/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
October 15, 2021 2 minute read

SAP Analytics Report on Selection Screen Assign Default Date Range [ Last Month Range ]


Prerequisite –

In this blog try to cover the scenario where you build the report on top of HANA CDS views [ combination of BASIC / COMPOSITE / CONSUMPTION ] and business need Date field [ here Clearing Date] should be populated with last month range as default value with respect to the system date.

As we all know in CDS we can’t hold any value to any variable. So in order to populate the Date range as default on the selection screen during execution is a bit challenging task. But in CDS views one annotation @Consumption.Derivation will help us to achieve the objective.

Below the scenario and steps shows how to assign the Date fields with a required default value on selection screen.

Business Requirement

SAP HANA Analytics Report Selection Screen assign Default last month Value for Clearing Date with respect to the system date.

Report%20Selection%20Screen%20with%20Default%20Date%20Value

Report Selection Screen with Default Date Value

Solution

Below are the steps on how to assign default dates to the S4 analytical Report build on top of HANA CDS views.

Step 1

CDS Consumption View  Level –

At the Reporting layer view [ Consumption layer ] first include the annotation @Consumption.derivation with prescribed format with the source CDS view name [ here ZI_DATE_DERIVATION ] CDS with other parameter value.

See the below snapshot of how to use the annotation with the required CDS name as a source to assign the default date range.

@Consumption.derivation: [ Used to consume the base View to populate the Date Range]

CDS%20for%20populate%20Date%20Range

CDS for populate Date Range

Step 2

Define the derivation CDS view with the required set of logic to populate the date range. Below is the snapshot of derivation CDS view “ZI_DATE_DERIVATION” shows to populate Last month date range with respect to system date.

CDS View – ZI_DATE_DERIVATION

Pic-3-2.png

Step 3 –

After completing the above steps and run the report and you will see on Date field now populated with the required default date range value on the selection screen.

Pic-0.png

Conclusion –

  • The above document, steps shows how to assign default date value on the selection screen for any SAP Analytics Report [ Build on SAP HANA CDS view ]

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK