BRF+ for Business Users
What is BRF+
BRF+ stands for Business Rules Framework. It is a standard tool from SAP with the intention of separating the business rules from the coding. All the config tables like TVARVC etc potentially fit into this.
It not only helps developers but also business users. It speeds up the development process by providing inbuilt features like file upload, change management etc without writing a single line of code. Adding to that business users avail the flexibility of maintaining business rules in different formats, which best suits their requirement.
BRF+ vs Config tables
Historically we have tried to fit all the business rules into tables. By using BRF+ we can maintain config not only in a table format, known as Decision Table in BRF+, but also in other formats Boolean expression, Decision Table, Decision Tree, Case statement etc.
Advantages of BRF+
BRF+ provides inbuild versioning capability for almost all of the object types from Application to Expression. Versioning comes with capabilities like comparison, activating a previous version etc.
Multiple Rules in a Rule Set
Each ruleset can be assigned with multiple rules and can be processed in a sequence.
Each rule in a rule set can process a different type of expression.
Each rule can be activated, processed based on a condition.
Each rule can be set to be active only for a particular date range.
Check Rule below.
Upload and download features on Decision Tables
Provides inbuilt excel upload and download functionality for Decision Table expression.
Every rule set can be tested via assigned Function, before activation, to make sure the new config is behaving as expected.
Access BRF+ workbench
Use TCODEs BRF+ or BRFPLUS to access BRF+ workbench. Workbench is a webdynpro application which opens in a browser.
Terminology of BRF+
There are a few different types of objects in BRF+ but the important ones are
- Rule Set
Function is the top most element which defines the context of our business function. In other words the context is the input and output parameters. This is a developers job and we move this change via transport. The context involves Date, Site, Commodity etc.
Below function ‘Get Rate’ takes 2 input parameters Customer, Quantity and calculates the Rate.
Defines the set of rules that are assigned to a function. One function can contain one or more rule sets. If a function contains more than one rule set, we can define priority to define the execution order of the rule sets. We can even enable or disable a rule set.
One rule set is assigned to the below example function.
Business rules where we define our rule logic. Any number of rules can be assigned to a rule set. Each rule can have an optional validity period.
In the below example, 2 rules, Rule 1 and Rule 2 are assigned to a rule set. One with limited validity period and other with unlimited validity period.
There are many different expressions in BRF+ like below. These are different ways we can define the business rules.
- Decision Table
- Decision Tree
- DB lookup
In Rule 1, we are processing a formula expression if the customer is not 99991.
In Rule 2, we are processing a decision table to calculate the amount