Visualizing SAP HRF Rule Results in SAP Lumira – Part 1
In the next blog Rob Case (firstname.lastname@example.org) explains how to consume an HANA Rules Framework rules’ results with SAP Lumira…
SAP HANA Rules Framework Preparation and Rule Creation
The first part (this blog) of this tutorial describes the typical preparation required for an SAP HANA Rules Framework application regardless of how the results are to be consumed.
The second part describes steps that need to be undertaken to visualize the results in SAP Lumira.
The HANA Database and SAP HRF content that I use as a working example in the pages below are contained in the accompanying attachment “HRF Content for Lumira Example.rar” in HRF’s Jam page. This file allows you to browse individual SAP HRF resources as reference objects, but also gives you the ability to paste the whole content into an SAP HANA Studio Project Explorer tab and activate it against an SAP HRF enabled server installation.
SAP HANA Rules Framework Overview
SAP HANA Rules Framework is perfect for handling complex analytical rule constructs in real-time (online) and batch (offline) scenarios and makes the best use of the power of SAP HANA in order to achieve this. The built-in Fiori user interface that is distributed as part of SAP HRF is excellent at providing rule creation and management and allows rule results to be displayed in a textual manner. SAP HRF is all about providing the ability to allow business users to control, influence and personalize decision making in highly dynamic scenarios within the organisation in the most efficient and robust manner. Outside of SAP HRF it is the calling applications responsibility to make use of the decision results and actions that SAP HRF has returned.
Whilst the result set displayed by the SAP HRF user interface is informative, this can often be greatly enhanced by using a presentation tool to graphically represent the HRF output. One of the easiest ways of providing this type of graphical rendering is to use SAP Lumira. As a fairly novice user of SAP Lumira I am not going to delve much into how to use this tool – there are plenty of examples of this already in existence – this narrative is aimed very much more at describing the interfaces between SAP HRF result views and how to consume them in SAP Lumira.
I am going to lead you through a simple example by taking an SAP HRF rule, consuming the results of that rule in SAP Lumira, modifying the rule so that different results are obtained before refreshing SAP Lumira to present the updated results.
HANA Database Entities
First of all I will start with a very simple fact and dimension tables:
Fact Table SALES_QTY
Dimension Table PRODUCT
SAP HANA Rules Framework Artifacts
I have represented the fact and dimension table in an SAP HRF vocabulary called sales. The vocabulary maps all the elements of both tables into data objects “saleshistory” and “product” respectively and uses a one to many association between product and sales history.
I then create a rule service called “Sales Analysis” by defining it with the following properties: –
In particular I make sure that the Consumption Artifact is of type “View” and the Resulting Data Object is “product” with keys “product_id” and “description”.
The “View” Consumption Artifact is important as it dictates SAP HRF create a HANA column view to hold the rule determination result. This view is stored in the Column View folder of the SAP_HRF database schema. This view is created in the format “<package>::<rule service name>.VIEW”. As I created my SAP HRF application in the package “sap.demo-store.sales.resources” my view is referenced by the name “sap.demo-store.sales.resources ::Sales Analysis.VIEW”
The “Resulting Data Object” allows me to specify the business entity I wish rules to be evaluated against. I have chosen the data object “product” so that I can analyse the sales results for my individual products.
I also provide an output called “SalesQuantity” – for “View” artifacts an output is mandatory. By specifying an output in the rule service that I defined in my vocabulary it allows me to view my rule results in the SAP HRF Fiori UI whilst also providing context to the results. The output contains two integer input parameters “Budget_Quantity” and “Actual_Quantity”.
My rule is entitled “Sales Below Budget” and for simplicity is a text rule rather than a decision table rule. The objective of this rule is to evaluate those products where the average sales quantity over a period of time is less than the equivalent budget sales quantity over the same period. I initially set the time period to be over the last sales month so that the rule condition and output parameters look like those below
I have set my outputs so that they provide the average sales quantity figures across Q4
When I test the rule service in the SAP HRF Fiori UI the rule determination engine provides 3 results, one for each product. December was a poor month for sales as all product sales quantities fell below their budget values.
So now you ready to read to the second part in order to learn how to visualize the results with SAP Lumira…
This is very helpful scenario to help us understand on how to extend the HRF .
Please help with the JAM page access on this and PDF mentioned as we would want to develop this to gain insight . We are using HRF in a custom process for a client and this blog is the closest that fits the bill.
I have sent you an invitation...
Did not received it !! Checked spam n clutter as well.
Sorry! Apparently our Jam page is opened for SAP employees only. We are checking how we can assist you with your requirement.
Thank you though for looking in .
Could you help me with the file mentioned in blog“HRF Content for Lumira Example.rar” in HRF's Jam page.
I am currently investigating how can we make such content public...