Technology Blogs by Members
Explore a vibrant mix of technical expertise, industry insights, and tech buzz in member blogs covering SAP products, technology, and events. Get in the mix!
cancel
Showing results for 
Search instead for 
Did you mean: 
0 Kudos


A multi-selection listbox with a fixed number of years.

 

Make a global variable called gv_Year as an integer and a number of extra global variables year1 - n as string. In this example 6 years were used.



On Startup script code;

 

gv_Year = Convert.stringToInt(DS_1.getVariableValueExt("0P_CALYE"));


 

year1 = (gv_Year - 5)+"";


year2 = (gv_Year - 4)+"";


year3 = (gv_Year - 3)+"";


year4 = (gv_Year - 2)+"";


year5 = (gv_Year - 1)+"";


year6 = (gv_Year)+"";


 

CHART_1.setDataSelection({"0CALYEAR":year6});


DS_1.setFilter("0CALYEAR", year6);


 

LISTBOX_YEAR.addItem(year6, Convert.subString(Convert.floatToString(gv_Year - 0.0), 0 , 4));


LISTBOX_YEAR.addItem(year5, Convert.subString(Convert.floatToString(gv_Year - 1.0), 0 , 4));


LISTBOX_YEAR.addItem(year4, Convert.subString(Convert.floatToString(gv_Year - 2.0), 0 , 4));


LISTBOX_YEAR.addItem(year3, Convert.subString(Convert.floatToString(gv_Year - 3.0), 0 , 4));


LISTBOX_YEAR.addItem(year2, Convert.subString(Convert.floatToString(gv_Year - 4.0), 0 , 4));


LISTBOX_YEAR.addItem(year1, Convert.subString(Convert.floatToString(gv_Year - 5.0), 0 , 4));


 

The LISTBOX_YEAR component looks like this after entering ‘2016’ in the prompt.



LISTBOX_YEAR On Select script.


 

var lv_select_arr = me.getSelectedValues();


var lv_element = [""];


 

DS_1.clearFilter("0CALYEAR");


 

lv_select_arr.forEach(function(element, index)


{


lv_element.push(element);


});


 

CHART_1.setDataSelection({"0CALYEAR":lv_element});


DS_1.setFilter("0CALYEAR", lv_element);

Labels in this area