SAP Analytics Cloud Scripting
Related Skills
- sap-dependency-security: Use when securing dependency, SDK/tooling, and source-pinned SAC MCP upgrades used in story automation pipelines
- sap-browser-automation: Use for in-app manual authentication, consent-gated Edge profile reuse, fresh Edge/CDP startup, auth-state bootstrap, and browser recovery
When to Use This Skill
Use this skill when writing or debugging SAC Analytics Designer scripts, Optimized Story Experience scripts, widget APIs, data-source filtering/selection logic, planning/version scripts, export/navigation handlers, performance-sensitive story logic, or SAC MCP-assisted automation.
Comprehensive skill for scripting in SAP Analytics Cloud (SAC) Analytics Designer and Optimized Story Experience.
For authenticated SAC browser runtime inspection, use sap-browser-automation for manual in-app authentication, consent-gated Edge profile reuse, fresh Edge/CDP startup, auth-state bootstrap, and recovery. Load local references/edge-cdp-control.md for SAC scripting-specific boundaries. Use CDP for local runtime triage, widget-state checks, and approved screenshots; do not touch unrelated tabs.
Getting Started
When the user invokes this skill with no specific task (e.g. "help with SAC scripting", "use SAC scripting skill", or no follow-up question), respond with this structured orientation:
Welcome! I can help you with SAP Analytics Cloud scripting.
First, which environment are you working in?
- Analytics Designer — application-based scripting, full API
- Optimized Story Experience — story-based scripting, OSE API (v2025.20)
Then, what do you need help with?
- Write a new script (filter, planning, navigation, export...)
- Debug an existing script
- Optimize performance
- Find the right API method
- Planning operations (version management, data locking...)
Plugin Components
This plugin provides specialized tools for SAC development:
Agents (use via Task tool):
sac-script-debugger - Debug script errors, trace issues
sac-performance-optimizer - Analyze and fix performance bottlenecks
sac-planning-assistant - Guide planning operations and version management
sac-api-helper - Find correct APIs and provide code examples
Commands (use via /command):
/sac-script-template - Generate script templates (filter, planning, export, etc.)
/sac-debug - Interactive debugging guidance
/sac-optimize - Performance analysis and recommendations
/sac-planning - Planning operation templates
Hooks:
- Automatic validation on SAC script writes for common issues
MCP Setup
This plugin ships with a .mcp.json that connects to the trusted secondsky/sap_analytics_cloud_mcp
server, exposing 90 SAC REST API tools across 11 service areas (Content, Data Export, Data Import,
Multi Actions, Calendar, Content Transport, User Management, Monitoring, Schedule & Publication,
Translation, Smart Query).
The SAC MCP is source-installed, not npm-installed. Use sap-dependency-security before changing the trusted fork or commit pin because this server receives SAC OAuth credentials and exposes tenant API tools.
Before using MCP tools, check if the server is already installed:
- Look for
.claude/sac-mcp.local.md in the project
- Or check if
SAC_MCP_PATH is set in the environment
If not installed, ask the user once: "Would you like help setting up the SAC MCP server?"
If yes, guide them through:
Clone and build:
git clone https://github.com/secondsky/sap_analytics_cloud_mcp
cd sap_analytics_cloud_mcp
git checkout 2020235505d98111c2889598ab2217c1619b6943
npm ci --ignore-scripts
npm run build
Configure environment variables:
SAC_MCP_PATH — absolute path to the cloned repo (e.g. /home/user/sap_analytics_cloud_mcp)
SAC_MCP_COMMIT — 2020235505d98111c2889598ab2217c1619b6943
SAC_BASE_URL — SAC tenant root URL (e.g. https://mytenant.eu10.hanacloudservices.cloud.sap)
SAC_TOKEN_URL — OAuth token endpoint
SAC_CLIENT_ID / SAC_CLIENT_SECRET — from SAC OAuth client configuration
After successful install, write .claude/sac-mcp.local.md (gitignored) with:
# SAC MCP Installation Record
- Installed: [date]
- Repository: https://github.com/secondsky/sap_analytics_cloud_mcp
- Commit: 2020235505d98111c2889598ab2217c1619b6943
- Path: [absolute path to build/index.js]
- Build command: npm ci --ignore-scripts && npm run build
- Env vars configured: SAC_MCP_PATH, SAC_MCP_COMMIT, SAC_BASE_URL, SAC_TOKEN_URL, SAC_CLIENT_ID, SAC_CLIENT_SECRET
This prevents re-prompting in future sessions.
What's New in Q2 2026 (2026.8)
Key scripting enhancements in the latest SAC release:
- Enhanced
onAfterExecute Event - Upload events now include message, statistics, rejected records, target version, and filename
- Data Export API Job Monitoring - New job monitor tab for delta extraction and calculation jobs
- Data Import Service API - Import master data to public dimensions in SAP Datasphere; import external fact data to private versions
- Multi-Action API Step - HTTP 204 response now allowed; enhanced header field restrictions
- Export to S/4HANA Deprecated - Use write-back integration scenario instead
- Asymmetric Reporting - Differing time ranges, hierarchies, and measures per row/column
- Composite Versioning - Manage multiple composite versions during story design
See references/whats-new-qrc2-2026.md for complete details.
Environment Detection
Before writing or analyzing any script, identify which SAC environment the user is working in.
Detection signals:
| Signal |
Environment |
Mentions .story, "Optimized Story", OSE, Story., Application.getActivePage() |
OSE |
Mentions Analytics Designer, AnalyticApplication, Designer, .application |
Analytics Designer |
| Says "SAC script" / "my script" without further context |
Unclear |
When environment is unclear, ask ONE concise question before proceeding:
"Are you scripting in Analytics Designer or Optimized Story Experience? This determines which API reference I use."
Do not ask again after the user answers.
After confirmation, use the correct references:
- OSE →
references/ose-api-*.md (8 files, Q2 2026, v2025.20)
- Analytics Designer →
references/api-*.md (existing files)
Reporting Story Workflow
Use this workflow for read-only SAC stories, dashboards, and management reports. It is separate from planning: route writeback, version publishing, data actions, allocations, data locking, and other planning operations to sap-sac-planning.
- Establish the contract: identify the tenant, story, data source, intended audience, and whether the user forbids model changes. Treat a reporting-only request as story-layer work unless the user explicitly authorizes a broader scope.
- Inspect actual metadata: confirm the selected model and use only its exposed dimensions, measures, hierarchies, time fields, currencies, and comparison categories. Never invent a field because it would be useful for a proposed chart or KPI.
- Design at the story layer: define pages, widgets, filters, selections, navigation, and supported story calculations. Label comparisons explicitly as actual-versus-budget, forecast, or another available category.
- Implement safely: before saving, verify that the current SAC area is Story Designer rather than Modeler. Keep common filters and dependent-widget interactions read-only and non-destructive.
- Verify or hand off: validate page and widget readiness with
sap-sac-test-automation. If authenticated tenant control is unavailable, follow sap-browser-automation and the local references/edge-cdp-control.md recovery path. If access still fails, do not claim that the story was created; provide the complete story specification for manual execution or a later connected session.
Read-Only Story Contract
When the model must not change, the following are allowed:
- create or edit story pages, charts, tables, KPI cards, filters, navigation, and story-layer calculations supported by SAC;
- rename story objects and save the story;
- inspect model metadata and perform read-only validation.
The following are forbidden without explicit scope and approval:
- editing model dimensions, measures, properties, connections, calendars, allocations, or settings;
- creating model-level calculated measures or changing master data, roles, or permissions;
- publishing planning versions, executing data actions, changing locks, or writing back planning data.
If a required field or measure is not exposed by the model, omit the dependent widget and record the omission. Do not change the model to make the design fit.
Implementation-Ready Handoff
When tenant interaction is blocked, return a usable specification containing:
- story purpose, audience, data source, and confirmed model metadata;
- page-by-page widgets using only resolved fields;
- filters, comparison semantics, selections, and drilldowns;
- omitted widgets or unresolved fields with the reason for each;
- read-only safety constraints and the verification evidence still required.
Large Reference Search Routing
Search large OSE API references with rg before opening them. Use patterns such as rg -n "class Chart|interface DataSource|enum Feed|setDimensionFilter|getPlanning|PlanningModel" references/ose-api-*.md, then read only the matching section.
- Use
references/ose-api-datasource.md for DataSource, DataAction, DataBinding, DataLocking, DataChangeInsights, and result-set methods.
- Use
references/ose-api-chart-viz.md for Chart, Table, GeoMap, RVisualization, ValueDriverTree, feeds, and visualization APIs.
- Use
references/ose-api-planning-calendar.md for Planning, PlanningModel, versions, calendars, data actions, and planning workflows.
- Use
references/ose-api-application-core.md for Application, PageBook, Panel, Popup, Widget, and lifecycle or container APIs.
- Use
references/ose-api-types-enums.md for enum/type lookup when a method signature mentions Feed, Layout, NumberFormat, VariableValue, or other SAC-specific types.
- Use smaller
references/api-*.md files first for Analytics Designer unless the user explicitly says Optimized Story Experience.
Quick Start
Script Editor Access
- Analytics Designer: Edit mode → Select widget → Scripts tab
- Optimized Story Experience: Advanced Mode → Select widget → Add script
Basic Script Structure
// Event handler example (onSelect on Chart_1)
var selections = Chart_1.getSelections();
if (selections.length > 0) {
var selectedValue = selections[0]["Location"];
Table_1.getDataSource().setDimensionFilter("Location", selectedValue);
}
Core APIs
DataSource API
Access via Widget.getDataSource(). Key methods:
getMembers(dim, {accessMode: MemberAccessMode.BookedValues}) - Get dimension members efficiently
getResultSet() - Cached data access (preferred over getData())
setDimensionFilter(dim, value) - Apply filters
setRefreshPaused(true/false) - Batch multiple operations
Planning API
Access via Table.getPlanning(). Key operations:
getPublicVersion() / getPrivateVersion() - Version access
publish() - Submit private to public
copyFromPublicVersion() / copyToPublicVersion() - Data copy
setLock(true/false) - Data locking
Widget APIs
- Charts:
addMeasure(), addDimension(), getSelections()
- Tables:
addDimensionToRows(), setZeroSuppressionEnabled()
- Containers: Panel, TabStrip, PageBook for layout
Application Object
Global utilities:
Application.showBusyIndicator() / hideBusyIndicator()
Application.showMessage(type, text)
Application.getUserInfo() / getInfo()
Performance Best Practices
Minimize Backend Calls
// Use getResultSet() (cached) instead of getMembers() (backend)
var data = ds.getResultSet();
Batch Filter Operations
ds.setRefreshPaused(true);
ds.setDimensionFilter("Dim1", value1);
ds.setDimensionFilter("Dim2", value2);
ds.setRefreshPaused(false); // Single refresh
Keep onInitialization Empty
Defer heavy operations to lazy loading or first interaction.
Use BookedValues for Members
var members = ds.getMembers("Dim", {accessMode: MemberAccessMode.BookedValues});
Debugging
Console Logging
console.log("Debug:", myVariable);
console.log("Selections:", JSON.stringify(Chart_1.getSelections()));
Browser DevTools
- Press F12 → Console tab
- Filter by "Info" type
- Add
?APP_PERFORMANCE_LOGGING=true to URL for timing
Bundled Resources
Reference Files (66 files):
- Core APIs:
references/api-datasource.md, references/api-widgets.md, references/api-planning.md
- Advanced:
references/api-calendar-bookmarks.md, references/api-advanced-widgets.md
- Best Practices:
references/best-practices-developer.md, references/best-practices-planning-stories.md
- Language:
references/scripting-language-fundamentals.md
- Q2 2026-relevant API updates:
references/whats-new-qrc2-2026.md, references/whats-new-2025.23.md, references/chart-variance-apis.md
- Browser runtime triage:
references/edge-cdp-control.md for SAC-specific boundaries; use shared sap-browser-automation for authentication, Edge/CDP setup, DevToolsActivePort, target selection, and recovery
- OSE API (Q2 2026, v2025.20) — complete method/parameter/return documentation:
references/ose-api-application-core.md — Application, PageBook, Panel, Popup, Widget (15 classes)
references/ose-api-widgets.md — Button, Dropdown, InputField, Slider, Switch, Text, TextArea (15 classes)
references/ose-api-datasource.md — DataSource, DataAction, DataBinding, DataLocking, DataChangeInsights (39 classes)
references/ose-api-chart-viz.md — Chart, Table, GeoMap, RVisualization, ValueDriverTree (20 classes)
references/ose-api-planning-calendar.md — Planning, PlanningModel, all Calendar classes (54 classes)
references/ose-api-filtering-selection.md — FilterLine, FilterValue, Selection (11 classes)
references/ose-api-utilities.md — BookmarkSet, MemberInfo, DimensionInfo, Timer, NavigationUtils (37 classes)
references/ose-api-types-enums.md — All enum types: Feed, Layout, NumberFormat, VariableValue (70 classes)
Templates (56 patterns):
templates/common-patterns.js - 40 general scripting patterns
templates/planning-operations.js - 16 planning-specific patterns
Official Documentation
SAC Version: Q2 2026 (2026.8) | API Version: 2025.20 (OSE Q2 2026)
1---
2name: sap-sac-scripting
3description: |
4 Comprehensive SAC scripting skill for SAP Analytics Cloud Analytics Designer and Optimized Story Experience. This skill should be used when the user asks to "create SAC script", "debug Analytics Designer", "optimize SAC performance", "planning operations in SAC", "filter data in SAC", "use DataSource API", "chart scripting", "table manipulation", "SAC event handlers", "version management", "data locking", "Optimized Story Experience API", "OSE scripting", "OSE widget API", "OSE DataSource", "story scripting API", "OSE planning API", "OSE method", "optimized story", "SAC story scripting", "story script", "SAC scripting", "debug SAC runtime in Microsoft Edge via CDP", or works with SAC widgets, planning models, or analytics applications.
5license: GPL-3.0
6metadata:
7 source: https://skillmd.com/skills/secondsky/sap-sac-scripting
8 maintainer: "Eduard Jiglau"
9 maintainer_email: "hello@sap-ai-skills.com"
10 website: "https://sap-ai-skills.com"
11 version: "2.4.1"
12 last_verified: 2026-06-11
13 sac_version: "Q2 2026 (2026.8)"
14 api_reference_version: "2025.20 (OSE Q2 2026)"
15 documentation_source: https://help.sap.com/docs/SAP_ANALYTICS_CLOUD
16 reference_files: 66
17 template_patterns: 56
18 agents: 4
19 commands: 4
20 status: docs_audited_runtime_pending
21 known_issues:
22 - Live SAC story/runtime checks require tenant evidence before claiming production validation.
23---
24
25# SAP Analytics Cloud Scripting
26
27## Related Skills
28
29- **sap-dependency-security**: Use when securing dependency, SDK/tooling, and source-pinned SAC MCP upgrades used in story automation pipelines
30- **sap-browser-automation**: Use for in-app manual authentication, consent-gated Edge profile reuse, fresh Edge/CDP startup, auth-state bootstrap, and browser recovery
31
32## When to Use This Skill
33
34Use this skill when writing or debugging SAC Analytics Designer scripts, Optimized Story Experience scripts, widget APIs, data-source filtering/selection logic, planning/version scripts, export/navigation handlers, performance-sensitive story logic, or SAC MCP-assisted automation.
35
36Comprehensive skill for scripting in SAP Analytics Cloud (SAC) Analytics Designer and Optimized Story Experience.
37
38For authenticated SAC browser runtime inspection, use `sap-browser-automation` for manual in-app authentication, consent-gated Edge profile reuse, fresh Edge/CDP startup, auth-state bootstrap, and recovery. Load local `references/edge-cdp-control.md` for SAC scripting-specific boundaries. Use CDP for local runtime triage, widget-state checks, and approved screenshots; do not touch unrelated tabs.
39
40## Getting Started
41
42When the user invokes this skill with no specific task (e.g. "help with SAC scripting", "use SAC scripting skill", or no follow-up question), respond with this structured orientation:
43
44> Welcome! I can help you with SAP Analytics Cloud scripting.
45>
46> First, which environment are you working in?
47> 1. **Analytics Designer** — application-based scripting, full API
48> 2. **Optimized Story Experience** — story-based scripting, OSE API (v2025.20)
49>
50> Then, what do you need help with?
51> - Write a new script (filter, planning, navigation, export...)
52> - Debug an existing script
53> - Optimize performance
54> - Find the right API method
55> - Planning operations (version management, data locking...)
56
57## Plugin Components
58
59This plugin provides specialized tools for SAC development:
60
61**Agents** (use via Task tool):
62- `sac-script-debugger` - Debug script errors, trace issues
63- `sac-performance-optimizer` - Analyze and fix performance bottlenecks
64- `sac-planning-assistant` - Guide planning operations and version management
65- `sac-api-helper` - Find correct APIs and provide code examples
66
67**Commands** (use via /command):
68- `/sac-script-template` - Generate script templates (filter, planning, export, etc.)
69- `/sac-debug` - Interactive debugging guidance
70- `/sac-optimize` - Performance analysis and recommendations
71- `/sac-planning` - Planning operation templates
72
73**Hooks**:
74- Automatic validation on SAC script writes for common issues
75
76## MCP Setup
77
78This plugin ships with a `.mcp.json` that connects to the trusted `secondsky/sap_analytics_cloud_mcp`
79server, exposing 90 SAC REST API tools across 11 service areas (Content, Data Export, Data Import,
80Multi Actions, Calendar, Content Transport, User Management, Monitoring, Schedule & Publication,
81Translation, Smart Query).
82
83The SAC MCP is source-installed, not npm-installed. Use **sap-dependency-security** before changing the trusted fork or commit pin because this server receives SAC OAuth credentials and exposes tenant API tools.
84
85**Before using MCP tools**, check if the server is already installed:
86- Look for `.claude/sac-mcp.local.md` in the project
87- Or check if `SAC_MCP_PATH` is set in the environment
88
89If not installed, ask the user once: **"Would you like help setting up the SAC MCP server?"**
90
91**If yes**, guide them through:
92
931. Clone and build:
94 ```bash
95 git clone https://github.com/secondsky/sap_analytics_cloud_mcp
96 cd sap_analytics_cloud_mcp
97 git checkout 2020235505d98111c2889598ab2217c1619b6943
98 npm ci --ignore-scripts
99 npm run build
100 ```
101
1022. Configure environment variables:
103 - `SAC_MCP_PATH` — absolute path to the cloned repo (e.g. `/home/user/sap_analytics_cloud_mcp`)
104 - `SAC_MCP_COMMIT` — `2020235505d98111c2889598ab2217c1619b6943`
105 - `SAC_BASE_URL` — SAC tenant root URL (e.g. `https://mytenant.eu10.hanacloudservices.cloud.sap`)
106 - `SAC_TOKEN_URL` — OAuth token endpoint
107 - `SAC_CLIENT_ID` / `SAC_CLIENT_SECRET` — from SAC OAuth client configuration
108
1093. After successful install, write `.claude/sac-mcp.local.md` (gitignored) with:
110 ```markdown
111 # SAC MCP Installation Record
112 - Installed: [date]
113 - Repository: https://github.com/secondsky/sap_analytics_cloud_mcp
114 - Commit: 2020235505d98111c2889598ab2217c1619b6943
115 - Path: [absolute path to build/index.js]
116 - Build command: npm ci --ignore-scripts && npm run build
117 - Env vars configured: SAC_MCP_PATH, SAC_MCP_COMMIT, SAC_BASE_URL, SAC_TOKEN_URL, SAC_CLIENT_ID, SAC_CLIENT_SECRET
118 ```
119
120This prevents re-prompting in future sessions.
121
122## What's New in Q2 2026 (2026.8)
123
124Key scripting enhancements in the latest SAC release:
125- **Enhanced `onAfterExecute` Event** - Upload events now include message, statistics, rejected records, target version, and filename
126- **Data Export API Job Monitoring** - New job monitor tab for delta extraction and calculation jobs
127- **Data Import Service API** - Import master data to public dimensions in SAP Datasphere; import external fact data to private versions
128- **Multi-Action API Step** - HTTP 204 response now allowed; enhanced header field restrictions
129- **Export to S/4HANA Deprecated** - Use write-back integration scenario instead
130- **Asymmetric Reporting** - Differing time ranges, hierarchies, and measures per row/column
131- **Composite Versioning** - Manage multiple composite versions during story design
132
133See `references/whats-new-qrc2-2026.md` for complete details.
134
135## Environment Detection
136
137Before writing or analyzing any script, identify which SAC environment the user is working in.
138
139**Detection signals:**
140
141| Signal | Environment |
142|--------|-------------|
143| Mentions `.story`, "Optimized Story", OSE, `Story.`, `Application.getActivePage()` | **OSE** |
144| Mentions Analytics Designer, `AnalyticApplication`, `Designer`, `.application` | **Analytics Designer** |
145| Says "SAC script" / "my script" without further context | **Unclear** |
146
147**When environment is unclear**, ask ONE concise question before proceeding:
148
149> "Are you scripting in **Analytics Designer** or **Optimized Story Experience**? This determines which API reference I use."
150
151Do not ask again after the user answers.
152
153**After confirmation**, use the correct references:
154- **OSE** → `references/ose-api-*.md` (8 files, Q2 2026, v2025.20)
155- **Analytics Designer** → `references/api-*.md` (existing files)
156
157## Reporting Story Workflow
158
159Use this workflow for read-only SAC stories, dashboards, and management reports. It is separate from planning: route writeback, version publishing, data actions, allocations, data locking, and other planning operations to `sap-sac-planning`.
160
1611. **Establish the contract**: identify the tenant, story, data source, intended audience, and whether the user forbids model changes. Treat a reporting-only request as story-layer work unless the user explicitly authorizes a broader scope.
1622. **Inspect actual metadata**: confirm the selected model and use only its exposed dimensions, measures, hierarchies, time fields, currencies, and comparison categories. Never invent a field because it would be useful for a proposed chart or KPI.
1633. **Design at the story layer**: define pages, widgets, filters, selections, navigation, and supported story calculations. Label comparisons explicitly as actual-versus-budget, forecast, or another available category.
1644. **Implement safely**: before saving, verify that the current SAC area is Story Designer rather than Modeler. Keep common filters and dependent-widget interactions read-only and non-destructive.
1655. **Verify or hand off**: validate page and widget readiness with `sap-sac-test-automation`. If authenticated tenant control is unavailable, follow `sap-browser-automation` and the local `references/edge-cdp-control.md` recovery path. If access still fails, do not claim that the story was created; provide the complete story specification for manual execution or a later connected session.
166
167### Read-Only Story Contract
168
169When the model must not change, the following are allowed:
170
171- create or edit story pages, charts, tables, KPI cards, filters, navigation, and story-layer calculations supported by SAC;
172- rename story objects and save the story;
173- inspect model metadata and perform read-only validation.
174
175The following are forbidden without explicit scope and approval:
176
177- editing model dimensions, measures, properties, connections, calendars, allocations, or settings;
178- creating model-level calculated measures or changing master data, roles, or permissions;
179- publishing planning versions, executing data actions, changing locks, or writing back planning data.
180
181If a required field or measure is not exposed by the model, omit the dependent widget and record the omission. Do not change the model to make the design fit.
182
183### Implementation-Ready Handoff
184
185When tenant interaction is blocked, return a usable specification containing:
186
187- story purpose, audience, data source, and confirmed model metadata;
188- page-by-page widgets using only resolved fields;
189- filters, comparison semantics, selections, and drilldowns;
190- omitted widgets or unresolved fields with the reason for each;
191- read-only safety constraints and the verification evidence still required.
192
193## Large Reference Search Routing
194
195Search large OSE API references with `rg` before opening them. Use patterns such as `rg -n "class Chart|interface DataSource|enum Feed|setDimensionFilter|getPlanning|PlanningModel" references/ose-api-*.md`, then read only the matching section.
196
197- Use `references/ose-api-datasource.md` for DataSource, DataAction, DataBinding, DataLocking, DataChangeInsights, and result-set methods.
198- Use `references/ose-api-chart-viz.md` for Chart, Table, GeoMap, RVisualization, ValueDriverTree, feeds, and visualization APIs.
199- Use `references/ose-api-planning-calendar.md` for Planning, PlanningModel, versions, calendars, data actions, and planning workflows.
200- Use `references/ose-api-application-core.md` for Application, PageBook, Panel, Popup, Widget, and lifecycle or container APIs.
201- Use `references/ose-api-types-enums.md` for enum/type lookup when a method signature mentions `Feed`, `Layout`, `NumberFormat`, `VariableValue`, or other SAC-specific types.
202- Use smaller `references/api-*.md` files first for Analytics Designer unless the user explicitly says Optimized Story Experience.
203
204## Quick Start
205
206### Script Editor Access
207- **Analytics Designer**: Edit mode → Select widget → Scripts tab
208- **Optimized Story Experience**: Advanced Mode → Select widget → Add script
209
210### Basic Script Structure
211```javascript
212// Event handler example (onSelect on Chart_1)
213var selections = Chart_1.getSelections();
214if (selections.length > 0) {
215 var selectedValue = selections[0]["Location"];
216 Table_1.getDataSource().setDimensionFilter("Location", selectedValue);
217}
218```
219
220## Core APIs
221
222### DataSource API
223Access via `Widget.getDataSource()`. Key methods:
224- `getMembers(dim, {accessMode: MemberAccessMode.BookedValues})` - Get dimension members efficiently
225- `getResultSet()` - Cached data access (preferred over getData())
226- `setDimensionFilter(dim, value)` - Apply filters
227- `setRefreshPaused(true/false)` - Batch multiple operations
228
229### Planning API
230Access via `Table.getPlanning()`. Key operations:
231- `getPublicVersion()` / `getPrivateVersion()` - Version access
232- `publish()` - Submit private to public
233- `copyFromPublicVersion()` / `copyToPublicVersion()` - Data copy
234- `setLock(true/false)` - Data locking
235
236### Widget APIs
237- **Charts**: `addMeasure()`, `addDimension()`, `getSelections()`
238- **Tables**: `addDimensionToRows()`, `setZeroSuppressionEnabled()`
239- **Containers**: Panel, TabStrip, PageBook for layout
240
241### Application Object
242Global utilities:
243- `Application.showBusyIndicator()` / `hideBusyIndicator()`
244- `Application.showMessage(type, text)`
245- `Application.getUserInfo()` / `getInfo()`
246
247## Performance Best Practices
248
2491. **Minimize Backend Calls**
250 ```javascript
251 // Use getResultSet() (cached) instead of getMembers() (backend)
252 var data = ds.getResultSet();
253 ```
254
2552. **Batch Filter Operations**
256 ```javascript
257 ds.setRefreshPaused(true);
258 ds.setDimensionFilter("Dim1", value1);
259 ds.setDimensionFilter("Dim2", value2);
260 ds.setRefreshPaused(false); // Single refresh
261 ```
262
2633. **Keep onInitialization Empty**
264 Defer heavy operations to lazy loading or first interaction.
265
2664. **Use BookedValues for Members**
267 ```javascript
268 var members = ds.getMembers("Dim", {accessMode: MemberAccessMode.BookedValues});
269 ```
270
271## Debugging
272
273### Console Logging
274```javascript
275console.log("Debug:", myVariable);
276console.log("Selections:", JSON.stringify(Chart_1.getSelections()));
277```
278
279### Browser DevTools
2801. Press F12 → Console tab
2812. Filter by "Info" type
2823. Add `?APP_PERFORMANCE_LOGGING=true` to URL for timing
283
284## Bundled Resources
285
286**Reference Files** (66 files):
287- Core APIs: `references/api-datasource.md`, `references/api-widgets.md`, `references/api-planning.md`
288- Advanced: `references/api-calendar-bookmarks.md`, `references/api-advanced-widgets.md`
289- Best Practices: `references/best-practices-developer.md`, `references/best-practices-planning-stories.md`
290- Language: `references/scripting-language-fundamentals.md`
291- Q2 2026-relevant API updates: `references/whats-new-qrc2-2026.md`, `references/whats-new-2025.23.md`, `references/chart-variance-apis.md`
292- Browser runtime triage: `references/edge-cdp-control.md` for SAC-specific boundaries; use shared `sap-browser-automation` for authentication, Edge/CDP setup, `DevToolsActivePort`, target selection, and recovery
293- **OSE API (Q2 2026, v2025.20)** — complete method/parameter/return documentation:
294 - `references/ose-api-application-core.md` — Application, PageBook, Panel, Popup, Widget (15 classes)
295 - `references/ose-api-widgets.md` — Button, Dropdown, InputField, Slider, Switch, Text, TextArea (15 classes)
296 - `references/ose-api-datasource.md` — DataSource, DataAction, DataBinding, DataLocking, DataChangeInsights (39 classes)
297 - `references/ose-api-chart-viz.md` — Chart, Table, GeoMap, RVisualization, ValueDriverTree (20 classes)
298 - `references/ose-api-planning-calendar.md` — Planning, PlanningModel, all Calendar classes (54 classes)
299 - `references/ose-api-filtering-selection.md` — FilterLine, FilterValue, Selection (11 classes)
300 - `references/ose-api-utilities.md` — BookmarkSet, MemberInfo, DimensionInfo, Timer, NavigationUtils (37 classes)
301 - `references/ose-api-types-enums.md` — All enum types: Feed, Layout, NumberFormat, VariableValue (70 classes)
302
303**Templates** (56 patterns):
304- `templates/common-patterns.js` - 40 general scripting patterns
305- `templates/planning-operations.js` - 16 planning-specific patterns
306
307## Official Documentation
308
309- **Analytics Designer API**: https://help.sap.com/doc/958d4c11261f42e992e8d01a4c0dde25/release/en-US/
310- **Optimized Story Experience API**: https://help.sap.com/doc/1639cb9ccaa54b2592224df577abe822/release/en-US/
311- **SAC Documentation**: https://help.sap.com/docs/SAP_ANALYTICS_CLOUD
312- **What's New Q4 2025**: https://help.sap.com/docs/SAP_ANALYTICS_CLOUD/00f68c2e08b941f081002fd3691d86a7/c96a267c5da04fff90bb55313ee9f77c.html
313
314---
315
316**SAC Version**: Q2 2026 (2026.8) | **API Version**: 2025.20 (OSE Q2 2026)