Master Data On the Fly has been a hot requirement in the BPC world. In BPC standard model you can refer to below How To Guide:
https://www.sap.com/documents/2015/08/8a51704b-557c-0010-82c7-eda71af511fa.html
In this article, I'm going to share my implementation of Master Data On the Fly in BPC Embedded Model. It's based on Input Ready Query and Planning function.
Goal
We'll setup a workbook that allow you to not only input transaction data but also master data. The master data will be updated to both master data table and hierarchy.
Design
We'll need a Direct Update DSO because we need to use the char type key figure.
In the DSO we'll create only one characteristics and 2 key figures to make it simple. One key figure is numeric type and the other is char type.
Then we need to create an aggregation level to contain the planning functions and to support the input ready query.
In the planning function we will implement the code to update master data and hierarchy
In the workbook we'll insert the query and also implement the macro to trigger the planning function.
Detail Steps
Create an InfoObject called ZPROD, Type char and length 32. switch on master data table and hierarchy. To to be simple we don't create any attribute.
Create the key figures, we need to at least prepare 2. One is numeric type and the other is char type. In our example, Z_PRC is the numeric type key figure and ZCOMNT is the char type.
Create the Direct Update DSO and assign the characteristics to the DSO.
Create the Aggregation Level and the select the DSO as the Basis InfoProvider
Create the Input Ready Query, put the ZPROD on the row.
The query will look like below in RSRT.
Create the Planning Function Type in RSPLF1. Here we have to also prepare for the Planning Function class. In the class, the master data and hierarchy update method is created.
3 parameters are created as below:
Planning function type class implementation
In the class ZCL_RSPL_INPUT_MD, we have implemented both interface below
- IF_RSPLFA_SRVTYPE_TREX_EXEC
- IF_RSPLFA_SRVTYPE_IMP_EXEC
In both classes' EXECUTE method, UPDATE_MD method will be called.
Create the Planning Function
For I_IOBJ, choose ZPROD.
For PARENTID and MEMBERID, create 2 variables to allow end user input from UI.
Create the workbook
For demo purpose, we have put both the query and the Master Data creation button on the same worksheet.
Attach the planning function to the workbook:
Macro implementation
Assign below 2 lines of code to the GO button
lResult = Application.Run("SAPExecutePlanningFunction", "PF_1")
lResult = Application.Run("SAPExecuteCommand", "Restart", "ALL")
Test
After click on the GO button, you should be able to see a successful message popping up from the left bottom corner and the report should look alike below: