19
Generated by Jive on 2015-06-12+02:00 1 SAP BusinessObjects Design Studio: Design Studio: Performance Implications of Variables Posted by Martin Kolb Mar 27, 2014 Disclaimer: The content of this blog refers to variables of data sources in BW systems. In Design Studio data sources can refer to BW systems (Queries), HANA systems (Views) or DSL universes. All of them support the concept of variables. However the content below describes the behavior of BW data sources only. Overview Design Studio supports the concept of variables within data sources. Variables can be set via script or interactively in the UI of the application. Setting a variable value via script can be done via the “setVariableValue” API: APPLICATION.setVariableValue("0VC_CUST_NODE", "000101"); To give the application user the possibility to enter variable values the “openPromptDialog” API can be used: APPLICATION.openPromptDialog(600, 400); This API shows a UI that allows entering values of all variables inside the application.

Design Studio Performance Implications of Variables

Embed Size (px)

DESCRIPTION

Performance Implications of Variables

Citation preview

  • Generated by Jive on 2015-06-12+02:001

    SAP BusinessObjects Design Studio: DesignStudio: Performance Implications of Variables

    Posted by Martin Kolb Mar 27, 2014

    Disclaimer:The content of this blog refers to variables of data sources in BW systems. In Design Studio data sources canrefer to BW systems (Queries), HANA systems (Views) or DSL universes. All of them support the concept ofvariables. However the content below describes the behavior of BW data sources only.

    Overview

    Design Studio supports the concept of variables within data sources. Variables can be set via script orinteractively in the UI of the application.Setting a variable value via script can be done via the setVariableValue API:

    APPLICATION.setVariableValue("0VC_CUST_NODE", "000101");

    To give the application user the possibility to enter variable values the openPromptDialog APIcan be used:

    APPLICATION.openPromptDialog(600, 400);

    This API shows a UI that allows entering values of all variables inside the application.

  • SAP BusinessObjects Design Studio: Design Studio: Performance Implications of Variables

    Generated by Jive on 2015-06-12+02:002

    Where is the beast?

    There is one thing that you might have noticed from the stuff in the overview. Variables belongto the data source. However the API to set variable values is part of the APPLICATION object. Thereason for this is a concept called the Variable Container (VC). The VC provides some veryuseful services for application developers. The VC combines all variables of all data sources in theapplication. In addition the VC performs variable merging. This means that if multiple datasources provide the same variable then the VC treats them as one variable.

    Example:In an application there are 4 data sources using a COST_CENTER variable. If an applicationwants to show data from a cost center, then (without a VC) the application code would need toset variable values for all data sources (just for illustration purpose this API does not exist) :

    DS_1.setVariableValue("COST_CENTER", "4711");

  • SAP BusinessObjects Design Studio: Design Studio: Performance Implications of Variables

    Generated by Jive on 2015-06-12+02:003

    DS_2.setVariableValue("COST_CENTER", "4711"); DS_3.setVariableValue("COST_CENTER", "4711"); DS_4.setVariableValue("COST_CENTER", "4711");

    Using a VC with variable merging shrinks this to a single call:

    APPLICATION.setVariableValue("COST_CENTER", "4711");

    In the UI the situation would be even worse (i.e. more explicit to the end user) without a VC. Inour example the openPromptDialog would display the COST_CENTER four times:

    In such a UI the user must enter the cost center four times, all with the same value. Such abehavior is not desired. Therefore the variable merging merges all 4 COST_CENTER variablesinto one:

  • SAP BusinessObjects Design Studio: Design Studio: Performance Implications of Variables

    Generated by Jive on 2015-06-12+02:004

    What does the beast do?

    The variable container does really cool things. So whats the deal?Like all things in life this comes with a price. The variable container has a significant effect on theapplications performance.

    Whenever the variable container changes, ALL data sources inside the variable container areinvalidated.

    There are three aspects that application developers need to know:

    1) All data sources of an application that have at least one variable join the VC. These datasources share the invalidation life cycle with each other (see 2. and 3. below). Only these datasources that have no variable at all are not inside.

    2) The VC changes whenever a value of a variable changes. I.e. a call to setVariableValueinvalidates all queries in the VC also the queries which do not reference the variable that waschanged.

    3) The VC changes whenever a new data source joins the VC. A data source (with variables)joins the VC when it is loaded via loadDataSource() or re-initialized via assignDataSource(). Asmentioned above this invalidates all data sources that are already part of the VC.

  • SAP BusinessObjects Design Studio: Design Studio: Performance Implications of Variables

    Generated by Jive on 2015-06-12+02:005

    What else should I know?

    A special context to consider when using variables is the application startup. The common placeto put code that runs at startup is the On Startup event of the APPLICATION object.

    During the On Startup event normal data sources (those which have Load In Script setto false) are already initialized. E.g. you can get values from a data source using getData()within the On Startup event.

    This implies that data sources with variables have been initialized using the default values of these variable.

    Calling setVariableValue during On Startup will trigger a re-initialization of all data sources inthe VC. This additional re-initialization is a performance penalty that should be avoided. This canbe done by moving code that initializes variables into the On Variable Initialization event:

    The availability of the On Variable Initialization event allows initialization of variables at startupwhile preserving the concept that data sources are ready to use in the On Startup event.

  • SAP BusinessObjects Design Studio: Design Studio: Performance Implications of Variables

    Generated by Jive on 2015-06-12+02:006

    What should I do to improve performance?

    1) Try to use/find/create queries without variables

    As mentioned above a query that has at least one variable will trigger that the data sourcejoins the VC even if the variable is not used in the application. If you have the appropriatepermissions you could create another version of such a query without a variable. Alternativelyyou could remove the variable from the query if the variable is not used within other tools.

    2) Beware of setVariableValue/Ext - UsesetFilter even if a corresponding variable isavailable

    In other BW related tools variables were a primary mechanism for filtering data. Modern scriptbased tools (like Design Studio) provide a more lightweight mechanism by offering script APIs likesetFilter.

    Even if a variable is available for filtering then the setFilter API should be used instead. Asstated before the setVariableValue always affects all data sources in the variable container(even if they are not related to the variable used in the setVariableValue call).

    The setFilter-API affects only the data source it is called on. There are no side effects to otherdata sources.

    However variables are also used for other purposes than filtering. In such cases the usage of variables is stillnecessary.

  • SAP BusinessObjects Design Studio: Design Studio: Performance Implications of Variables

    Generated by Jive on 2015-06-12+02:007

    3) Use On Variable Initialization to setvariable values at application startup

    At the beginning of On Startup all data sources (except those with Load In Script = true)are already initialized. Calling setVariableValue during On Startup will trigger re-initializationof all data sources that are in the variable container.To avoid this double initialization setVariableValue calls should be moved from On Startup toOn Variable Initialization

    4) Have a close look at Load In Script datasources joining the variable container

    In most cases a late initialization of a data source is a good thing. It helps to increase the startupperformance. However when several data sources are already in the variable container, theinitialization of an additional data source with variables (using loadDataSource()) invalidates allother data sources in the VC.

    There is an optimization in Design Studio that delays the invalidation of the other data sources. I.e.immediately after loadDataSource() only the newly loaded data source fetches data from the BWsystem. However the other data sources in the VC are invalidated in the background. The nextaccess to these other data sources (e.g. calling getData or scrolling in a Crosstab) will trigger are-fetch of data from the BW system.4981 Views Tags: performance, business_objects_design_studio, design_studio, performance_analysis,sapbusinessobjectsdesignstudio, sapdesignstudio, sap_design_studio

    Martin Kolb in response to Saurav Kumar Suman on page 8Jun 10, 2015 3:54 PMThanks for providing the pictures.

    This is a bug that is in Design Studio 1.5 SP0. It is fixed in SP1 which is not yet available.Shipment dates of Design Studio versions (SP's an mahor versions) can be found in SAP note 1760372:https://service.sap.com/sap/support/notes/1760372

    This problem happens when the crosstab has a dynamic size depending on the browser window's size. As atemporary workaround you might consider giving these crosstabs fixed widths/heights until you get an updatedversion of Design Studio.

  • SAP BusinessObjects Design Studio: Design Studio: Performance Implications of Variables

    Generated by Jive on 2015-06-12+02:008

    RegardsMartin

    Saurav Kumar Suman in response to Martin Kolb on page 8Jun 10, 2015 2:33 PMHello Martin,

    Exactly data not showing, after Minimize & Maximize i.e browser window change data is showing immediately,so its not going back to BW.

    After browser minimize & maximize .

    ThanksSaurav Kumar Suman

    Martin Kolb in response to Saurav Kumar Suman on page 9Jun 10, 2015 1:47 PMHi Saurav,

  • SAP BusinessObjects Design Studio: Design Studio: Performance Implications of Variables

    Generated by Jive on 2015-06-12+02:009

    that sounds strange. What do you mean when you say that the data is not shown. Is there an error message?Could you put a screenshot of the started application to your next reply?

    RegardsMartin

    Saurav Kumar Suman in response to Martin Kolb on page 9Jun 10, 2015 1:13 PMHello Martin,

    I have 6 BEx data source, all have one mandatory prompt same name in all FISCAL_YEAR. Iam setting all data source prompts individually in On Variable Initialization event and MergePrompts set to false, and prompt screen is set to false.Then i bind this with 4 Crosstab and 1 line & 1 bar chart. I am wondering that when reports getting loadedcross tab data is not shown on report even on click on chart it is not showing, after minimizing and maximize ofweb page data getting displayed. I tried loading all data using button press then it is OK. I want all data to bedisplayed hen i load the report.

    ThanksSaurav Kumar Suman

    Martin Kolb in response to Saurav Kumar Suman on page 10Jun 10, 2015 9:33 AMHi Saurav,

    thanks for using Design Studio 1.5

    I think I didnt understand your scenario good enough to give a thorough answer. Ill try to answerbased on what I understood.

    Setting Merge Prompts to false disables the variable container in this application. So settingvariable values in this mode only affects the data source you set the variable. In your exampleDS_1.setVariableValueExt(...) invalidates only DS_1, und therefore only affects componentswhere DS_1 is bound to.

    Also with Merge Prompts set to false there is of course a prompt screen appearing if there areunset mandatory variables or if the application has forces the prompt screen to appear.Calling setVariableValue during On Variable Initialization does not invalidate anything becauseat that point in time the data sources have not yet been initialized at all. At that point in time

  • SAP BusinessObjects Design Studio: Design Studio: Performance Implications of Variables

    Generated by Jive on 2015-06-12+02:0010

    setVariableValue only presets a variable value and that newly set value will also appear asvalue in the prompts screen.

    Hope that helps.

    Best regardsMartin

    Saurav Kumar SumanJun 10, 2015 7:45 AMHello Martin Kolb ,

    Can you please tell, how we can handle with invalidate data.Actually i have one prompt (same name) for every 7 BEx data source. when i am loading data the applicationall cross tab is getting invalidated apart from chart. Can i have some event where i can write any code tovalidate this. or some other method to get it corrected.

    I have kept Merge Prompt= Falseand setting Data source viaDS_1.setVariableValueExt("FISCAL_PERIOD", "003.2015"); in On Variable Initialization.Design Studio version 1.5

    ThanksSaurav Kumar Suman

    Nikki Tsoflikis in response to Martin Kolb on page 10Jan 8, 2015 7:34 PMThanks for your reply. We're still working on 1.3 so it might be a while before I get this functionality! I'll workaround it for now.

    Thanks again,Nikki

    Martin Kolb in response to Nikki Tsoflikis on page 11Jan 7, 2015 5:55 PMHi Nikki,

    in the 1.5 version of Design Studio you would do these three steps:

    1) Set the application mode to Unmerged Variables.This would show the prompt for all five queries (A-E) by default

    2) Then you would select the prompts that you would want to see. In that case you would choose A and B. Thiswould result in the two prompts that you would want to get.

  • SAP BusinessObjects Design Studio: Design Studio: Performance Implications of Variables

    Generated by Jive on 2015-06-12+02:0011

    3) Finally you copy the value from prompt B to C through E via some lines of script:

    var valueOfB = DS_B.getVariableValueExt(VAR_NAME);DS_C.setVariableValueExt(VAR_NAME, valueOfB);DS_D.setVariableValueExt(VAR_NAME, valueOfB);DS_E.setVariableValueExt(VAR_NAME, valueOfB);

    RegardsMartin

    Note that 1.5 will be available in Q2 this year.

    Nikki TsoflikisJan 6, 2015 4:33 PMHi Martin,

    I'm joining the party a bit later than others - sorry! This is such a great post, exactly what I need for myDashboard. I have a question relating to the specific merging of variables from different datasources.

    I have 1 datasource (A) that is repeated 4 times, for different views, and this has one one prompt in BEx: Selecttime period/year (multi selection).

    I had to build 4 other queries (B-E) to mimic a cascading filter type of situation since this wasn't possiblewithout SDK. These queries will have the same time prompt as above but I don't want them to merge withQuery A. How do I in such that I only merge the other 4 prompts into one like you suggested in your article?

    In other words, the user will be able to see only 2 prompts when the window pops up.

    Thank you so much,Nikki

    Martin Kolb in response to Gerben Niewold on page 11Dec 8, 2014 4:29 PMThe variable container also works for variables that are not input-ready.But what is the use-case where you need this?

    Martin Kolb in response to Gerben Niewold on page 12Dec 8, 2014 4:27 PMUnfortunately it is not planned to bring this feature into a 1.4 SP.

    Gerben NiewoldDec 8, 2014 3:15 PMGreat article!

  • SAP BusinessObjects Design Studio: Design Studio: Performance Implications of Variables

    Generated by Jive on 2015-06-12+02:0012

    Does this Variable Container only function for input-ready variables (with the default Variable Is Ready forInput option selected) ?

    Gerben Niewold in response to Martin Kolb on page 12Dec 8, 2014 2:58 PMThanks for your reply. Too bad not already available in 1.4!Are you able to bring this feature with the first-next Servicepack in 1.4?

    Martin Kolb in response to Gerben Niewold on page 12Dec 8, 2014 2:52 PMHi Gerben,

    the feature didn't make it into 1.4.However we are just in the development phase for 1.5 and this has been one of the first things that has beenimplemented.

    RegardsMartin

    Gerben Niewold in response to Martin Kolb on page 15Dec 8, 2014 2:30 PMHello Martin,

    Is this .setVariableValue() available in Design Studio 1.4?We really need it for some performance improvements as our query's use variables with user exists we cannotmake use of SetFilter().

    Thanks for replying.

    Martin Kolb in response to Saranya S on page 12Jul 17, 2014 4:15 PMHi Saranya,

    unfortunately I have only limited expertise in this area. However I think it might be related toReference Characteristic of variables. More on this can be found here (see item 4):

    http://help.sap.com/saphelp_nw70/helpdata/en/ac/789b3c4d4d8d15e10000000a114084/content.htm

    RegardsMartin

    Saranya S in response to Martin Kolb on page 13Jul 17, 2014 2:00 PMHi Martin,

  • SAP BusinessObjects Design Studio: Design Studio: Performance Implications of Variables

    Generated by Jive on 2015-06-12+02:0013

    Thanks for your reply. Now all my doubts regarding variable container is cleared.

    As you said, we can create same variable for different infoproviders. In my case, I am not able to create samevariable for two different infoproviders . One infoprovider is loaded with ECC master data and another one isloaded with transaction data and both the infoproviders are composte providers. Could you please suggest whyI am facing this issue ?

    Regards

    Saranya S

    Martin Kolb in response to Saranya S on page 13Jul 15, 2014 6:41 PMHi Saranya,

    with BW data sources the variable container is activated automatically. As a Design Studio applicationdeveloper you currently do not have control over the activation. The activation and merging is based on thesame technical variable. So either the variables are the same in two (or more) data sources, then merging isperformed. If they are not the same, then there is no way of merging them.

    The screenshot that I was providing with the four COST_CENTER was just for illustrational purposes toshow how things would look like without variable merging. This is currently not possible when using BW datasources.

    So when you are really having different variables in your scenario there is no way to merge them.However I dont understand why the different infoproviders use a different variable for the samesemantic thing. This is a very useful feature of BW to share the same variable between multipleinfoproviders. In that case you need to adapt the infoproviders on BW. Design Studio cannot helpin the case.

    RegardsMartin

    Saranya SJul 15, 2014 1:15 PMHi Martin,

    Thanks for sharing this information.

    In your example, COST_CENTRE variable is coming four times in the prompt dialog. My question is whether allthe "COST_CENTRE" variables are same which are coming from different data sources(i.e all the variables aresharing same technical name) or each variable is having different technical name.

  • SAP BusinessObjects Design Studio: Design Studio: Performance Implications of Variables

    Generated by Jive on 2015-06-12+02:0014

    I am also facing the same scenario. In my case, Region variable is repeated twice in prompt dialog. I triedto apply variable container concept. Since the region variable's technical name is different for both, variablecontainer concept is not working and We couldnt use same variables in all the queries, since each variable iscoming from(created for) different infoproviders.

    Regards

    Saranya S

    Arun Prasad in response to Martin Kolb on page 14Jul 8, 2014 6:58 PMThanks for confirmation martin.

    Martin Kolb in response to Arun Prasad on page 14Jul 8, 2014 4:46 PMHi Arun,

    currently this feature does not have a high priority and it will not be in the next version (1.4) of Design Studio.However subsequent versions of DS might include this feature.

    Best RegardsMartin

    Arun PrasadJul 8, 2014 3:38 PMHello Martin,

    I want the same variable to pull different Fiscal Period for 2 datasources based on different dropdown selection.With Application I can only set only one value.

    Do you think SAP will provide DS specific SetVariableValue in the future support packs are versions?

    ThanksArun

    Martin Kolb in response to Arun Prasad on page 15Jun 30, 2014 12:47 PMHi Arun,

    the functions "setVariableValue" and "setVariableValueExt" belong to the APPLICATION object.Once you type APPLICATION into the script editor and then the "." (dot) a list of available functions pops up:

  • SAP BusinessObjects Design Studio: Design Studio: Performance Implications of Variables

    Generated by Jive on 2015-06-12+02:0015

    You can then choose the function you need (e.g. setVariableValue)-

    RegardsMartin

    Arun PrasadJun 13, 2014 1:29 AMHello Martin,

    I have installed Design studio version 1.3 (Version 13.0.0.201405058. I am trying to set variable values basedon a dropdown selection of Fiscal period for specific data sources defined within Design studio.

    I am not able to find the functions SetVariablevalue as part of the script editor.

    ThanksArun

    Martin Kolb in response to Kami Pieums on page 16May 8, 2014 3:04 PM

  • SAP BusinessObjects Design Studio: Design Studio: Performance Implications of Variables

    Generated by Jive on 2015-06-12+02:0016

    Hi Kami,

    the current version of Design Studio will simply apply the specified value ofAPPLICATION.setVariableValue to all views the have a variable with the same name. If this valueis technically valid for all of these views, then there should be no error.

    However in current versions of Design Studio there is no way to set different values for differentviews (as in your example 4710 for one and 4711 for the other).

    Future versions of Design Studio will be enhanced to support this. There are two alternatives (which might beprovided both):

    1) Setting different values via the data source API:DS_1.setVariableValue("COST_CENTER", "4710");DS_2.setVariableValue("COST_CENTER", "4711");

    2) Setting different values via fully qualified name of the variable:APPLICATION.setVariableValue(my_package/my_sub_package/MY_HANA_VIEW1/COST_CENTER,4710);APPLICATION.setVariableValue(my_package/my_sub_package/MY_HANA_VIEW2/COST_CENTER,4711);

    RegardsMartin

    Kami Pieums in response to Martin Kolb on page 18May 7, 2014 5:32 PMHi Martin,

    I just Join the discusion with a question regarding the concept of sharing variables between multiple views onHANA. And would like to know How to set the variables in such a case where we have 2 different views withthe same Parameters?Doing something likeAPPLICATION.setVariableValue("COST_CENTER", "4711");indeed returns an error.Is there a way to specified which Parameter belong to which view? like teh hypothetic:DS_1.setVariableValue("COST_CENTER", "4710");DS_2.setVariableValue("COST_CENTER", "4711");

    Thanks,Kami

    Martin Kolb in response to M. van Foeken on page 17

  • SAP BusinessObjects Design Studio: Design Studio: Performance Implications of Variables

    Generated by Jive on 2015-06-12+02:0017

    Apr 8, 2014 9:02 AMHi Martijn,

    Im not sure if this works in your scenario, but one possibility to use context data (like a user ID)in an application is to pass it into the application via URL parameter and global script variable.The data itself is retrieved in another web application that in turn starts the real app.To define a global variable that can be used as an URL Parameter, click on Global scriptVariables setting of the applications properties.

    After that you can use this global script variable to set the variable value of the data sources:

    APPLICATION.setVariableValue("IP_USER_ID", XIP_USER_ID);

    The problem is that Design Studio apps are currently lacking an easy way of redirecting to a newapp. Therefore some other technology that determines the user id (e.g. an HANA XS Engine.xsjs app, or any BIP based web technology) might be a good choice for that pre-app thatfinally does the redirect.

    RegardsMartin

    M. van Foeken in response to Martin Kolb on page 18Apr 7, 2014 8:00 PMHi Martin,

    I'm actually facing the scenario you are describing in a current project. Due to the fact that a data source canonly have one initial view I need to add SAP HANA views multiple times as a data source if I need a differentinitial view for multiple crosstabs and / or charts. Being able to recalculate the 'cube' based on an initial viewper crosstab or chart would be a great improvement! More similar as the 'relational micro cube' that is part of aWeb Intelligence document.

  • SAP BusinessObjects Design Studio: Design Studio: Performance Implications of Variables

    Generated by Jive on 2015-06-12+02:0018

    Regarding the suggestion to 'Use On Variable Initialization to set variable values at applicationstartup' we are facing another challenge. All our SAP HANA views are executed with aIP_USER_ID. We need this input parameter to filter the data in the views based on authorizationtables stored in SAP HANA (business requirement). The user id of the user executing the DesignStudio application on BIP is captured when loading the first data sources. Then during On Startupit's used to fill the IP for other data sources as well. During the 'On Variable Initialization' the userid is not available yet.

    Any other tips or tricks to speed-up startup and execution times?

    With kind regards,

    Martijn van Foeken | IntenzzMartin Kolb in response to Jrg Rose on page 19

    Apr 7, 2014 5:21 PMHi Jrg,

    you're absolutely right with both comments.We'll try to improve on the background processing stuff. Considering the visibility (as you mentioned) might bea good approach. Thanks for the suggestion.

    RegardsMartin

    Martin Kolb in response to M. van Foeken on page 19Apr 7, 2014 5:15 PMHi Martijn,

    on HANA there is no concept of sharing variables between multiple views. Each view has its ownvariables, even if they share the same name and type. So the concept of variable merging onHANA is less useful than on BW data sources. Therefore on HANA the final implementation willprobably end up not invalidating other data sources when variable values are set.

    The only useful scenario for merging variables in HANA data sources is when the same view is insertedmultiple times into the same Design Studio application. In that case the variables of the data sources based onthe same view will share the variable values.

  • SAP BusinessObjects Design Studio: Design Studio: Performance Implications of Variables

    Generated by Jive on 2015-06-12+02:0019

    RegardsMartin

    Jrg RoseApr 7, 2014 3:45 PMHi Martin,

    thanks for the useful architecture insight.Unfortunately, there are issues with this approach:

    a) Authorization relevant filters must be set in the global filters using variables. In a solution with manydatasources this will create the performance issues you mentioned already.

    b) Avoiding the performance using by loading datasources in background is not really feasible for dashboardswith many datasources / tables / charts. The reason is that it requires a lot of scripting to get this right, it is veryerror prone and currently the table and chart component are even displaying wrong data (i.e. dummy data) inthe runtime when the datasource is not initialised. There should be a simple option to load the datasource onlywhen it is needed, which should be determined by the Design Studio engine depending on component visibility.

    It would be great if this could be considered from an architecture point of view to increase user acceptance ofthe tool by improving both performance and designer usability.

    Best RegardsJrg

    M. van FoekenApr 7, 2014 3:29 PMHi Martin,

    Great blog! Do you expect that Design Studio will behave similar when using SAP HANA views as datasources. In general it seems that adding more data sources introduces an exponential amount of negative sideeffects, especially if you take the seqential execution of data sources into consideration.

    I hope more information will be shared how Design Studio handles certain stuff at run-time!

    With kind regards,

    Martijn van Foeken | Intenzz