cancel
Showing results for 
Search instead for 
Did you mean: 

Javascript API (getMembers, getMember...) not longer working on Version Dimension

mmanzi
Member

We are currently facing an issue regarding the management of the "Version" dimension in JavaScript functions within SAP Analytics Cloud. I would like to provide you with detailed information about the error to seek a solution.

  • Error Description:

In the initialization of all our Planning model "Stories," a dynamic filter has been implemented. This filter automatically derives the planning year based on the selection of the "Version." This is achieved by reading the "PLAN_YEAR" attribute from the selected member of the "Version" dimension using JavaScript. The code for this logic is as follows:

var radio = RadioButtonGroup_1.getSelectedKey();

VAR_PLAN_YEAR = PLAN_HR.getMember("Version", radio).properties['PLAN_YEAR'];

Where "PLAN_HR" is the model name, "radio" is the member of the "Version" dimension (e.g., "public.Budget"), and "VAR_PLAN_YEAR" is the "PLAN_YEAR" attribute of the member.

This logic is fundamental to all "Stories" in our planning model and it has always worked properly until Thursday November 2nd 2023.

  • Error Message:

Starting from the following day, when triggering this logic manually or from the "onInitialization" event of the Story, the logic no longer functions and returns an error. When debugging from the console, the error message encountered is as follows:

"Cannot read properties of undefined (reading 'properties')

TypeError: Cannot read properties of undefined (reading 'properties')"

  • Solutions or Attempts:

It appears that the "getMember" function and similar ones always return "undefined" whenever executed on the "Version" dimension. For example, "undefined" is also returned using the "getMembers" function when attempting to expose all members of the "Version" dimension, without accessing specific attributes, by executing the following code:

var VERSION_LIST = PLAN_HR.getMembers("Version")

It is essential to note that the error is NOT encountered when using a "Generic" dimension. The error is specific and exclusive to dimensions of type "Version."

I kindly request your assistance in addressing this issue. If you require any additional information or files, please let me know.

Accepted Solutions (0)

Answers (2)

Answers (2)

SeerOfSig
Advisor
Advisor

SAP Note https://me.sap.com/notes/3397906 describes this limitation and suggests alternative code to achieve similar results. We will continue to enhance this note in the future with additional code samples.

Note that PlanningModel.GetMember function was never officially supported for non-generic dimensions.

However, since previous versions of SAC did not provide adequate warnings regarding this we have rolled back this limitation in the 2023 QRC4 release on November 11th. So the original code should now be working again.

We will maintain support until at least the 2024 QRC1 release to provide time for customers to implement alternative code.

Regards,

Peter

JefB
Active Contributor

hi peter.kreutlein ,

Thank you for reverting!

How did this code change happen on a patch release affecting all tenants (preview & production) all at once?

Will customers be forced to use the suboptimal workaround code (adding hidden tables etc.) with expected performance penalty? So there will be no optimal solution?

SeerOfSig
Advisor
Advisor
0 Kudos

Hi jefbaey , I don't have any further details at this point regarding what code change caused this function call to fail. While not officially supported, I agree that initiating this change suddenly was not optimal.

At this time the only officially supported solution is the workaround code referenced in the above note. I have asked the development team to continue to enhance the note with additional code examples and to try to optimize any alternative solutions.

The development team is in parallel investigating removing the limitation at least for the version dimension but this investigation is in early stages and we do not know yet if this will be possible. I know this does not seem logical as the function was/is working currently, but my understanding is that there are some use cases where the data returned for non-generic dimensions is wrong and this is why we do not officially support it.

Regards,

Peter

N1kh1l
Active Contributor

mmanzi

Yes this is a known issue since last few days. The below might help. In short there were updates pushed which made this API break. This API was working but its not supported for version type dimension as per SAP documentation. SAP is aware of it and working on a temporary fix but the caveat is to move to an alternate solution ( using hidden table ).

Please read the comment section of the below thread.

https://answers.sap.com/questions/14006072/analytical-application-button-click-event-error-sc.html

https://answers.sap.com/questions/14002670/sap-analytics-cloud-analytics-design-non-generic-d.html

https://blogs.sap.com/2023/11/08/retrieving-property-values-from-dimensions-using-tables-in-analytic.../

SAP response on the issue through the KBA

https://me.sap.com/notes/3397906

Br.

Nikhil