Skip to Content
Technical Articles
Author's profile photo Viktor Seide

SAC – Creation of planning version from admin cockpit

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%20of%20initial%20application

Creation of initial application

 

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

Versions%20before%20button

Versions before button

 

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

New%20button

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%20of%20popup

Creation of popup

 

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

Open%20popup%20on%20click

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%20not%20show%20table%20at%20view%20time

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%20version%20text

Enter version text

 

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

Sucess%20messages

Sucess messages

 

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

Newly%20created%20version

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%20messages%20if%20version%20exists

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.

Assigned Tags

      5 Comments
      You must be Logged on to comment or reply to a post.
      Author's profile photo Nikhil Anand
      Nikhil Anand

      Viktor Seide

      Thanks for the informative blog. Version.copy API has been of some relief in setting up some way of centralized version management. But as the API is limited to copy to a new version, it sets up a lot of limitations in practical project. There are no API's to manage attributes of version like start date , end date etc which are very common use cases. Additionally SAC design of having version as a private dimension in each model creates more hurdles as one has to create versions in each model if the projects involves a multi model setup which is again very common use case. Hopefully SAP will provide some more API's w.r.t Version dimension and also  let version be central dimension rather than private to each model.

      Nikhil

      Author's profile photo Luigi Simoncini
      Luigi Simoncini

      Great blog post from Viktor and great comment from Nikhil!
      So far I've used dimension comments instead of a property to document the version's purpose in a story similar to the above "administration cockpit", still that's just a very limited workaround.

       

      Author's profile photo Jef Baeyens
      Jef Baeyens

      Nikhil Anand Totally right.
      It's a struggle for years already... please vote here: https://influence.sap.com/sap/ino/#/idea/278037

      For now, I use a public Generic dimension called 'PlanVersion' to let end users centrally create versions and maintain attributes. Then I use the Version.copy() API to create local versions with same name in each model needed..

       

      Author's profile photo Nikhil Anand
      Nikhil Anand

      Jef Baeyens

      Already Voted. It just has 28 votes ( for long term consideration), not sure how consultants are managing true essence of xP&A with version dimension limitations. At least a common interface for version management for all planning model is need of the hour, something like currency table. I am hoping SAP will give some relief.

      Nikhil

      Author's profile photo Vahan Nersesyan
      Vahan Nersesyan

      Great blog from Viktor as always!