Skip to Content
0

SAP Design Studio getVariables

Jun 13, 2017 at 01:00 PM

55

avatar image

Hi,

We are encountering strange behavior in Design Studio 1.6 SP4 Patch 1 (16.4.1). To simplify the problem for testing, I created a new Analysis Application with two data sources - DS_ENR_BY_SPEC and DS_NO_ADVISOR (both Bex data sources with variables). The only report object is a text box, TEXT_1.

The code below runs on startup, and is designed to populate TEXT_1 with all variable names.

var variables_arr = DS_ENR_BY_SPEC.getVariables(); var variables_str=""; variables_arr.forEach(function(element, index) { variables_str=variables_str+element.text+"\n";

});
TEXT_1.setText(variables_str);

However, when the script runs at start up, TEXT_1 populates with all variables from both datasources - DS_ENR_BY_SPEC and DS_NO_ADVISOR. This seems to be a problem with the getVariables command. We have had this issue happen across numerous Analysis Applications - getVariables will return information about all Bex variables in the report, not just the one referred to in the code.

Has anyone encountered this issue, and is there a solution?

Thanks,

Scott

10 |10000 characters needed characters left characters exceeded

The only related note I found was this: https://launchpad.support.sap.com/#/notes/2365417/E

You may want to check release notes for Design Studio 1.6 SP05 https://launchpad.support.sap.com/#/notes/2376849 -but I couldn't find anything related

Do you have Merge Variables turned on or?

1
* Please Login or Register to Answer, Follow or Comment.

1 Answer

Best Answer
Mustafa Bensan Jun 13, 2017 at 02:28 PM
0

Hi Scott,

I have been able to replicate your issue. It occurs when the Merge Prompts property of the application is set to true. If you set this property to false, then only the variables associated with the specified data source are returned by getVariables() as desired.

Regards,

Mustafa.

Show 4 Share
10 |10000 characters needed characters left characters exceeded

Thanks Mustafa (and Tammy)! This does seem to work. Apologies for not catching this one - it still seems odd that a script that is specifying which query to pull variables from would return variables from all queries.

Thanks again

Scott

0

Hi Mustafa,

One additional question - sorry. I built this testing report as a simplification of issues with an Application a coworker made. I did not realize that he needs prompts merged on start up, but he needs to be able to parse out each Query's variables so that he can display only relevant variables when the user clicks a given tab.

In other words, if Tab 1 contains DS_NO_ADVISOR, when Tab 1 is selected, we want to populate an info box with each variable and its value only for DS_NO_ADVISOR. I haven't been able to find any variable properties available via getVariables() that could be referenced within the variables_arr variable from my question. If such a property were available, it would allow me to identify which query an element belongs to and filter via a foreach loop. Do you know of any way to isolate the variables from one query at a time via script if Merge Prompts is set to True?

0

Hi Scott,

From what I can tell, there doesn't appear to be an effective method of retrieving variables specific to a data source when the Merge Prompts property is set to true. That being said, given that the getVariables() method is at the data source level and not the application level, I would have expected the returned list not to be influenced by the Merge Prompts property at all. Personally, I would consider the current behaviour a bug and think it would be worth raising an SAP Support Ticket to that effect. If getVariables() is a method of a data source, then it is counter-intuitive that ALL variables in the application are returned.

Regards,

Mustafa.

0

Agreed - glad I'm not the only one who finds this buggy - thanks! We'll open a ticket.

0