cancel
Showing results for 
Search instead for 
Did you mean: 

Current month selection in listbox

Former Member
0 Kudos

Hi,

I am using listbox component containing 2 months for example current and previous month. Everything is working as expected except the current month selection. It is always showing previous month as default selection however, i want the report to open up with the current month selection. Data is continuously refreshing every hour based on the universe. Also, 2 month are getting refreshed with passing month.
I tried several scripts without any success. Can you please help me with the current month selection. Currently, May is reflecting default where as i am expecting June and next July and so on. Any help would be greatly appreciated!!

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi Harald,

Thanks for the link that you have provided. Unfortunately, this does not address any issue.

My issue is that there are only two months to display in the listbox. (August and July). Dashboard is based on the two months which gets populated by each passing month. Next month it would be September and August only & so on ...

I want to write a script for the default current month selection on start up.

I wrote script with setselected value however, it's selecting the previous month on open up report rather the current month. For example it is selecting July rather than August on start up.

Any idea how to achieve this?

former_member189544
Contributor
0 Kudos

Can you please share the scripts you are using?

Former Member
0 Kudos

Hi Harold,

Can you please look at this code and help me with selecting the current month.

var myMonths = DS_1.getMembers("DS:2,DIM:id_14",2);

myMonths.forEach(function(element, index)

{ Listbox.addItem(element.internalKey, element.text); });

var Month = myMonths.pop();

Listbox.setSelectedValue(Month.internalKey);

By adding this code it is selecting previous month rather than surrent month.

former_member189544
Contributor
0 Kudos

Hi Dia,

what exactly did you try with scripting?

Please try the method descibed here for year selection dropdown:

https://answers.sap.com/questions/12980114/selection-of-current-year-dropdown-dynamically.html

Regards,

Harald