Using the publish API for Public Planning Versions
You can use the publish API (script function) to publish public planning versions.
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).
-
If the user tries to publish a version that exceeds the resource limits and there are not enough resources available in the system for the publish operation, a correspondent message is displayed to the user.
Example
The following script shows how you can use the publish API to replace the Version Management option in the Tools section of the view time toolbar at runtime:Sample Code
// publish modified public version "Actual" => Toolbar Button Publish Data / VersionManagement
var actualVersion = Table_1.getPlanning().getPublicIf the public target version is unrelated to the private version and updateChangedDataOnly is false, then the private version overwrites the public target version. If the public target version is unrelated to the private version and updateChangedDataOnly is true, then only the changed data is published to the public target version. moVersion("Actual");
if (actualVersion) {
if(actualVersion.isDirty()) {
actualVersion.publish();
};
};
Example
The following script shows how you can use the publish API to replace the dialog Publish All in the Publish Data button of the view time toolbar at runtime:Sample Code
// publish all modified public versions => Toolbar Button Publish Data
var publicVersions = Table_1.getPlanning().getPublicVersions();
for (var j = 0; j < publicVersions.length; j++) {
if (publicVersions[j].isDirty()){
publicVersions[j].publish();
};
};