Sap-skills sap-sac-scripting
git clone https://github.com/secondsky/sap-skills
T=$(mktemp -d) && git clone --depth=1 https://github.com/secondsky/sap-skills "$T" && mkdir -p ~/.claude/skills && cp -r "$T/plugins/sap-sac-scripting/skills/sap-sac-scripting" ~/.claude/skills/secondsky-sap-skills-sap-sac-scripting && rm -rf "$T"
plugins/sap-sac-scripting/skills/sap-sac-scripting/SKILL.mdSAP Analytics Cloud Scripting
Comprehensive skill for scripting in SAP Analytics Cloud (SAC) Analytics Designer and Optimized Story Experience.
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.14)
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):
- Debug script errors, trace issuessac-script-debugger
- Analyze and fix performance bottleneckssac-performance-optimizer
- Guide planning operations and version managementsac-planning-assistant
- Find correct APIs and provide code examplessac-api-helper
Commands (use via /command):
- Generate script templates (filter, planning, export, etc.)/sac-script-template
- Interactive debugging guidance/sac-debug
- Performance analysis and recommendations/sac-optimize
- Planning operation templates/sac-planning
Hooks:
- Automatic validation on SAC script writes for common issues
MCP Setup
This plugin ships with a
.mcp.json that connects to the community 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).
Before using MCP tools, check if the server is already installed:
- Look for
in the project.claude/sac-mcp.local.md - Or check if
is set in the environmentSAC_MCP_PATH
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 && npm install && npm run build -
Configure environment variables:
— absolute path to the cloned repo (e.g.SAC_MCP_PATH
)/home/user/sap_analytics_cloud_mcp
— SAC tenant root URL (e.g.SAC_BASE_URL
)https://mytenant.eu10.hanacloudservices.cloud.sap
— OAuth token endpointSAC_TOKEN_URL
/SAC_CLIENT_ID
— from SAC OAuth client configurationSAC_CLIENT_SECRET
-
After successful install, write
(gitignored) with:.claude/sac-mcp.local.md# SAC MCP Installation Record - Installed: [date] - Path: [absolute path to build/index.js] - Env vars configured: SAC_MCP_PATH, SAC_BASE_URL, SAC_TOKEN_URL, SAC_CLIENT_ID, SAC_CLIENT_SECRET
This prevents re-prompting in future sessions.
What's New in Q1 2026 (2026.2)
Key scripting enhancements in the latest SAC release:
- Chart Variance APIs - Script control over chart variance display
- Compass for Seamless Planning - Enhanced planning integration
- Data Actions Enhancements - Automatic dimension mapping, input control binding
- Time Series Forecast API - Programmatic forecasting control
- Comments APIs - Widget and cell comment management
See
references/whats-new-q1-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 , "Optimized Story", OSE, , | OSE |
Mentions Analytics Designer, , , | 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 →
(8 files, Q1 2026, v2025.14)references/ose-api-*.md - Analytics Designer →
(existing files)references/api-*.md
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:
- Get dimension members efficientlygetMembers(dim, {accessMode: MemberAccessMode.BookedValues})
- Cached data access (preferred over getData())getResultSet()
- Apply filterssetDimensionFilter(dim, value)
- Batch multiple operationssetRefreshPaused(true/false)
Planning API
Access via
Table.getPlanning(). Key operations:
/getPublicVersion()
- Version accessgetPrivateVersion()
- Submit private to publicpublish()
/copyFromPublicVersion()
- Data copycopyToPublicVersion()
- Data lockingsetLock(true/false)
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
to URL for timing?APP_PERFORMANCE_LOGGING=true
Bundled Resources
Reference Files (63 files):
- Core APIs:
,references/api-datasource.md
,references/api-widgets.mdreferences/api-planning.md - Advanced:
,references/api-calendar-bookmarks.mdreferences/api-advanced-widgets.md - Best Practices:
,references/best-practices-developer.mdreferences/best-practices-planning-stories.md - Language:
references/scripting-language-fundamentals.md - Q1 2026:
,references/whats-new-q1-2026.mdreferences/chart-variance-apis.md - OSE API (Q1 2026, v2025.14) — complete method/parameter/return documentation:
— Application, PageBook, Panel, Popup, Widget (15 classes)references/ose-api-application-core.md
— Button, Dropdown, InputField, Slider, Switch, Text, TextArea (15 classes)references/ose-api-widgets.md
— DataSource, DataAction, DataBinding, DataLocking, DataChangeInsights (39 classes)references/ose-api-datasource.md
— Chart, Table, GeoMap, RVisualization, ValueDriverTree (20 classes)references/ose-api-chart-viz.md
— Planning, PlanningModel, all Calendar classes (54 classes)references/ose-api-planning-calendar.md
— FilterLine, FilterValue, Selection (11 classes)references/ose-api-filtering-selection.md
— BookmarkSet, MemberInfo, DimensionInfo, Timer, NavigationUtils (37 classes)references/ose-api-utilities.md
— All enum types: Feed, Layout, NumberFormat, VariableValue (70 classes)references/ose-api-types-enums.md
Templates (56 patterns):
- 40 general scripting patternstemplates/common-patterns.js
- 16 planning-specific patternstemplates/planning-operations.js
Official Documentation
- Analytics Designer API: https://help.sap.com/doc/958d4c11261f42e992e8d01a4c0dde25/release/en-US/
- Optimized Story Experience API: https://help.sap.com/doc/1639cb9ccaa54b2592224df577abe822/release/en-US/
- SAC Documentation: https://help.sap.com/docs/SAP_ANALYTICS_CLOUD
- What's New Q4 2025: https://help.sap.com/docs/SAP_ANALYTICS_CLOUD/00f68c2e08b941f081002fd3691d86a7/c96a267c5da04fff90bb55313ee9f77c.html
Version: 3.0.1 | Last Verified: 2026-03-07 | SAC Version: Q1 2026 (2026.2) | API Version: 2025.14