Technology Blog Posts by SAP
cancel
Showing results for 
Search instead for 
Did you mean: 
Manuel_Rodrigues
Product and Topic Expert
Product and Topic Expert
1,854

Introduction

There are already some good blogs explaining how to Create, Update and Delete dimension members in SAP Analytics Cloud Planning models, however, it is not clear that multiple dimension member entries can be created in a single call of the api updateMembers() or the api CreateMembers().

On this blog I will focus on the api updateMembers() because this api works like an upsert:

  • If a new dimension member Id is passed to the api call it will be created/inserted as a dimension member.
  • If a an already existing dimension member Id is passed to the api call it will be updated.*

*In my opinion there is an advantage to this api over the CreateMembers because it will not give a server error in this case.

Solution: Create an Array with multiple dimension members and pass it to the api call.

In some business scenarios there is the need for business users to create master data entries in mass in the budgeting process Ex:

  • HR Planning: Creating of mass positions based on templates / existing positions.
  • Project Planning: Creation of multiple projects by copy of projects with similar characteristics.
  • CAPEX: Creation of Assets by copy of existing asset.
  • Hierarchies: Sometimes it is required to have a default hierarchy that contains the most recent picture of the data and a multiple historical snapshots of hierarchies that reflect the data in previous periods, with this method the snapshots can be created in a single call.

For these scenarios it is recommended to reduce the calls of the api updateMembers() by generating an array with multiple dimension members, instead of calling the function multiple times with a single member.

Note: To generate associated transitional data a data action needs to be called, to avoid multiple data action calls, an array of multiple dimension members can be passed to the data action. Also, different transactional data values might be passed to dimension members by creating an attribute in the dimension with the value to be passed, this value can then be read in the data action and only a single data action call will be necessary.

https://community.sap.com/t5/technology-blogs-by-sap/multiple-master-and-transactional-data-entries-...

Before:

manuelr_0-1743978359484.png

After:

manuelr_1-1743978390623.png

Code:

 

var create_multiple = ArrayUtils.create(Type.PlanningModelMember);
 create_multiple = [{
    "id": "500349",
    "description": "VP Information Technology",
    "properties": {
        "Cost_Center": "CC1",
		"Employee":"Employee1",
		"Status":"Active"
   				  } },
					{
    "id": "3000003",
    "description": "Project Coordinator",
    "properties": {
        "Cost_Center": "CC2",
		"Employee":"Employee2",
		"Status":"Active"
   				  } },{
    "id": "3000004",
    "description": "Production Oversight Manager",
    "properties": {
        "Cost_Center": "CC3",
		"Employee":"Employee3",
		"Status":"Active"
   				  } },
					{
    "id": "#",
    "description": "update demo",
    "properties": {
        "Cost_Center": "Unassigned",
		"Employee":"Unassigned",
		"Status":"NA"
   				  } }
				   ];

var update = Model_Demo.updateMembers("Position_Update",create_multiple);
if(update) {
	Application.showMessage(ApplicationMessageType.Success,"Positions Created Successfully");
Table_1.getDataSource().refreshData();

}

Conclusion


This blog tries to bring more clarity to master data creation in Sap Analytics Cloud. The logic / script can be adjusted to accommodate more complex business rules.
Looking forward to read your comments / feedbacks!

1 Comment