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: 
ViktorS
Explorer
2,359


Introduction


Throughout my experience working on my first SAP Analytics Cloud (SAC) Planning projects, a recurring theme caught my attention. While many standard functions are easy to navigate, creating new versions from stories or analytical applications proved to be less intuitive for many customers.

To create new versions, planning administrators have to go through a multi-step process involving copying an existing version to create a private version and then publishing it with the desired name and type. The process is further complicated by the necessity of having a story or analytical application with a table containing the relevant planning model. As I encountered this challenge repeatedly, I realized that there had to be a more straightforward solution.

In response, I decided to create this blog post, offering a step-by-step guide for everyone working on SAC planning projects and facing the same hurdle. The key lies in creating a simple administration story equipped with a button, empowering planning administrators to effortlessly generate new public versions.

 

Step-by-step guide


In the following example I will create the administration cockpit by using an analytical application. However, please note that with the new unified story we could also use a story with a canvas page, as both artifacts offer the necessary scripting capabilities.

Step 1:
Create a new analytical application and add a table with the respective model as the data source.


Creation of initial application


 

In my example, I am using a model with only one version:


Versions before button


 

Step 2:
Create a new button and give it a name.


New button


 

Step 3:
Create a new popup with an input field for the user to choose the new version name (don't forget to enable the footer and header in the builder panel).


Creation of popup


 

Step 4:
Create the code to open the popup when clicking on the button.


Open popup on click


 

Step 5:
Next create the script for the popup. Therefore, edit the script of the popup. Start by writing the script when clicking on the "OK"-button in your popup. First get the version "Actual" from your model by referencing the created table and save it as a local variable.
var BasisVersion = TB001.getPlanning().getPublicVersion("Actual");

 

Next, create a local variable for the value of the input field in your popup.
var NewName = InputField_1.getValue();

After, creating the necessary variables you can start with the creation of the new public version. Create a script for copying the actual version without any data as a new private version (other options are "AllData" or "PlanningArea").
BasisVersion.copy(NewName, PlanningCopyOption.NoData);

Finally, create the code to publish the new created private version as a public version. For simplicity I hard-coded the version type to "planning". However, it would be possible to add a dropdown for the user to choose the planning type if desired.
TB001.getPlanning().getPrivateVersion(NewName).publishAs(NewName, PlanningCategory.Planning);

Finally, you can add a busy indicator for the user to know that the SAC is working and some code to close the popup when clicking on "Cancel" or the creation has finished. A success message is not necessary, as the creation will produce a success message automatically. This will make you end up with the following code:
if (buttonId ==="button1")   {
Application.showBusyIndicator();
var BasisVersion = TB001.getPlanning().getPublicVersion("Actual");
var NewName = InputField_1.getValue();

//Create Version
BasisVersion.copy(NewName, PlanningCopyOption.NoData);
TB001.getPlanning().getPrivateVersion(NewName).publishAs(NewName, PlanningCategory.Planning);
Application.hideBusyIndicator();
this.close();
}

if (buttonId ==="button2") {
this.close();
}

 

Step 6:
Hide the table, so that users cannot see it. To do so, go to the styling panel of the table and uncheck the checkbox for "Show this item at view time".


Do not show table at view time


 

Testing the button


Finally you can test it and create a version using the button. Save your analytical application and run it. Click on the button, enter the desired name and click on "OK".


Enter version text


 

If the creation was successful, the following messages will appear:


Sucess messages


 

If you go back to your model, you will see that the new version has been created:


Newly created version


 

In case someone would now try to create a version with the same name, the user would get the following error message and no duplicate is created:


Error messages if version exists


 

Summary


As we observed in the previous example, incorporating a user-friendly button within an administration cockpit could be a game-changer for planning administrators when it comes to creating public versions. This simplified approach holds particular value for users who may not be well-versed in SAP Analytics Cloud, offering them an easy and accessible method for generating new public versions effortlessly.

My hope is that this blog post will serve as a valuable resource for fellow professionals currently engaged in SAP Analytics Cloud planning projects.
5 Comments
Labels in this area