Skip to Content

This is the fourth blog of my blog series on Business Rules Consumption Patterns. In earlier blogs, you saw Pattern 1 – which explains how business rules can be used directly and indirectly in your custom application and in Pattern 2 you saw how the decision logic can be extracted in process orchestration scenario using SAP Cloud Platform Workflow and Integration services.

Pattern 3 – S/4HANA Side by Side Extensibility

In this pattern you will see how to extend decision login in your digital core applications and processes in a federated suite.

Usage Scenario #1
Taking advantage of digital transformation in analytical decision making

There are various styles of contemplating decisions. Analytical decision-making is one such form where important business decisions are made based on the large set of historical data.

SAP HANA Rules Framework (HRF) is a tool on SAP HANA that helps application developers to automate analytical decisions on big and real-time data, leveraging the capabilities of HANA platform. It provides rapid application development with built-in editors in SAP HANA Studio to quickly develop the decision logic without touching the application logic . Besides it also had SAPUI5 application for business users to effectively and easily change rules without the hassles of knowing the technical tool.

With wave of digital transformation, it becomes critical that this data-driven decision-making takes advantage of the complete potential of digital innovation. So, we take a step closer to SAP’s digital transformation strategy and introduce you to the next-generation rules framework: SAP Cloud Platform Business Rules with SAP HANA deployment option. SAP Cloud Platform Business Rules now provides a robust and unified experience to manage and deploy rules on your choice of backend HANA system, overcoming the complexity of (a) IT infrastructure, (b) learning different business models and technologies.

 

What is this new HANA rules modelling in SAP Cloud Platform?

With latest release of SAP Cloud Platform Business Rules you can model your rules on the SAP HANA database tables. Not only this, you can also deploy your rules directly from cloud to your on-premise HANA system where they are persisted as SQL procedures. So, while your design time environment is now moved to cloud, your runtime environment is still the HANA – which means that your application logic is not affected with this shift.

As you see in the solution diagram above, the end user experience does not change instead we have given a much more robust, effective and easy-to-access modelling platform to application developer.

In this blog, I will talk about everything you need to know about integration of SAP HANA with SAP Cloud Platform business rules. Please note that it is not a step-to-step guide for modelling analytical rules. I will only explain the new and additional configurations and modelling terms that are needed over and above the basic development you have known so far. So, if you are new to business rules, then refer this blog to know the basics first.

… let’s get started

As prerequisite you need to have:

  • On premise SAP HANA 1.0 SP12 or above or SAP HANA 2.0
  • XSA enabled in your HANA setup
  • Schema and tables already created (these tables will be used for modelling rules)

Before you begin using SAP Cloud Platform Business Rules, there are few configurations and setup you need to do to connect the HANA system with your cloud account.

  1. Setup Rules HANA Connector

This is an XSA application that is available in SAP Service Marketplace for download. Rules HANA Connector is responsible for creating and storing the rules specific design-time and runtime artefacts at HANA side. Here is the installation guide that helps you in this set up.

 

  1. Setup Cloud Connector

As a default guideline, SAP Cloud Connector application need to be installed and configured for secure connection between cloud applications and on-premise systems. You can follow the blogs in SAP community or help documentation for more information:

 

  1. Configure destination in SAP Cloud Platform

To access Rules HANA Connector from SAP Cloud Platform via OAuth 2.0 authentication mechanism, you need to create destinations as mentioned in the documentation

After this administrative one-time setup, all you need to do is subscribe to Business Rules service in your SAP Cloud Platform neo or trial account and ensure that you have assigned repository and runtime roles to your user. Follow my previous blogs to learn more about it.

Now you are ready to start modelling HANA rules in SAP Cloud Platform Business Rules through web-based Manage Rules Application

 

  1. Create system settings via Configure Systems.

This is new addition in the application to manage systems whose resources will be used in rules modelling. In this case, it will be SAP HANA system. System configuration is needed to tell business rules on which backend system resources you are going to model rules.

You can see in the screenshot below that system configuration needs the destination information which will be used to connect to the given system (SAP HANA system in this case) This is the same destination that has been created in #3 administration step.

If you wondering what this Context Path is? It is nothing but the relative URL of an internal API that is used to access platform resources. Context path is fixed for each platform type. For example: In this case, as we are using SAP HANA system, the context path is as shown in screenshot. Later when we release S/4HANA integration, then you will see a different context path.

 

Next you switch to design (pencil) panel icon to model your rules. While most of the rule modelling notation and concepts remain same, yet there are few additions that you need to know.

 

  1. System information in Project properties

By default the system selected in rules project is SAP Cloud Platform. To avail HANA deployment option, you need to change the system to one configured via Configure Systems. As you do this, you let the business rules know that you will be modelling rules on the resources of this system and later deploying it to this system.

 

  1. Annotation in Data Objects

It is a mandatory property. For SAP HANA deployment, the annotation-type chosen must be HANA DB. Annotations are defined at two places in the data object:

  • First is at the data object level where you annotate the data object in cloud platform business rules to backend HANA schema and table name

  • Second is at the attribute level where you annotate the attribute of a data object to equivalent column name and type in the backend HANA table.

 

  1. Reference in Vocabulary of Rule Service

Till now you were able to set vocabulary of rule either as Input or Result – but with new release you will see one additional usage type: Reference. When you define any data object as Reference in rule service then you inform the rules engine that this data object would not be supplied explicitly during the rule execution instead rule engine has to directly query the associated database table in the given backend HANA system.

 

 

  1. Annotation in Rule Service

Annotation is a mandatory property in rule service also. For SAP HANA deployment, the annotation-type chosen must be HANA XSC. Annotation details given to the rule-service implies that the rules runtime artefacts will be generated in the given package and schema in the backend HANA system.

  1. Deployment of Rule Service in SAP HANA

There is a new deployment option available with August 2018 release of SAP Cloud Platform Business Rules. This new option gives you the flexibility to directly deploy your business rules modelled in cloud into your selected on-premise HANA system – with just one click!

That is not all. When you select the HANA system for deployment, the rules runtime artefacts are generated via the special compiler. These artefacts are then activated & persisted in HANA repository via Rules HANA Connector. The generated artefacts are of two types:

  • Table Type: for all Input and Result usage type a is generated
  • SQL Procedure: the actual rules runtime artefact that need to be called to execute business rules. SQL procedure generation is based on how you defined the rule service. For example: If your rule service has one Input and one Result then the generated procedure will have one input parameter and one output.

Note: SAP Cloud Platform Business Rules supports deployment only to SAP HANA XS Classic repository. This means HANA XS classic system is mandatory prerequisite to work with this new capability. I will soon publish another blog that will guide you with analytical rules in SAP HANA XS Advanced option.

 

  1. Execute Business Rules

With change in runtime environment there is also a change in how you invoke the rules. But wait, if you already familiar with or are using SAP HANA Rules Framework then you don’t to bother as the execution artefact remains the same – which is – SQL procedure.

Let us understand this again:

  • When business rules are deployed in SAP Cloud Platform, then a rest-based service is generated which is invoked using public APIs.
  • When business rules are deployed in SAP HANA, then a procedure is generated which is invoked using standard HANA SQL procedure syntax

 

That’s it! You now have all the information you need to know to build analytical rules in SAP Cloud Platform using vocabulary from SAP HANA system resources. To quickly summarize the steps,

  • Setup Rules HANA Connector in SAP HANA
  • Setup Cloud Connector
  • Create Destinations in SAP Cloud Platform
  • Create system via Configure Systems view
  • Create rules project and assign HANA system
  • Create data object of type Table with appropriate associations and annotations
  • Create rule service with appropriate vocabulary and annotation
  • Create rules and rulesets as usual
  • Do not forget to Save and Activate all the rules artefacts
  • Deploy the rule service to configured SAP HANA system
  • Execute the generated procedure in your SAP HANA system via SQL commands

With this new capability, we have tried to provide unified experience to business rules developers with one common enterprise rules model (ERM). They can use same design-time tool to build rules for different platforms and effectively switch across platforms without the need for any transformation or complex migration scripts.

Isn’t that innovative and exciting? I feel it is and the affect will be even more realized when more platforms like S/4HANA and Java are added to the exiting list. Try these new capabilities in SAP Cloud Platform Business Rules and share your experience with me.

 

Related Blogs
SAP Cloud Platform Business Rules – Extensions and Consumption Patterns
Embed Business Rules SAPUI5 control in your custom applications
Using Business Rules in SAP Cloud Platform Workflow

To report this post you need to login first.

Be the first to leave a comment

You must be Logged on to comment or reply to a post.

Leave a Reply