Technology Blogs by Members
Explore a vibrant mix of technical expertise, industry insights, and tech buzz in member blogs covering SAP products, technology, and events. Get in the mix!
cancel
Showing results for 
Search instead for 
Did you mean: 
pallab_haldar
Active Participant
2,415
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/5f78d999c9da4f75b9032...

Hope it will help.

 

 
1 Comment
Labels in this area