In the previous blog in this series, you learned about the cascading filters feature in Analytics Designer. In this blog, we will discuss how to develop a customized application for adding, updating, and deleting dimension members.
SAP Analytics Cloud offers a predominant feature called members on the fly to add dimension members without going to the model level. To add more customization, planning model APIs are introduced from the 2020.09 version. The analytic application developed using these APIs gives the business users more flexibility and allows them to delete/update dimension members in addition to adding members on the fly and dimension members get updated in the master data of the dimension in the model level automatically.
Let us assume you are going to introduce some new products to a few stores in your company. The new product need not be present in the master data of the source system for you to analyze the procured quantities, cost amount, etc. Using the following customized application, you can add,
update, or delete the product members and its properties on the fly, and this can be seen in action below.
Prerequisite – Planning model object
To access planning model APIs, you need to create a new planning model object in the ‘Planning Models’ section. Now select and map the model and use it further.
Planning model APIs
The APIs used to maintain dimension members are,
- createMembers() – To create dimension members on the fly.
- updateMembers()– You can update the dimension members properties and their description using this.
- deleteMembers()– To delete dimension members.
Note: Only unbooked members can be deleted.
The step by step process in building this planning application is discussed below.
1.Setting up canvas and widgets
As a first step, you need to add the necessary widgets to the canvas. Here the application has one table, a filter line, and three buttons representing the functionalities to maintain dimension members. The table has the ‘product’ dimension and its ‘colors’ property and ‘quantity’ procured. Also, create a script variable ‘Dimensionmember’ of type ‘PlanningModelMember’ to which the values of the properties of the dimension members are assigned and used as input parameters for createMembers API.
2.Adding pop-up and widgets
Add pop-ups and widgets required for maintaining master data. The pop-ups contain similar widgets like input fields, text areas, buttons, dropdowns, checkboxes, etc. for add, update, and delete members functionalities as shown below.
3. Adding dimension members
In the onClick event of ‘Adding members’ button, add the below script to open the pop-up and reset the input fields to blank.
Now add the below scripts to Popup_addmember –onButtonClick event. In the script, the ‘Dimensionmember’ variable has been initialized with input values to create product dimension members and then the data source has been refreshed. Now check for added dimension members. To add more clarity, show customized messages for success/failure of adding dimension members. If cancel is clicked, the pop-up will close immediately.
4.Update dimension members
In the onClick event of the ‘Update members’ button, write the below script to open the pop-up, resetting the input fields to blank, and populate the dropdown with product info.
In the onSelect event of Product ID dropdown, you need to fetch the respective member existing info and furnish that in input fields.
Now add the below scripts to Popup_updatemember –onButtonClick event to update the ‘product’ dimension members and show custom messages.
5.Deleting dimension members
In the onClick event of the ‘Delete members’ button, write the below script to open the pop–up and populate the checkbox with product info. You can delete multiple dimension members at the same time simultaneously by selecting the members to be deleted from the checkbox and clicking the delete button in the pop–up.
Add the below scripts to Popup_deletemember –onButtonClick event to delete the dimension members and show custom messages.
Now your application is ready for maintaining the product dimension master data on the fly without any hassle.