Skip to Content
Technical Articles

Custom Planning Application with Approval Process (SAP Analytics Cloud, Analytic Application)

Hello Fellow Community Members,

Recently we had a new requirement from one our business users to add approval and Reject button in the planning application. It was quite interesting to work and i thought will share it with the community

Business Case :

City Sales office will propose the Forecast for the month.

This will be verified and approved/Rejected by the Country Level Leads.

Approved will make the Forecast value as final.

Reject with Alternate value and comment facility is needed.

And user should not be allowed to create private version.

Solution :

We split the application into two parts “City Sales Office” and “Country Leads”. Later then restricted the access by sharing them with the respective teams. Also since the private versions should not be created, we opted for Analytic Application and the embed mode.

We had two version “Forecast Proposed” and “Forecast Approved”.

City Sales Office Application :

We used Analytical Application to create the below application with Propose approval to publish the values and Revert to cancel the changes. Using Data Access we restricted access to only read Forecast Approved and Forecast Proposed both read and write.

//Propose Forecast button select
Table_1.getPlanning().getPublicVersion("Forecast_Proposed").publish();
if(Table_1.getPlanning().getPublicVersion("Forecast_Proposed").isDirty())
	{
		Table_1.getPlanning().getPublicVersion("Forecast_Proposed").publish();
	}
else
        {
                Popup_message.Open();//message : No value entered
                Timer_close.start(3);//Clone popup
        }
//Revert button select
if(Table_1.getPlanning().getPublicVersion("Forecast_Proposed").isDirty())
	{
		Table_1.getPlanning().getPublicVersion("Forecast_Proposed").publish();
	}
else
        {
                Popup_message.Open();//message : No value entered
                Timer_close.start(3);//Clone popup
        }

 

So now that the Forecast is Proposed the Country Leads will be approving the request.

Country Leads Application :

Now the Country Leads can either Approve or reject it with a different forecast.

In order to do that they have to select the value in the table and click Approve or Reject.

//Table On select
V_Selection=Table_1.getSelections();
//On Click Approve Button
if(V_Selection.Length)
{
var date=Table_1.getDataSource().getResultMember("Order_Date",V_Selection[0]).id;
var version=Table_1.getDataSource().getResultMember("Version",{"Version":"public.Forecast_Approved"}).id;
var measure=Table_1.getDataSource().getResultMember("Account",V_Selection[0]).id;
var state=Table_1.getDataSource().getResultMember("State",V_Selection[0]).id;
var value=Table_1.getDataSource().getData(V_Selection[0]);
Table_1.getPlanning().setUserInput({"Order_Date":date,"Version":version,"@MeasureDimension":measure,"State":state},value.rawValue);
Table_1.getPlanning().submitData();
Table_1.getPlanning().getPublicVersion("Forecast_Approved").publish();
}
else
{
Popup_message1.Open();//message : No value selected
Timer_close1.start(3);//Clone popup
}
//On Click Reject Button
if(V_Selection.Length)
{
var date=Table_1.getDataSource().getResultMember("Order_Date",V_Selection[0]).id;
var version=Table_1.getDataSource().getResultMember("Version",{"Version":"public.Forecast_Approved"}).id;
var measure=Table_1.getDataSource().getResultMember("Account",V_Selection[0]).id;
var state=Table_1.getDataSource().getResultMember("State",V_Selection[0]).id;
var value=InputField_1.getValue();
Table_1.getPlanning().setUserInput({"Order_Date":date,"Version":version,"@MeasureDimension":measure,"State":state},value);
Table_1.getPlanning().setUserInput({"Order_Date":date,"Version":"public.Forecast_Proposed","@MeasureDimension":measure,"State":state},value);
Table_1.getPlanning().submitData();
Table_1.getPlanning().getPublicVersion("Forecast_Approved").publish();
Table_1.getPlanning().getPublicVersion("Forecast_Proposed").publish();
}
else
{
Popup_message1.Open();//message : No value selected
Timer_close1.start(3);//Clone popup
}

We used embed mode to embed the application in another web-page which the project uses for Planning hence eliminating the creation of Private versions.

Hope this is useful.. We have Another requirement to display top 10 comments sorted by time and sorted by likes, hoping to complete it soon and sharing the story.. Good Day everyone..

-Sathya

Be the first to leave a comment
You must be Logged on to comment or reply to a post.