Symptom
- Since patch release 2023.21.4, calling the GetMember function on the Type library PlanningModel in an analytic application or story 2.0 script code for any non-generic dimension results in an error message of the type "Dimension Type VersionDim not supported" or similar.
- Script fails to execute and analytic application functionality is no longer working.
- GetMember script function on PlanningModel Type library returns error for non-generic dimensions (Version, Organisation, Date or Account)
Image/data in this KBA is from SAP internal systems, sample data, or demo systems. Any resemblance to real data is purely coincidental.
Cause
Planningmodel getMember API does not support non-generic dimensions (like Version or Organisation).
If this API is used mistakenly on a non generic Dimension, it may return incorrect data.
For reference, SAC documentation explicitly states the following note in two places (Help document & scripting editor environment):
"Returns a planning model member. Note: Currently, this operation only supports generic dimensions."
API Document: https://help.sap.com/doc/958d4c11261f42e992e8d01a4c0dde25/release/en-US/index.html#PlanningModel_MgetMembers
Scripting editor environment:
As this was never officially supported on non-generic dimensions we cannot promise this functionality will still work in later releases.
Resolution
Consider using the API for Type library datasource to retrieve member data related to non-generic dimensions. First, a table or chart must be bound to the non-generic dimension. If there isn't a Table or Chart widget already bound to the dimension, you'll need to add a hidden one.
To obtain the ID and description of version members, use either of the following Script APIs:
1. DataSource.getMembers
Use the following code as an example:
var versionMembers = Table_1.getDataSource().getMembers("Version_Dimension_Id");
console.log(versionMembers);
2. DataSource.getResultSet
To list all version members on the Table widget and get their ID, description, and properties, use the following Script API:
var resultSet = Table_1.getDataSource().getResultSet();
console.log(resultSet);
Keep the following points in mind when using the DataSource.getResultSet API:
- The table or chart should contain at least one data record; otherwise, it will return an empty array. To ensure at least one data record exists, you may create a dummy calculation with a formula like "1".
- If you want to return properties such as a planning version's start and end dates, opt for a table. Charts won't be suitable as they don't support Properties.
Keywords
KBA , LOD-ANA-AD , Analytics Designer , LOD-ANA-PL-DE , Data Entry and Mass Data Entry , LOD-ANA-UNS-SCR , Unified Story Scripting related Issues , Problem