SAP Knowledge Base Article - Public

3780471 - rankBy() script does not work with BW queries having multiple structures in SAP Analytics Cloud

Symptom

  • Script-based ranking using rankBy() does not produce the same result as manual ranking applied via the table context menu.
  • Manual ranking behaves as expected when using Top N, Based On a measure, and Ranked By all dimensions individually.
  • The issue occurs when the underlying BW query contains multiple structures.
  • When the BW query contains a single structure, both manual ranking and rankBy() work as expected.

Environment

SAP Analytics Cloud Version 2026.08.15

Reproducing the Issue

  1. Add a table based on a BW live model whose query contains two structures.
  2. In the table, apply a manual ranking from the context menu (Right-click > Rank), choose Top N based on a measure, and apply. Observe that the ranking is applied correctly.
  3. Remove the manual ranking from the same table.
  4. Run a script that calls Table.rankBy() to apply the same Top N ranking criteria as in step 2.
  5. Observe that the scripted ranking does not apply.
  6. In the same story, use another table based on a BW query with a single structure and run the same rankBy() script.
  7. Observe that the ranking is applied correctly in the single-structure scenario.

Cause

When a table is based on a BW model that contains a dimension with multiple structures, or the linked dimensions contain multiple structures, the Table.rankBy() script API refuses to produce a rank.

Resolution

The fix is included in version 2026.8.16.

See Also

Keywords

rankBy, ranking, top n, analytics designer, table ranking, bw live connection, multiple structures, secondary structure, scripting, unified story, table api, rank discrepancy, bw query, rank behavior, script vs manual , KBA , LOD-ANA-UNS-SCR , Unified Story Scripting related Issues , LOD-ANA-TAB , Table , Problem

Product

SAP Analytics Cloud all versions