cancel
Showing results for 
Search instead for 
Did you mean: 

List Report with a default range Date filter value (cds annotation)

Senqi_Hu
Participant
0 Kudos

Hi,Experts:

I need a date filter in the smartFilterToolBar,and set a default range date value. So I use the annotation with the following codes, but the '@Consumption.filter.defaultValueHigh' doesn't work.

@Consumption.filter.defaultValue: '20211201'
@Consumption.filter.defaultValueHigh: '20211207'//defaultValueHigh (doesn't work)
@Consumption.filter.selectionType: #INTERVAL
@EndUserText.label: 'Created Date'

And I can see the metadata contain the "FilterDefaultValueHigh"

Here is the result with the annotaion.

I can only solve it by fiori-element extension.(ListReportExt.controller.js)

modifyStartupExtension: function(oStartupObject) {
	var oSelectionVariant = oStartupObject.selectionVariant;
	if (oSelectionVariant) {
		oSelectionVariant.removeSelectOption("CreatedDate");
		var iYear = new Date().getFullYear(),
		iMonth = new Date().getMonth() + 1,
		iDate = new Date().getDate();
		oSelectionVariant.addSelectOption("CreatedDate", "I", "BT", iYear + "-" + iMonth + "-" + 1, iYear + "-" + iMonth + "-" + iDate);
	}
}

Here is the result after extension.

Although through the extension I can solve it, but I want to know why the annotaion '@Consumption.filter.defaultValueHigh' doesn't work? Can someone Help me? Thanks!

Accepted Solutions (0)

Answers (1)

Answers (1)

junwu
Active Contributor
0 Kudos

which version of ui5 you are using? maybe your version of ui5 is not supporting that feature.

change your ui5 to higher version to see if it makes any difference.

Senqi_Hu
Participant
0 Kudos

Hi, Jun. My local ui5 version is 1.84.6. I had changed the ui5 version with the latest version and others, but it also doesn't work. And I found versions starting with 1.94.0, the annotation ' @Consumption.filter.defaultValue' doesn't work too. Thank you all the same.

junwu
Active Contributor
0 Kudos

what is your abap server version?

Senqi_Hu
Participant
0 Kudos

I had tried in 3 different abap server version.(s/4 hana1909、s/4 hana2020、btp trial abap environment)

But the results is the same.