Using the publishAs Public Version API
You can use the publishAs API (script function) to publish a planning version as a public version.
Before you start
-
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 publishAs API to the application user.
-
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.
This API works with a string as input for the new version name. Optionally, you can specify a category. If no category is provided, the original category of the source version is used.
Example
The following script shows how you can use the publishAs API:
// publish private version myActual as public version with name "newBudget"
var myActualVersion = Table_1.getPlanning().getPrivateVersion("myActual");
if (myActualVersion) {
myActualVersion.publishAs("newBudget", Category.Budget);
};