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

Problem


We are using an analysis table in Design Studio on which users can apply filters. Many dimensions are using hierarchies, therefore, filters can be applied on hierarchy nodes. In some scenarios, the users asked to switch from the hierarchy display to a flat presentation.

With the standard context menu, the only entry which could be used to achieve this is "Select Hierarchy". When you select "No Hierarchy" from the  hierarchy list, the analysis table will show the flat representation. But at the same time, all hierarchy node filters are discarded.

Solution approach


We enhanced the standard context menu with a custom setting to only deactivate the display hierarchy. The flat presentation is available and all hierarchy filters are maintained.

Steps



  1. Select the CONTEXT_MENU component

  2. In Properties, go to Custom menu options

  3. Create a new entry, name it "(De-)Activate Hierarchy"

  4. Click on "Edit Script" to open the editor

  5. Paste the code snippet

  6. Confirm all windows with "OK"


Code Snippet Design Studio 1.6


if(me.getClickArea() == 'MEMBER' || me.getClickArea() == 'DIMENSION'){
//only execute the actions if Member or Dimension has been clicked
var context = me.getContext();
context.forEach(function(value, key) {
if(me.getDataSource().isHierarchyAssigned(key)){
//only continue if the dimension has a hierarchy assigned
if(me.getDataSource().isHierarchyActive(key)){
me.getDataSource().deactivateHierarchy(key);
} else {
me.getDataSource().activateHierarchy(key);
}
}
});
}else{
// if needed, add action or message if neither Member nor Dimension has been clicked
}


The above snippet will turn the display hierarchy on or off depending on the current state and only if a hierarchy is assigned.

Code Snippet Lumira Designer 2.2 and above


if(CONTEXT_MENU.getSelectionType() == ClickArea.MEMBER || CONTEXT_MENU.getSelectionType() == ClickArea.DIMENSION){
//only execute the actions if Member or Dimension has been clicked

var context = CONTEXT_MENU.getSelection();
context.forEach(function(value, key) {
if(CONTEXT_MENU.getDataSource().isHierarchyAssigned(key)){
//only continue if the dimension has a hierarchy assigned

if(CONTEXT_MENU.getDataSource().isHierarchyActive(key)){
CONTEXT_MENU.getDataSource().deactivateHierarchy(key);
} else {
CONTEXT_MENU.getDataSource().activateHierarchy(key);
}
}
});

}else{
// if needed, add action or message if neither Member nor Dimension has been clicked
}

The codeword "me" is not available anymore for the context menu script. Therefore you have to exchange it with the name of the context menu component like CONTEXT_MENU. Additionally, some expressions were deprecated and have been replaced above compared to 1.6.

Known issues


Display: As of now (we are working with BO Design Studio 1.6) it is not possible to turn this entry on or off dynamically per component. So once you implement this, the entry will show up for every context menu. Read more on context menu tweaking here: Design Studio 1.5: View on Context Menu Parameterization

BEx query structure: When executing this on a hierarchical BEx query structure, an error message will be generated because it is a Member and a hierarchy is assigned, but deactivation of the hierarchy is not possible.
Labels in this area