Using the publish API for Private Planning Versions

You can use the publish API (script function) to publish a private planning version.

Before you start
Before you use the publish API make sure you have checked the following:
  • You have created an application that contains a table and planning model for SAP Analytics Cloud.

  • You have assigned the planning model to the table.

  • You've made up your mind on how you want to visualize or expose the publish API to the application user (for example, you want the application user to use a button in order to publish a version).

You can call this script function in two different ways:
  1. No input parameters are given (the original version is overwritten):

    In this case you can use the following scripting code:
    Sample Code
    // override the original version from which myActual was created
    
    var myActualVersion = Table_1.getPlanning().getPrivateVersion("myActual");
    
    if (myActualVersion) {
    
        myActualVersion.publish();
    
    };
    
  2. The target version is specified. In this case you can specify if you want to update the entire version or only those parts of the version that have been changed. You can use the following scripting code:
    Sample Code
    // override the forecast version with myActual and update only changed data
    
    var myActualVersion = Table_1.getPlanning().getPrivateVersion("myActual");
    
    var forecastVersion = Table_1.getPlanning().getPublicVersion("Forecast");
    
    if (myActualVersion && forecastVersion) {
    
        myActualVersion.publish(forecastVersion, true);
    
    };