SAP Knowledge Base Article - Public

3847105 - Row dimension order not following scripted Table.addDimensionToRows sequence in SAP Analytics Cloud (SAC)

Symptom

After using the addDimensionToRows function to add several row dimensions, the display order of row dimensions is not as expected.

Environment

SAP Analytics Cloud

Reproducing the Issue

  1. Open a story that contains a table.
  2. Run a script that retains a subset of existing row dimensions, then iterates over a list and calls Table.addDimensionToRows() to add additional row dimensions.
  3. Observe that the row dimension order are not the same as the list.

Cause

If a dimension already exists in the row axis, calling Table.addDimensionToRows does not re-add or reposition it; the dimension stays in its original location.

Resolution

  1. Modify the script to remove all row dimensions from the table before adding any new ones (avoid retaining a subset during reconfiguration).
  2. Add the row dimensions back in the exact desired sequence using Table.addDimensionToRows() for each dimension.
  3. After the final row order is set, resume refresh and re-enable planning only if required by the application logic.
  4. Validate the result by comparing with the order produced via the standard Builder panel to ensure the scripted order matches expectations.

See Also

https://help.sap.com/doc/1639cb9ccaa54b2592224df577abe822/release/en-US/index.html#Table_MaddDimensionToRows

Keywords

SAC, unified story, script, addDimensionToRows, dimension order, rows/columns settings, table API, row dimensions, removeDimension, onInitialization, planning table, story table, ordering, scripting, builder panel , KBA , LOD-ANA-UNS-SCR , Unified Story Scripting related Issues , Problem

Product

SAP Analytics Cloud 1.0