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
Before you use the publishAs 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 publishAs API to the application 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:
Sample Code
// publish private version myActual as public version with name "newBudget"

var myActualVersion = Table_1.getPlanning().getPrivateVersion("myActual");

if (myActualVersion) {

    myActualVersion.publishAs("newBudget", Category.Budget);

};