Technical Articles
Create Cascading dropdown in SAC Designer, (without hierarchy)
Hi Friend,
As we know there is no direct option to create a cascading drop down in SAP SAC Designer,
So i am writing the blog to explain the each step how to create a Cascading drop down in SAC Designer
Below are the step need to follow to implement the cascaded drop down in the SAC designer
Step 1 Add 3 drop down to the canvas
In this example we have 3 drop down for cascaded prompt
Product 1, product 2 and product 3
Given drop down name as below
-
-
- dropdown_prod1
- dropdown_prod2
- dropdown_prod3
-
Step 2 Need to add a chart to canvas to get the Drop down list of value at run time
In that chart also need to add the all 3 dimension in the chart as shown below
Step 3 After adding the data to the chart we need to create 3 global variable ( note create an array to store all the LOV value in it at run time)
Need create 3 global variable array
3 global variable array name as below
-
-
- prod1_drop_dyn_array
- prod2_drop_dyn_array
- prod3_drop_dyn_array
-
The above array will be used to store drop down LOV which will be used in the filter further
create more 3 global variable
-
-
- dropdownprod1_Selectedkey
- dropdownprod2_Selectedkey
- dropdownprod3_Selectedkey
-
The above 3 global variable will be used to store the selected drop down at run time.
Step 4 on initialization we have to write a below code
up till now had assign the List of value (LOV) to the drop down and now see the ALL as default selected value in all 3 drop down.
Now below step is used to create a cascaded drop down in the application.
Step 5 Need to create global script object (function) for cascaded
Below is the code will update a LOV of cascaded prompt base on the selection of drop down
Step 6 on each drop down we have to write a below code
This code will update the global variable
Below code in for prod1 on select script
As you can see i am calling a global script object (function) in the on select of prod1
Same code i had repeat for prod2 and prod3 drop down.
Below code is for Product 3 drop down.
Below code is for product 3 drop down
Note to apply filter to chart or table i had used a below 3 global variable array.
- prod1_drop_dyn_array
- prod2_drop_dyn_array
- prod3_drop_dyn_array
Thanks & Regards,
Saurabh S.
Hi Saurabh,
Thank for sharing.... Nice blog.
I tried with your concept. But I'm facing issue in dropdown selected key is not maintaining in the Dropdown.
I tried to modified the code but never works for me.
So can you help on this.
Regards,
Vidhya
Can you please share a code
Thank you Saurab very nice blog.
Thanks 🙂
Hi Saurabh -
Nice blog! Could you please let me know what exactly "prod1" in the above code. Is it the name of the script variable?
Thank Sunil,
The prod1 is my product 1 dimension I am using for filtering.
in the above example, we have 3 product hierarchy (product 1 , product 2 and product 3)
for easy understanding of component, I am using an prod1 , prod2 and prod3 perfix to identify the component and variable easily in the code and in the application.
Thanks,
Saurabh S.
Hello Suresh,
Will you also create a post how to achieve cascading filter with hierarchy structure (also what if the hie-structure has a default filter).
Thank you,
Surya
Sure, I will create a blog thanks for the topic suggestion. 🙂
Thanks,
Saurabh S.
Thank you for your time, effort and looking forward to your solution.
Regard,
Surya
I did the step-by-step procedure, but I encounter some error like after choosing item on dropdown1 and filter it on table and dropdown 2 the dropdown 2 didn't refresh and the data that supposed to be list down on dropdown2 can't be seen after choosing another item on dropdown1. How can I solve this? Sir Saurabh Suresh Sonawane