Sap Sac Scripting
by secondsky
|
Skill Details
Repository Files
61 files in this skill directory
name: sap-sac-scripting description: | 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", or works with SAC widgets, planning models, or analytics applications. license: GPL-3.0 metadata: version: 3.0.0 last_verified: 2025-12-27 sac_version: "Q4 2025 (2025.21)" api_reference_version: "2025.19" documentation_source: https://help.sap.com/docs/SAP_ANALYTICS_CLOUD reference_files: 55 template_patterns: 56 agents: 4 commands: 4 status: production
SAP Analytics Cloud Scripting
Comprehensive skill for scripting in SAP Analytics Cloud (SAC) Analytics Designer and Optimized Story Experience.
Plugin Components
This plugin provides specialized tools for SAC development:
Agents (use via Task tool):
sac-script-debugger- Debug script errors, trace issuessac-performance-optimizer- Analyze and fix performance bottleneckssac-planning-assistant- Guide planning operations and version managementsac-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
What's New in Q4 2025 (2025.21)
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-q4-2025.md for complete details.
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 efficientlygetResultSet()- Cached data access (preferred over getData())setDimensionFilter(dim, value)- Apply filterssetRefreshPaused(true/false)- Batch multiple operations
Planning API
Access via Table.getPlanning(). Key operations:
getPublicVersion()/getPrivateVersion()- Version accesspublish()- Submit private to publiccopyFromPublicVersion()/copyToPublicVersion()- Data copysetLock(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=trueto URL for timing
Bundled Resources
Reference Files (55 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 - Q4 2025:
references/whats-new-q4-2025.md,references/chart-variance-apis.md
Templates (56 patterns):
templates/common-patterns.js- 40 general scripting patternstemplates/planning-operations.js- 16 planning-specific patterns
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.0 | Last Verified: 2025-12-27 | SAC Version: Q4 2025 (2025.21) | API Version: 2025.19
Related Skills
Attack Tree Construction
Build comprehensive attack trees to visualize threat paths. Use when mapping attack scenarios, identifying defense gaps, or communicating security risks to stakeholders.
Grafana Dashboards
Create and manage production Grafana dashboards for real-time visualization of system and application metrics. Use when building monitoring dashboards, visualizing metrics, or creating operational observability interfaces.
Matplotlib
Foundational plotting library. Create line plots, scatter, bar, histograms, heatmaps, 3D, subplots, export PNG/PDF/SVG, for scientific visualization and publication figures.
Scientific Visualization
Create publication figures with matplotlib/seaborn/plotly. Multi-panel layouts, error bars, significance markers, colorblind-safe, export PDF/EPS/TIFF, for journal-ready scientific plots.
Seaborn
Statistical visualization. Scatter, box, violin, heatmaps, pair plots, regression, correlation matrices, KDE, faceted plots, for exploratory analysis and publication figures.
Shap
Model interpretability and explainability using SHAP (SHapley Additive exPlanations). Use this skill when explaining machine learning model predictions, computing feature importance, generating SHAP plots (waterfall, beeswarm, bar, scatter, force, heatmap), debugging models, analyzing model bias or fairness, comparing models, or implementing explainable AI. Works with tree-based models (XGBoost, LightGBM, Random Forest), deep learning (TensorFlow, PyTorch), linear models, and any black-box model
Pydeseq2
Differential gene expression analysis (Python DESeq2). Identify DE genes from bulk RNA-seq counts, Wald tests, FDR correction, volcano/MA plots, for RNA-seq analysis.
Query Writing
For writing and executing SQL queries - from simple single-table queries to complex multi-table JOINs and aggregations
Pydeseq2
Differential gene expression analysis (Python DESeq2). Identify DE genes from bulk RNA-seq counts, Wald tests, FDR correction, volcano/MA plots, for RNA-seq analysis.
Scientific Visualization
Meta-skill for publication-ready figures. Use when creating journal submission figures requiring multi-panel layouts, significance annotations, error bars, colorblind-safe palettes, and specific journal formatting (Nature, Science, Cell). Orchestrates matplotlib/seaborn/plotly with publication styles. For quick exploration use seaborn or plotly directly.
