ProductsProducts
IndustriesIndustries
SupportSupport
TrainingTraining
CommunityCommunity
DeveloperDeveloper
PartnerPartner
AboutAbout
Search
Log On
o
o
o
o
Frank Schuler
Follow RSS
Inspired by the excellent series of SAP HANA Rules Framework by the SAP HANA Academy
YouTube videos listed by Denys van Kempen, and because I did not have the banking model
available referenced in those videos, I decided to start my own SAP HANA Rules Framework
1.0 SPS 07 proof of concept implementation.
This blog describes my steps from installing the SAP HANA Rules Framework 1.0 SPS 07 Patch
Level 1 and configuring it until creating a HANA Rule and executing a HANA Rule Service
with varying HANA Rule Conditions in the end. For further details please refer to SAP Note
2259199 – Release-Informationen zu SAP HANA Rules Framework 1.0 SPS07 and to the SAP
HANA Rules Framework’s official documentation on SAP Service Marketplace.
The SAP HANA Rules Framework 1.0 SPS 07 can be downloaded from SAP Service
Marketplace:
At the time of this blog, SPS 07 Patch Level 1 was the latest available version:
Please be aware that SAP HANA Rules Framework 1.0 SPS 07 requires SAP HANA SPS 11. For this blog, I have
been using the SAP HANA Database Revision 111. However please be aware, that at the time of this blog, there has
been no SAP HANA Datacenter Service Point released for HANA SPS 11 yet, so at the time of this blog, you
should try this in a sandbox environment only. Please check SAP Note 2021789 – SAP HANA Revision and
Maintenance Strategy, whether this is still the case when you read this.
After extracting the ZIP archive, I install the package with the HANA Application Lifecycle
Management Delivery Units Import functionality:
After confirming the import of the Delivery Unit:
The imports starts and runs for a little while. Once completed you get a green light and we are
ready to proceed:
Next, back in HANA Studio, you have to create a user called HRF_TECH_USER and grant this
user the following, to enable rule service consumption:
Also, you would have to grant your user a series of HANA Rules Framework Roles:
With that preparation we can configure the HANA Rules Framework via REST API. Please
configure basic authentication with your user, that you granted the roles above. As a result, you
are rewarded with a success message:
And subsequently with access to the Fiori Launch Pad of the SAP HANA Rules Framework at:
http://<full_domain_name>:80<instance_number>/sap/hana/uis/clients/ushell-
app/shells/fiori/FioriLaunchpad.html?siteId=sap.hrf.ui|app|app
With the configuration in the bag, we next deploy the SAP HANA Rules Framework Modelling
Tools at:
http://<hostname>:80<instance_number>/sap/hrf/updatesite
After confirming the license agreement the software gets installed and you will have to restart
SAP HANA Studio.
Next we build a small Point of Sales data model as the basis for our HANA Rules. You find the
SQL scripts for these tables and their contents in the appendix at the end of this blog:
Please do not forget to grant both users _SYS_REPO and HRF_TECH_USER SELECT
Privileges with Grant Option to the schema of your user. These are needed for the creation and
execution of the Rules Service respectively:
Now we create a new XS Project and within that a new Vocabulary based on the tables above:
For this we join:
CUSTOMER.ID to SOHEADER.DEBITOR
SOHEADER.NUMBER to SOITEM.PO
SOITEM.ARTICLE to ARTICLE.PART
CUSTOMER.NAME
CUSTOMER.SEGMENT
SOHEADER.TOTAL
ARTICLE.CATEGORY
To finish our vocabulary, we create an Output Type:
Now we got the basis to create our first HANA Rule. In the Fiori Launch Pad of the SAP HANA
Rules Framework chose Rules – Mange all rules and create a new HANA Rule:
Then add the following conditions. Type forward help will help you immensely with this,
especially for the joined condition Category over three intermediate tables:
Finally Add Output Customer and provide conditions as follows:
These are the SQL scripts to create the Point of Sales data model used in this blog. Schema
USER will have to be replaced with your user schema:
17 Comments
Dear Frank,
like (0)
I followed the steps shown in the blog to install HRF. But I met an error when I tried to open:
<full_domain_name>:80<instance_number>/sap/hana/uis/clients/ushell-
app/shells/fiori/FioriLaunchpad.html?siteId=sap.hrf.ui|app|app2
Error message: Failure-Unable to load groups.
<full_domain_name>:80<instance_number>/sap/hana/uis/clients/ushell-
app/shells/fiori/FioriLaunchpad.html?siteId=sap.hrf.ui|app|app
like (0)
Hello Bing,
Best regards
Frank
like (0)
Thx for your wonderful blog. I will execute in my test dev system, week of 21-Mar-
2016. I will also update with my success. Thanks again for your specific details. Much
Appriciated .
like (0)
Could it possible to provide the Json file of above explained example ,want to check how
it has created as I don’t have HRF GUI so planning to incorporate using file and trying to
import the Json file.
email id :asifhussain.p@gmail.com
Thanks,
Asif
like (0)
Hello Asif,
pos.hprvocabulary:
{
"dataObjects":[
{
"name":"CUSTOMER",
"description":"FSCHULER-CUSTOMER",
"attributes":[
{
"name":"ID",
"description":"ID",
"dataType":"INTEGER",
"businessDataType":"Number",
"sourceType":"Data",
"dataMapping":{
"column":"ID"
}
},
{
"name":"NAME",
"description":"NAME",
"dataType":"VARCHAR",
"businessDataType":"String",
"sourceType":"Data",
"size":"8",
"dataMapping":{
"column":"NAME"
}
},
{
"name":"SEGMENT",
"description":"SEGMENT",
"dataType":"VARCHAR",
"businessDataType":"String",
"sourceType":"Data",
"size":"1",
"dataMapping":{
"column":"SEGMENT"
}
}
],
"associations":[
{
"name":"DEBITOR",
"target":"SOHEADER",
"cardinality":"OneToOne",
"attributeMappings":[
{
"source":"ID",
"target":"DEBITOR"
}
]
}
],
"mappingInfo":{
"schema":"FSCHULER",
"name":"CUSTOMER",
"type":"Table"
},
"layout":{
"location":{
"x":"70",
"y":"30"
}
}
},
{
"name":"SOHEADER",
"description":"FSCHULER-SOHEADER",
"attributes":[
{
"name":"DEBITOR",
"description":"DEBITOR",
"dataType":"INTEGER",
"businessDataType":"Number",
"sourceType":"Data",
"dataMapping":{
"column":"DEBITOR"
}
},
{
"name":"NUMBER",
"description":"NUMBER",
"dataType":"INTEGER",
"businessDataType":"Number",
"sourceType":"Data",
"dataMapping":{
"column":"NUMBER"
}
},
{
"name":"TOTAL",
"description":"TOTAL",
"dataType":"DECIMAL",
"businessDataType":"Number",
"sourceType":"Data",
"size":"3,2",
"dataMapping":{
"column":"TOTAL"
}
}
],
"associations":[
{
"name":"PO",
"target":"SOITEM",
"cardinality":"OneToOne",
"attributeMappings":[
{
"source":"NUMBER",
"target":"PO"
}
]
}
],
"mappingInfo":{
"schema":"FSCHULER",
"name":"SOHEADER",
"type":"Table"
},
"layout":{
"location":{
"x":"310",
"y":"30"
}
}
},
{
"name":"SOITEM",
"description":"FSCHULER-SOITEM",
"attributes":[
{
"name":"PO",
"description":"PO",
"dataType":"INTEGER",
"businessDataType":"Number",
"sourceType":"Data",
"dataMapping":{
"column":"PO"
}
},
{
"name":"ARTICLE",
"description":"ARTICLE",
"dataType":"INTEGER",
"businessDataType":"Number",
"sourceType":"Data",
"dataMapping":{
"column":"ARTICLE"
}
}
],
"associations":[
{
"name":"PART",
"target":"ARTICLE",
"cardinality":"OneToOne",
"attributeMappings":[
{
"source":"ARTICLE",
"target":"PART"
}
]
}
],
"mappingInfo":{
"schema":"FSCHULER",
"name":"SOITEM",
"type":"Table"
},
"layout":{
"location":{
"x":"550",
"y":"30"
}
}
},
{
"name":"ARTICLE",
"description":"FSCHULER-ARTICLE",
"attributes":[
{
"name":"PART",
"description":"PART",
"dataType":"INTEGER",
"businessDataType":"Number",
"sourceType":"Data",
"dataMapping":{
"column":"PART"
}
},
{
"name":"CATEGORY",
"description":"CATEGORY",
"dataType":"VARCHAR",
"businessDataType":"String",
"sourceType":"Data",
"size":"1",
"dataMapping":{
"column":"CATEGORY"
}
}
],
"associations":[],
"mappingInfo":{
"schema":"FSCHULER",
"name":"ARTICLE",
"type":"Table"
},
"layout":{
"location":{
"x":"790",
"y":"30"
}
}
}
],
"outputs":[
{
"name":"Customer",
"description":"Customer",
"inputParams":[
{
"name":"Customer",
"dataType":"VARCHAR",
"size":"8"
}
]
}
]
}
Segmentation.hprrule:
{
"description": "Check Customer Segment and Product Category",
"ruleBody": {
"type": "decisionTable",
"content": {
"headers": [
{
"colID": "id-1457012402797-49",
"expression": "SEGMENT of the CUSTOMER",
"alias": "Segment",
"type": "condition"
},
{
"type": "condition",
"expression": "CATEGORY of the PART of the PO of the
DEBITOR of a CUSTOMER",
"alias": "Category",
"colID": "id-1457018668865-111"
},
{
"expression": "",
"name": "Customer",
"type": "output",
"businessDataType": "String",
"isCollection": false,
"colID": "id-1457012492442-59"
}
],
"rows": [
{
"rowID": "id-1457012402797-50",
"row": [
{
"colID": "id-1457012402797-49",
"content": "= 'X'",
"span": 1
},
{
"colID": "id-1457018668865-111",
"content": "= 'P'",
"span": 1
},
{
"colID": "id-1457012492442-59",
"content": "NAME of the CUSTOMER",
"span": 1
}
]
}
]
},
"hitPolicy": "allMatch"
},
"status": "Active",
"vocabulary": "hrf::pos",
"output": "Customer",
"conversionFlagsMap": {
"isValueListConverted": true
}
}
Discount.hprruleservice:
{
"description": "Discount Rules",
"vocabulary": "hrf::pos",
"output": "Customer",
"readOnly": true,
"resultView": "resultViewOnly",
"ruleAssignment": "Automatic",
"executionContext": {
"dataObject": {
"name": "CUSTOMER",
"keys": [
"SEGMENT"
]
}
},
"conversionFlagsMap": {
"isValueListConverted": true
}
}
like (0)
1. asif hussain November 1, 2016 at 11:34 am
like (0)
Hi Frank,
Noam Gilady,
Senior Product Owner
Cloud Exp NW & Rules – HRF
like (0)
Hi Frank
Could you please tell me how to execute script with REST api.
BR,
Hrishikesh
like (0)
1. Frank Schuler Post authorApril 16, 2017 at 8:39 am
Hello Hrishikesh,
You have to send the configuration information to the API as a POST request.
From the error message you receive, I gather that you are using a GET request,
which does not work.
Best regards
Frank
like (0)
like (0)
Hi Frank
It worked !!!
BR,
Hrishikesh
like (0)
Could you please tell me, How can I implement HRF to HCP’s IOT module ?
Regards
Kafi
like (0)
Hello Kafi,
There are quite a few options how to consume a rule service. Please check section
6.4.2 Consuming a Rule Service in the SAP HANA Rules Framework 1.0 SPS09
Dev. & Implem. Guide.
Best regards
Frank
like (0)
Hi Frank
Excellent Blog.
Thanks
Ashok
like (0)
Hi Frank,
Once a Rule service is created, I can run it using “Run” button present in the Fiori
Launchpad of SAP HRF.
But how can I call/run this service from some other application or xsjs service or
procedure?
Best Regards,
Sanampreet Singh
like (0)
Hi Frank,
Can we schedule HANA Rule Service? Instead of running it from Rule service
Launchpad.
We can use created procedure and view by rule service and create XSJobs and schedule
it.
Regards,
Kalpan
like (0)
Privacy
Terms of Use
Legal Disclosure
Copyright
Trademark
Sitemap
Newsletter