Workbook Calculation (with Look Up)
Hi there again! I’m glad that you keep coming back for this Workbook Calculation Adapter Blog Posts Series. We are now halfway done with our examples. In the third blog post “Workbook Calculation (with Parameter)”, we talked about configuring a Workbook Calculation function having a formula which is capturing a Parameter value. After we learned about how to do it, there is a question which lingers in our thought. It is configuring Workbook Calculation with a Look Up Table. This’ll be explained in this fourth blog post which will be focusing on the third example.
This scenario shows how Workbook Calculation processes the data from the Input Model Table and a Look Up table. Please note that more than one Look Up table is allowed, but for this scenario, only one Look Up table will be used. Also, it is allowed to include additional fields in the result being calculated through a formula maintained directly in a workbook sheet.
This is the table that will be used as an input function:
Input Model Table
This is the table that will be used as Look Up function:
Look Up Model Table (CAU06)
Only Data functions (e.g Model Tables and Model Views) can be used as Look Up function for Workbook Calculation.
In the Signature tab, we maintain the following:
By maintaining the above Fields, we are:
- Putting the fields Customer and Product in the Granularity fields as they contain unique data records. Thereby we are making sure that the system processes data records from the input data in a grouped manner and that it considers all records from the input function for processing.
- Making sure that the fields Customer, Product, Quantity and Amount (which can also be seen in our Input Mode Table) will be included in the result table.
- Adding another field (make sure that the field is created in the environment, otherwise an error will be displayed). We use this field to create a formula which will eventually be included in the final result.
In the Calculation Rules (worksheet), we see three tabs: The Input and Result tabs, as well as the Look Up tab corresponding to the Look Up table being connected which will be named after its function ID (CAU06).
Optional: Tabs can be renamed. To rename a tab, double-click on the tab name then rename it.
The Input and Result tabs will contain the fields maintained in the Signature section, while the Look Up tab will contain the fields maintained in the Look Up tables.
Input and Result tabs
CAU06 (Look Up) Tab
The tab will not show the data records from the input and Look Up tables. It is recommended to add dummy data in the Excel tabs to test the Excel formula logic. These data are only used for modeling purposes and are not considered in the calculation during system runtime.
Dummy Data provided below can be maintained.
Even though dummy data is maintained in the Input tab, it is still capturing the data from the Input Model table.
Formulas shown below will be used for the Result tab.
By maintaining these formulas, we are cross-referencing the value which will be captured by the first four fields, to the Input tab. For the additional field Total Discount, we maintained a formula which will do the following:
- Multiply the value of the Quantity and Amount
- Look for the Discount Percentage from the Look Up table CAU06 according to the value of the field Product.
- Multiply the result of 1 and 2.
The first four fields (Customer, Product, Quantity and Amount) just captured the data from the Input Model table because we just create a formula referencing to the input. The additional field (Total Discount) multiplied the product of Quantity and Amount with the discount percentage looked up from CAU06.
We only just created a one liner of formula. Anyway, the function considered all records from the input function for processing because fields have been maintained in the Granularity fields from the Signature section.
Not only can we use one Look Up Table, but we can also add several more Look Up Tables for calculation. Just like in an excel sheet, the more the tabs, the more calculations, and separate sheets we can use to obtain a desired result. Exciting isn’t it? But what if instead of creating multiple Look Up tables, you want to use a personal excel file, with multiple tabs already set to be used for calculation? Seems like a way of making your life much easier right? I’ll be sure to teach you how you can do it, on the fifth and last blog post of this Workbook Calculation Adapter Blog Posts Series and that will bring us to the last example as well.
For other SAP Profitability and Performance Management related inquiries, you can post your questions through https://answers.sap.com/questions/ask.html and use primary tag: SAP Profitability and Performance Management.
You can also read other SAP Profitability and Performance Management posts via https://community.sap.com/topics/profitability-and-performance-management.