Creating dynamic dropdown option for model dimensions with SAC Analytical Application

In SAP Analytical Application, there is feature dropdown. Dropdown we can create with manually by adding one by one value to drop down in SAC-P from designers.

But sometime we need to add items in Dropdown dynamically, so for this we need to write a code, follow the bellow step to add items to dropdown dynamically.

Create Dropdrown

First add new fresh dropdown from insert tab, and for example your dropdown name is Dropdown_1.

Create Planning_Model

Create Planning model shown in image, then select the model from select models option, where is your dimension is available and need to add on dropdown.

Add Code to Canvas

Go to onInitialization from Canvas, and write the code mention below.

var version_list = PlanningModel_1.getMembers("dimention_name"); // getting dimention item from model for ( var i=0; i < version_list.length; i++){ Dropdown_1.addItem (version_list[i].id, version_list[i].description );
} Dropdown_1.setSelectedKey("id_of_member"); //add id to make item selected by default