SAP Analytics Report on Selection Screen Assign Default Date Range [ Last Month Range ]
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.
SAP HANA Analytics Report Selection Screen assign Default last month Value for Clearing Date with respect to the system date.
Below are the steps on how to assign default dates to the S4 analytical Report build on top of HANA CDS views.
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]
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
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.
- 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 ]