Trigger Process Chain from SAC with BPC Live Connection
We built a planning application in SAP Analytics Cloud using SAP BPC Live Connection. The requirement was for the users to be able to load the actuals data in the BPC System from the application and also get a real time status whether the data load got completed.
Since we have the Planning trigger in SAC Stories, we thought we could use that to trigger a process chain in the backend system. There is a very good blog related to this issue which we followed where we build a planning function using fox formula. Inside the fox formula you can call the function module to trigger the process chain.
You can read the link below for this :
However with the above approach since we are going to trigger the planning sequence from SAC, we couldn’t find any way to send back messages to SAC about the process chain status. It was becoming difficult for the users to check the latest status of the data load in SAC.
So while trying to search a better approach we realized that there are two standard planning function types provided by SAP for this purpose.
- 0RSPL_START_PROCESS – Start a Process Chain
- 0RSPL_GET_PC_LOG – Get Logs from a Process Chain
As shown below you can find the planning function types in BI Content under Function Type for Planning. When you use these for the first time, you need to activate them from the BI Content.
Once activated the Planning Function types are ready for use.
Now lets look at the step by step process to create the Planning sequence to trigger a process chain.
- Since our planning function will have to based on an Aggregation Level, we need a Plan DSO and a Aggregation level as the first step. Create DSO and Aggregation level as shown below. You can create a Custom InfoObject to store Process Chain ID. The DSO is of type Direct Update, Planning enabled.
2. The next step is to create planning function on this aggregation level that we created.
Enter the Name of the Process chain in the parameter as shown below :
3. Now lets create a planning filters as shown below.
Enter the process chain name in the Planning Filter as shown below.
4. Once the planning function and planning filter is created, we have to create a Planning Sequence. Add the planning function and planning filter that we created before in the planning sequence.
Save the planning sequence and execute it. As shown below you will see a message that the Planning sequence executed without errors.
Go to RSPC and check the logs for the process chain to see if it got executed. As shown our process chain got executed below :
Now create another planning function and planning sequence to check the process chain logs.
5. To use this planning sequence in SAC, we will need a Model in SAC. So lets go to BPC Environment and create a model. You first need to create an environment for your project if you dont already have it, and then create the model.
Select the plan DSO now that we created before.
6. Now lets go to SAC and create a BPC Model from the BPC Live Connection. Create a sample query on the aggregation level as shown below and you can use that in the SAC Model. See below :
As shown below create a SAC Model from BPC Live Connection. In BPC Environment select the environment and the BPC model we created in previous step and then select the BW Query and click on ok and save the model.
7. Now create a blank story and add Planning Trigger Object as shown below.
Add a planning trigger in the story and select BPC Planning Sequence Trigger. Here select the model that we created in the previous step.
As shown above my planning trigger is added to the SAC Story. I added one more trigger for the planning sequence ZAGG_PC_PS1 for checking the logs.
Now go to view mode and click on the first planning trigger.
As shown you get a message that the planning sequence is executed without errors. This means that the process chain is executed in the backend. To check the status of the process chain click on the second planning trigger.
It gives the status of the process chain as ok which means the process chain executed successfully. If the process chain fails you can see the errors here and if the status is active it means the process chain is running. You can click the button multiple times to check the status of the process chain.