abap-cds-model-check
Optional intended usage such as analytical, transactional, reuse, value-help, or extraction
Template type: filter, planning, export, navigation, chart, table, dropdown, popup, timer, bookmark
$ npx -y skills add secondsky/sap-skills --agent claude-codeHow it fires
How this command gets triggered: by you, by Claude, or both.
/sac-script-templateContext preview
What this command does when you run it.
Template type: filter, planning, export, navigation, chart, table, dropdown, popup, timer, bookmark
name: sac-script-template
description: Generate SAC script templates for common Analytics Designer and Optimized Story Experience scenarios
allowed-tools:
- Read
argument-hint: "<filter|planning|export|navigation|chart|table|dropdown|popup|timer|bookmark>"
arguments:
- name: type
description: "Template type: filter, planning, export, navigation, chart, table, dropdown, popup, timer, bookmark"
required: trueReturn a script template, required widget/model assumptions, API references, and validation notes. Default to generating text only unless the user explicitly asks to write files and confirms the target path.
Generate a SAC script template based on the requested type.
Cross-widget filtering pattern with selection handling and data source synchronization.
Planning operations template including version management, publish, and copy operations.
PDF and PowerPoint export functionality with custom settings.
Story-to-story navigation with URL parameters.
Chart manipulation including measure/dimension changes and selection handling.
Table configuration with rows, columns, totals, and zero suppression.
Dropdown/Input Control handling with selection events.
Popup management with open/close and data passing.
Timer-based auto-refresh and scheduled operations.
Bookmark creation, application, and management.
---
/*
* Cross-Widget Filter Pattern
* Purpose: Apply selection from source widget to target widget
* Trigger: onSelect event on source Chart/Table
*/
// Get selections from the source widget
var selections = Chart_Source.getSelections();
if (selections.length > 0) {
// Extract the dimension value from selection
var selectedValue = selections[0]["Location"]; // Adjust dimension name
// Get target data source
var targetDS = Table_Target.getDataSource();
// Apply filter
targetDS.setDimensionFilter("Location", selectedValue);
// For multiple values
// var values = selections.map(function(sel) { return sel["Location"]; });
// targetDS.setDimensionFilter("Location", values);
}---
/*
* Planning Version Management Pattern
* Purpose: Publish private version to public
* Trigger: onClick event on Publish button
*/
var planning = Table_Planning.getPlanning();
Application.showBusyIndicator("Publishing data...");
try {
// Check for private version
var privateVersion = planning.getPrivateVersion();
if (privateVersion !== null) {
// Publish to public version
planning.publish();
Application.showMessage(
ApplicationMessageType.Success,
"Data published successfully"
);
// Refresh the view
Table_Planning.getDataSource().refreshData();
} else {
Application.showMessage(
ApplicationMessageType.Warning,
"No private version to publish"
);
}
} catch (e) {
Application.showMessage(
ApplicationMessageType.Error,
"Publish failed: " + e.message
);
} finally {
Application.hideBusyIndicator();
}---
/*
* PDF Export Pattern
* Purpose: Export current view to PDF
* Trigger: onClick event on Export button
*/
// Configure export settings
var exportSettings = {
fileName: "Report_" + new Date().toISOString().split('T')[0],
paperSize: PaperSize.A4,
orientation: Orientation.Landscape,
includeFilters: true,
fitToPage: true
};
// Execute PDF export
Application.exportToPDF(exportSettings);
// For PowerPoint export
// var pptSettings = {
// fileName: "Presentation",
// includeInputControls: false
// };
// Application.exportToPPT(pptSettings);---
/*
* Story Navigation Pattern
* Purpose: Navigate to another story with parameters
* Trigger: onClick event on Navigation button
*/
// Create URL parameters
var urlParameters = ArrayUtils.create(Type.UrlParameter);
urlParameters.push(UrlParameter.create("page", "dashboard"));
urlParameters.push(UrlParameter.create("filter", Dropdown_1.getSelectedKey()));
// Navigate to target story
// Replace STORY_ID with actual story ID from URL
NavigationUtils.openStory(
"STORY_ID_HERE", // Target story ID
"", // Empty for same folder
urlParameters, // Parameters to pass
false // false = same tab, true = new tab
);---
/*
* Chart Manipulation Pattern
* Purpose: Dynamically modify chart configuration
* Trigger: onChange event on control or onClick on button
*/
// Add/Remove measures
Chart_1.addMeasure("Revenue", Feed.ValueAxis);
Chart_1.removeMeasure("Cost");
// Add/Remove dimensions
Chart_1.addDimension("Region", Feed.CategoryAxis);
Chart_1.removeDimension("Product");
// Get current selections
var selections = Chart_1.getSelections();
console.log("Selected:", JSON.stringify(selections));
// Handle selection in onSelect
if (selections.length > 0) {
var selectedDimValue = selections[0]["Region"];
// Do something with selection
}---
/*
* Table Configuration Pattern
* Purpose: Configure table display properties
* Trigger: onInitialization or button click
*/
// Configure dimensions and measures
Table_1.addDimensionToRows("Location");
Table_1.addDimensionToRows("Product");
Table_1.addMeasure("Revenue");
Table_1.addMeasure("Quantity");
// Display settings
Table_1.setTotalsVisible(true);
Table40 SAP development plugins with evidence-tracked verification SAP development plugins for AI coding assistants, with public-source or package-registry verification tracked where available.
Repo: secondsky/sap-skills
Optional intended usage such as analytical, transactional, reuse, value-help, or extraction
Optional target ABAP platform or SAP BTP ABAP Environment release
Optional runtime or scenario name, such as orchestration, serving, training, or batch
Optional scenario lens such as extension, integration, analytics, or AI