Use Version Management APIs on SAP BPC Models

You can use the Version Management APIs for SAP BPC models in analytic applications and optimized stories.

In SAP Business Planning and Consolidation (SAP BPC), there's always a version (of type public version with ID "All Versions"), which you can't delete. Therefore, when working with SAP BPC models, 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:
Sample Code
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
var bpcVersion = Table_1.getPlanning().getPublicVersions()[0];
if (bpcVersion) {
    if(bpcVersion.isDirty()) {
        bpcVersion.revert();
    };
};