Skip to Content

how to get max or min value from dimension/measure in sap design studio

Nov 02, 2017 at 08:52 AM


avatar image
Former Member

how to get max or min value from dimension/measure using script in sap design studio

like year or revenue

2014 2015 2016 the last year 2016 initialization display on the dropdown box ?

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

1 Answer

Mohd Fahad Nov 02, 2017 at 08:16 PM
Show 2 Share
10 |10000 characters needed characters left characters exceeded
Former Member

dropdown 2014,2015,2016

I want to set the initial dropdown lastdate :2016 and setfilter with 2016

what should I do

15096794951.png (19.8 kB)

Hi Zheng,

I guess your requirement is to set filter and pre-select dropdown for current year or previous year for "0calyear" list. Try below code and see if this is what you are looking for.

Note: setting ascending or descending from "Edit initial view" will ONLY affect your Crosstab view but not Drop-down that populates data out of query.

For Current Year - 2017
//populate dropdown list
DROPDOWN_1.setItems(DS_6_HR_FILTER.getMemberList("0CALYEAR", MemberPresentation.TEXT, MemberDisplay.TEXT, 20));
//set current year for dropdown
DROPDOWN_1.setSelectedValue(Convert.stringToInt(Convert.subString(APPLICATION.getInfo().dateNowInternalFormat, 0,4))+ "");
//set query filter
DS_6_HR_FILTER.setFilterExt("0CALYEAR", Convert.stringToInt(Convert.subString(APPLICATION.getInfo().dateNowInternalFormat, 0,4))+ "");

For Previous Year - 2016
//populate dropdown
DROPDOWN_1.setItems(DS_6_HR_FILTER.getMemberList("0CALYEAR", MemberPresentation.TEXT, MemberDisplay.TEXT, 20));
//set previous year for dropdown
DROPDOWN_1.setSelectedValue((Convert.stringToInt(Convert.subString(APPLICATION.getInfo().dateNowInternalFormat, 0,4))-1 )+ "");
//set previous year filter
DS_6_HR_FILTER.setFilterExt("0CALYEAR", (Convert.stringToInt(Convert.subString(APPLICATION.getInfo().dateNowInternalFormat, 0,4))-1 )+ "");