Skip to Content

In this blog, I will explain on how can integrate SAP Cloud Platform business rules with your SAP S/4HANA on-premise applications. It is not step-to-guide for modelling transactional rules. If you are completely new to business rules, then refer this blog.

As prerequisite you need to have:

  • On-premise SAP S/4HANA of 1809 or above release
  • Register the ERM Gateway Service in S/4HANA system

 

Note: For ease of understanding for my readers who are familiar with S/4HANA, I have chosen the famous SFLIGHT demo scenario. All the screenshots are based on the business rules showcase project that was build to convey the integration of S/4HANA to SAP Cloud Platform Business Rules.

 

… let’s get started

  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
  • Create destination in SAP Cloud Platform to connect to S/4HANA on-premise system.
  • Test the connection. If the cloud connector is setup correctly and URL, username and password is correct then the connection will be successful.

 

  1. Create system settings via Configure Systems

System configuration is needed to tell business rules on which backend system resources you are going to model rules. It contains (a) Destination that you have configured to connect to the backend system and (b) Context path which is 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 S/4HANA system, the context path is as shown in screenshot.

 

  1. Setup System information in Project properties

By default the system selected in rules project is SAP Cloud Platform. In this case, 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.

 

  1. Define or Import the Data Object
  • You can either import the ABAP CDS views from Import –> Managed Systems option or you can create the data objects

 

  • Define the Annotation for the attribute of the data object.
    For S/4HANA on-premise deployment option, the annotation chosen must be ABAP CDS and then provide details of the backend column of the respective CDS view. By this, you provide a mapping between the cloud data object and the backend ABAP CDS view.

 

  • Next, define the Annotation for the data object.
    For S/4HANA on-premise deployment option, the annotation must be ABAP CDS and then provide the name of the backend CDS view.

 

  1. Reference in Vocabulary of Rule Service

Till now you were able to set vocabulary of rule either as Input or Result but with the 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 CDS view in the given backend S/4HANA system.

 

  1. Annotation in Rule Service

Annotation is a mandatory property in rule service also. For SAP S/4HANA deployment, the annotation-type chosen must be ABAP On HANA as shown in the screenshot

 

  1. Model your business rules 

 

  1. Create ruleset to combine the rules with similar output

 

  1. Deploy the rule-service directly from SAP Cloud Platform to S/4HANA on-premise

 With S/4HANA on-premise 1809 release, there is a new deployment option available. This new option gives you the flexibility to directly deploy your business rules modelled in cloud into your selected S/4HANA on-premise – with just one click.

 

 

 

  1. Consuming business rules in S/4HANA application

 Once the deployment is successful, you execute the rules via default BRFPlus function:

cl_fdt_brs_processor=>get_instance( EXPORTING iv_function_id = pv_id )

where pv_id is rule service ID.

 

  • You can find the sample program for reference here.
  • On executing the program above, the screen will look like:

You choose among the available rule services, enter the rule service ID and provide the required input values to execute the rule.

  • You can get the rule service ID from the manage rules application URL (after you navigate into the specific rule service) as shown:

https://<hostname>/index.html#//Projects(24f1225e55fe4e248fdf0f62da0fe3e7,000001)/RuleServices(0b629cf05b6e4a1aae42e5701ef4b81d,000001)/view/RuleServiceDetails

Note: You can also get the rule service ID from the ID column (as shown in the screenshot) that you can select/filter from the settings

  • You will get to know the Input from the rule service definition

 

If you are already working with SAP Cloud Platform Business Rules then it is easy to switch across environment with few configuration steps. Direct deployment to the backend system is the beauty here. If you are new to cloud and looking for rich and unified experience for modelling business rules based on ABAP vocabulary, then you are right place.

 

Sample Business Rules Project

I have shared a FlightBookingRules project in GitHub. This is the same project I have used in this blog. You can download and import the project and use it to learn and reference on how-to integrate business rules in cloud with S/4HANA in your application.

  • The feature is available in SAP Cloud Platform Trial as well. Download and import the sample project in your trial account and experience the new deployment option.

Try the SAP Cloud Platform Business Rules service for integrating with S/4HANA on-premise applications and share your feedback or suggestions with us!

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