Using Version Management APIs on SAP BPC Models

You can use the Version Management APIs for SAP BPC Models.

For SAP Business Planning and Consolidation (SAP BPC), there is always exactly one version (of type public version with ID "All Versions"). You cannot delete this version. When working with SAP BPC models, therefore, you don't have to think about private-version APIs or the deleteVersion API.

To retrieve the SAP BPC version, you can use either the getPublicVersions()[0] or getPublicVersion("All Versions") API. Both API calls return the same version.

Example

This example shows how you can use the publish API to publish modified data on SAP BPC and replace the view time toolbar button Publish Data:
Sample Code
// publish modified data to BPC => replace Toolbar Button Publish Data

var bpcVersion = Table_1.getPlanning().getPublicVersion("All Versions");

if (bpcVersion) {

    if(bpcVersion.isDirty()) {

        bpcVersion.publish();

    };

};

Example

This example shows how you can use the revert API to revert a version.
Sample Code
// publish modified data to BPC => replace Toolbar Button Publish Data

var bpcVersion = Table_1.getPlanning().getPublicVersions()[0];

if (bpcVersion) {

    if(bpcVersion.isDirty()) {

        bpcVersion.revert();

    };

};