In Sap Analytics Cloud, while we enter any data in table, so we have to publish data it also to Model, in normal canvas story its easy to do, but in Analytical Application if we want to publish data with Button trigger so you are in right article, just follow the article.

Publish Fixed Version Data

Create a new button, in your analytical application from Insert > button,

1. Go to code editor of button by click on Edit Scripts > onClick

1.png

2. Write this mention code, replace version with your version member’s description, like Actual, Current , don’t use id (public.Actual) like that.

Table_1.getPlanning().getPublicVersion("Actual").publish();

3. Save it, and Run

 

Publish Data with Table Filter Automatically

For getting automatic version from table, when you apply filter, just use code mention below.

1. Create Planning Models from left sidebar, select your model

2. Create button, and add this code to your button onClick(), replace SCENARIO with your Version’s Dimensions name.

Application.showBusyIndicator();

var planning = PlanningModel_1.getMembers("SCENARIO");
var s_filter = Table_1.getDataSource().getDimensionFilters("SCENARIO");

for (var i = 0; i < s_filter.length; i++) {
	if (s_filter[i].type === FilterValueType.Single) {
		var scenarioValue = cast(Type.SingleFilterValue, s_filter[i]);
	}
}
var checkScenario = scenarioValue.value;

for (var j =0; j<planning.length;j++){
	if(planning[j].id === checkScenario){
	var scenario = planning[j].description;
	}
}

Table_1.getPlanning().getPublicVersion(scenario).publish();	
Application.hideBusyIndicator();

Conclusion

Sap Analytics Cloud, when you modify a table and need to publish it, there is a button Publish Data in the top bar. But sometimes you might need to publish data from an existing button that was created by a user. So you can use this method for publishing data from a button trigger.

Assigned Tags

Sara Sampaio

Sara Sampaio

Author Since: March 10, 2022

0 0 votes
Article Rating
Subscribe
Notify of
0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x