Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Wenn zur Laufzeit Aktionen auf der Datenquelle ausgeführt werden, die den Aufriss der Daten verändern (bspw. Entfernen von Dimensionen), muss die Datenselektion der Extension-Komponente ebenfalls angepasst werden. Diese Anleitung erläutert, wie die Extension-Komponente per BIAL-Skript angepasst werden kann, um den veränderten Aufriss darzustellen.

In diesem Beispiel stellen eine crosstab aus DesignStudio und ein graphomate chart Daten der selben Datenquelle dar. Während die Crosstab alle Dimensionen des Datenaufrisses zeigt, stellt das chart nur explizit selektierte Dimensionen dar. Wenn nun eine dieser explizit selektierten Dimensionen zur Laufzeit über ein navigation panel entfernt wird, passt sich die crosstab dieser Änderung an, weil sie den gesamten Aufriss darstellt, während das chart eine Fehlermeldung ausgibt, dass die selektierte Dimension nicht verfügbar sei.

Image Removed

Schritt-für-Schritt-Anleitung

Um das chart an den neuen Aufriss anzupassen, sind folgende Schritte notwendig:

...

If you do an action on a datasource at runtime that changes its initial view you have to change the data selection of every connected extension component as well. This Article describes how to change the data selection of a extension component via BIAL script.

In the screenshot below there is a SAP DS (Design Studio) - crosstab as well as a graphomate chart. Both elements refer to the same DataSource. While the SAP DS – crosstab shows all key figures which are defined in the initial view of the DataSource, the graphomate chart only shows the key figures which are explicitly defined in the data series. When key figure “Umsatz Ist” is filtered out by the navigation panel on the left side, the DS – crosstab will be reduced by this key figure. The following steps show how to prepare the graphomate extension to filter it out as well.

Image Added

Step-by-Step-Guide

  1. Check the technical names of the defined series of the graphomate chart in the properties sheet and copy them in an empty text file (i.e. DF0FJF4KG0HMAY4DVXJLPAZXM, DF0FJF4KG0IDZKG57GZ7RQE7E).
    Image Added

  2. Insert the following code in the On Result Set Changed method of the DataSource.

    Code Block
    languagejs
    titleOn Result Set Changed Event Handler
    collapsetrue
    //check if keyfigure1 and keyfigure 2
    //Define Array xx for all members of 0CALMONTH2
    var xx = DS_1.getMembers("0CALMONTH2", 12);
    
    //define a boolean variable for the first key figure
    var firstkeyfigure = false;
    
    //check the first keyfigure (DF0FJF4KG0HMAY4DVXJLPAZXM) for each member of 0CALMONTH2. 
    //if a valid value is found for any member the boolean variable "firstkeyfigure" is set to "true"
    //Depending of the structure of your DataSource you have to replace DF0FJF4KG0HMAY4DVXJLPAZXM, 
    //DF0FJF4KG0IDZKG57GZ7RQE7E and 0CALMONTH2 with the correct names of your keyfigures dimensions
     
    xx.forEach(function(element, index) {
      DS_1.getDataAsString("DF0FJF4KG0HMAY4DVXJLPAZXM", {
      	"0CALMONTH2": element	
      });
     if (DS_1.getDataAsString("DF0FJF4KG0HMAY4DVXJLPAZXM", {
      	"0CALMONTH2": element}).length != 0){
      		firstkeyfigure = true;
      	}
      		
    });
    
    
    //do the same check for all other relevant keyfigures
    var secondkeyfigure = false;
    
    xx.forEach(function(element, index) {
      DS_1.getDataAsString("DF0FJF4KG0IDZKG57GZ7RQE7E", {
      	"0CALMONTH2": element	
      });
     if (DS_1.getDataAsString("DF0FJF4KG0IDZKG57GZ7RQE7E", {
      	"0CALMONTH2": element}).length != 0){
      		secondkeyfigure = true;
      	}
      		
    });
    
    
    //Check: if both keyfigures are set (variables = true) the chart series will be set to both key figures 
    //otherwise there will be a check if the first key figure is set. In this case the 
    //chart series will only set the first key figure...
    
    if (firstkeyfigure == true && secondkeyfigure == true){
    	GRAPHOMATECHART_1.setSeries(1,'{"(MEASURES_DIMENSION)":"DF0FJF4KG0HMAY4DVXJLPAZXM"}');
    	GRAPHOMATECHART_1.setSeries(2,'{"(MEASURES_DIMENSION)":"DF0FJF4KG0IDZKG57GZ7RQE7E"}');
    }
    else if (firstkeyfigure == true) {
    	GRAPHOMATECHART_1.setSeries(1,'{"(MEASURES_DIMENSION)":"DF0FJF4KG0HMAY4DVXJLPAZXM"}');
    	GRAPHOMATECHART_1.setSeries(2,"");
    }
    else if (secondkeyfigure == true){
    	GRAPHOMATECHART_1.setSeries(1,"");
    	GRAPHOMATECHART_1.setSeries(2,'{"(MEASURES_DIMENSION)":"DF0FJF4KG0IDZKG57GZ7RQE7E"}');
    }
    
    
  3. Wenn nun zur Laufzeit die zweite Dimension "Umsatz Plan" entfernt wird, zeigt das chart nur noch die übrig gebliebene Dimension "Umsatz Ist" an

    After filtering out the second key figure now only the first key figure remains in the chart.

...

Filter by label (Content by label)
showLabelsfalse
max5
spacesKUNDEN
showSpacefalse
sortmodified
reversetrue
typepage
cqllabel in ("script","filter","datasource","skript","selection","scripting","aufriss","data","selektion") and type = "page" and space = "KUNDEN"
labelsselektion selection script scripting Skript aufriss filter data datasource

Page Properties
hiddentrue
 
Verwandte Vorgänge