Useful SAP Analytics Designer Scripts used in Input Form to develop SAC Planning Application
2023-12-4 09:45:49 Author: blogs.sap.com(查看原文) 阅读量:9 收藏

In this blog I am going to describe some useful useful SAP Analytics Designer Scripts to develop SAC Planning Applications. What we did for planning using a story that can be achieved using scripting.  the layout is very lucrative in Analytics Applications in side Input Form

Using this script and combining them you can build impressive planning applications which is useful to business and change the game of an organization.

1. Script  for Get the Data of a Version data :

var forecastVersion = Table_1.getPlanning().getPublicVersion("Forcast2024");

2. Script  to publish a created version  :

var forecastVersion = Table_1.getPlanning().getPublicVersion("Forcast2024");

if (forecastVersion) {
    if(forecastVersion.isDirty()) {
       forecastVersion.publish();
    };
};

Here isDirty() function is used to check.

3. Script to Copy and create a private version from another public version –

// Getting the existing version.
var budgetVersion = Table_2.getPlanning().getPublicVersion("budgetversion2024");

//Copy Operation  -
if (budgetVersion) {
    budgetVersion.copy("LatestBudget"+ Date.now().toString(), PlanningCopyOption.PlanningArea));
}

4. Copies all data from a private version and  create a private Version of Budget Category  using below script :

// Getting the existing version.
 var sourceVersion = Table_3.getPlanning().getPrivateVersion("privateSourceVersion");
//Copy Operation  -
if (sourceVersion) {
    sourceVersion.copy("targetVersion", PlanningCopyOption.AllData, PlanningCategory.Budget)
};

5. Copies all data from a private version and  create a private Version of Forecast Category  using below script.

var sourceVersion = Table_5.getPlanning().getPrivateVersion("privateVersionToCopy");
if (sourceVersion) {
    sourceVersion.copy("Version"+ Date.now().toString(), PlanningCopyOption.PlanningArea, PlanningCategory.Forecast));
}

6.  Script to switch between tables and charts :

Chart.setVisible(true); 
Table.setVisible(false); 
Switch_to_Table_display.setVisible(true); 
Switch_to_Chart_display.setVisible(false); 

7. Data lock of a cell using script :

var selection = Table_1.getSelections()[0];
 

//get the state of the selection
var selectionLockState =  Table_1.getPlanning().getDataLocking().getState(selection);

While developing the Analytical Planning Application  please use the below SAP link for reference –

https://help.sap.com/docs/SAP_ANALYTICS_CLOUD/00f68c2e08b941f081002fd3691d86a7/5f78d999c9da4f75b903271683f0793b.html

Hope it will help.


文章来源: https://blogs.sap.com/2023/12/04/useful-sap-analytics-designer-scripts-used-in-input-form-to-develop-sac-planning-application/
如有侵权请联系:admin#unsafe.sh