Enterprise Resource Planning Blogs by Members
Gain new perspectives and knowledge about enterprise resource planning in blog posts from community members. Share your own comments and ERP insights today!
cancel
Showing results for 
Search instead for 
Did you mean: 
VaraPrasadT
Explorer

What is BRF Plus? Why we need to use BRF+ ?

There will always be some amount of custom business logic available in the SAP system, even if we strive to minimize customization. Such ABAP-based customization must be handled carefully in order to prevent duplication of business logic and to keep it in line with other functional areas. Herein lies the value of SAP Business Rules Framework Plus (BRF Plus), a feature that enables centralized and reusable management of all custom business logic.

In general, BRF Plus features can be accessed on any SAP NetWeaver-based system with the relevant enhancement pack installed.

Both technical users (programmers, system administrators) and business users who manage operational business processes (like bidding, procurement, tax form validation, etc.) can benefit from BRF Plus's unified modeling and run-time environment for business rules.

The application programming interface and user interface that BRF+, or Business Rule Framework Plus, offers is extensive for defining business rules. We can define business rules with it without having to write ABAP code.

Application : In BRF+, to start anything first we must have to create the application. VaraPrasadT_0-1713096869367.png

Type of Storage Types : 

Storage TypeClientTransport RequestCross-Application Usage
SystemClient-IndependentTransportable or LocalCan use system objects.
CustomizingClient-DependentTransportable or LocalCan use system and
customizing objects
Master DataClient-DependentLocalCan use system, customizing,
and master data objects

Data Objects:  Describes data types of the variable. They are the data carriers helping in signature or context of a function, variables in a rule or rulesets, building blocks for Decision tables, Etc. You can create data objects by defining attributes like element type, length, decimals or you can directly bind to existing DDIC elements.

Expressions:  Expressions are the computational units with well-defined logic. Usually, expressions are self-sustained and process the user input and gives result back to the caller.

Rules: Rule is a central entity in BRF+ which builds the business logic. Evaluation of rule gives you the decision for the question in context

Rule sets: Simply, collection of rules. Each rule set can be assigned to exactly one function. Priority can be set at rule set level for defining the order of execution.

To Create Application : BRF+ or BRFPLUS is the transaction code to access the application. 

VaraPrasadT_0-1713021847371.png

Next, we click the Create Application Pushbutton. Below Pop-up will opened up and enter the required fields.VaraPrasadT_2-1713022015549.pngClick on Create and Navigate To Object after filling out Name, Short Text, Text, and Development Package  for Software Component. Another option is to store in the Temporary($tmp) Package.
Next, we'll press the "Save & Activate" button.VaraPrasadT_3-1713022097755.png

Next, within this application, we will talk about the following elements.
1. Create an element in the data object. 
2. Create a structure in the data object.
3. Make a Table Data Object
4. Produce a Decision Table Expression

There are 3 ways to bind the data object in Binding Type :

Create an element in the data object : The following steps are shown in the figure below after you right-click on the application: After completing all the required fields, we will click the designated button.

VaraPrasadT_4-1713022397069.pngThere are three options under this option, which is called Binding type.
Bind to DDIC Element: Select a DDIC Element that shares your attributes.

Bind to an Existing BRF+ Element: Select an Existing BRF+ Element that possesses the same attributes.

No Binding: Maintain the details freely.
VaraPrasadT_5-1713022564894.pngTherefore, in this case, if we select any of the first two options 1 or 2 Name, Text, Element Length, and Element Type will be automatically filled in from the DDIC element or an already-existing BRF+ element.
However, if we select the No Binding option, we will have to enter all necessary information, including the element name, text, short text, element length, and element type.VaraPrasadT_6-1713022749060.png

After entered all the required fields, click on Create and Navigate To Object button and then click Save & Activate buttons to activate it.VaraPrasadT_7-1713022846835.png

Structure Creation: The same application should be used to create the structure.
It is not necessary to build a structure if our result contains just one column. There is also no need to create a structure if the output for a single condition is a single row. If more than one column appears in our result, we should make a structure with all of those columns. Additionally, a structure must be shown if the output consists of multiple rows. The generated structure must be used to create a table in order to produce multiple rows as output.

To Create a Structure, Select our application and follow the instructions shown in the figure below VaraPrasadT_8-1713022930354.pngAfter that, we must complete the required fields to create the structure. However, before that once more, there is a choice named Binding Type, which has the following options:- 

a) Bind to Structure Type (DDIC)
b) No Binding
c) Binding to CDS View: Not to be used

VaraPrasadT_9-1713012449124.png

For Option a & c, The required fields (Name, Short Text, Text) will automatically be filled in from the DDIC structure or the CDS View.
However, if we select option b, which is No Binding, we will have to manually fill in every required field.

VaraPrasadT_9-1713023124169.pngOnce all of these have been filled out, click Create And Navigate To Object, and lastly Save and Activate this structure.

Table Creation: In order to have multiple result rows based on a single condition in our decision table, we can create a table in the same application. Therefore, table creation is necessary in our case.
Select our application, then follow the instructions shown in the figure below.VaraPrasadT_0-1713023441506.pngAfter that, fill out the fields required to create the table. We must first verify the Binding Type.
There are two options for creating tables in Binding Type:
a) No Binding
b) Binding to Table Type (DDIC)

VaraPrasadT_0-1713174547254.pngIf we select option b "Binding to Table Type (DDIC)" All required fields (Name, Short Text, Text, Table Line Type) from the DDIC Table Type are automatically filled.
If we select option a "No Binding"  then it  will have to manually fill out all required fields.
Therefore, choose Table line from the application in order to display Multiple Rows. VaraPrasadT_1-1713023706302.pngOnce all required fields have been filled out, click Create And Navigate To Object, and then save and activate this table.

Decision Table Creation :
The next important step is to construct our Decision Table using our application as well. Select the Decision Table and follow the steps outlined in the figure below.VaraPrasadT_2-1713023796943.png

Once Name, Short Text, and Text are entered, click on the Highlighted button.VaraPrasadT_3-1713023892828.pngIn the table settings, we can do the below enablement. 

VaraPrasadT_4-1713024095580.pngThere is a checkbox labeled "Return all matches found" in Settings. If we don't select this option, even though multiple rows may exist based on the same condition, only one row will ever display for that condition.
Select the Result Data Object located in the same application as our recently created Table. Next, include the Condition Column.
Select the Application Data Element's Column:VaraPrasadT_5-1713024147277.png

VaraPrasadT_6-1713025855102.pngTo Select an object as the Condition Column, select it and then click OK. Declare a field as required in the condition column, indicating which column's value will be used to retrieve the value of the result columns.
Thus, the Condition Column's input needs to be required and selected columns comes as result.VaraPrasadT_7-1713026013941.pngSelect these components from the table.VaraPrasadT_8-1713026073702.pngClick OK once all of the table's objects have been selected.VaraPrasadT_9-1713026104123.pngClick the OK button to proceed. All of the selected columns now appear as Result Columns.
VaraPrasadT_10-1713026165037.pngSave and Activate all Decision Table modifications after adding Table Contents. Now update this Decision Table with the Table Contents and Next, select "Start Simulation" to see if our decision table functions.VaraPrasadT_1-1713092277220.png

VaraPrasadT_3-1713092447800.pngAfter entering the program name, select Execute. Will get the matched records as output.

Use of Decision Table in ABAP Program: In order to obtain the required output rows, we must now use our Decision Table in an ABAP program and pass the condition column value from the program.
In the same application, a function must be created for that.

Function Creation: To begin, right-click on the application, then follow the instructions in the figure below.

VaraPrasadT_4-1713092824406.png

VaraPrasadT_5-1713092910328.pngAfter entering the Name, Short Text, and text, press the Create and Navigate To Object button.
Next, fill in the remaining necessary fields, as indicated in the figure belowVaraPrasadT_7-1713093308614.pngSelect our created Decision Table in Expression and Mode as Functional Mode. Next, select the Data Element for the Condition Column and the Table of Result Columns after adding the Context from existing Data Object. Next, select our result columns, which are tables from the same application that we created, under Result Data Object then save and activate every modification.

After that, we must select Create Code Template, copy the sample code, and utilize it in our ABAP programVaraPrasadT_8-1713093364737.pngVaraPrasadT_9-1713093386386.pngAt last, we need to save and apply all of the modifications. Following the use of this template in an ABAP program, all of the resultant columns and expected result values should appear in the program.

Rules and RuleSets : It contains set of rules which can be executed as soon as our BRF+ application Function is getting executed. Rules must be contained in the ruleset, as expressions (IF-THEN-ELSE logic). If-THEN rules are another name for plain rules. 
A ruleset is an assemblage of rules. Select Event Mode by default. The Assign Ruleset option is under Event Mode. VaraPrasadT_10-1713093500474.pngThe function must then be given a ruleset. Please select the "Create Ruleset" button after selecting the "Assigned Rulesets" tab in the screenshot above. After giving the new ruleset a name, the screen below will appear. Following the creation of the ruleset, fill in the Name, Short Text, and Text fields. Then, click the Create and Navigate To Object button below.VaraPrasadT_11-1713093565290.png

VaraPrasadT_12-1713093665007.png

VaraPrasadT_14-1713094058126.pngSave and Activate the Ruleset function.
Next, utilize this ruleset in ABAP code from the function using the Code Generation Template.

Decision Tree: A binary tree of expressions can be defined using a decision tree expression. Condition Nodes are non-leaf nodes. The result is a Boolean. Left & Right nodes will move forward in accordance with the outcome. When a leaf node is reached, the designated expression is executed, and the result of the entire expression is returned as the corresponding result. A decision tree has two nodes at all times: left and right. Every node has decisions that are True (Yes) or False (No). Depending on that new branches (nodes) will proceed. VaraPrasadT_15-1713094204964.png

We can define business rules using the BRF+ interface without having to write ABAP code. These generated business rules can be used as substitution/validation rules or integrated into other SAP programs.

Use cases of BRF+ that can be used into S4HANA: 
Output management for Billing and Purchasing – Output determination (SAP S/4HANA).
Integration with IMG transaction.
SAP business Workflows.
Cloud based Environment.

Conclusion on BRF+ :                                                                                                             

  • It enables us to represent rules in an understandable manner and apply them again in various contexts.                                                     
  • BRF+ eliminates the need to create and maintain custom tables for validation. It also does away with the traditional developer approach of hardcoding values.
  • In essence, BRF+ is used to make decisions, and decision input and output values are kept up to date in Decision Tables, which have sophisticated validation features.

Roles that are required 
SAP_BC_FDT_ADMINISTRATOR
WD Configuration :
/sap/bc/webdynpro/sap/fdt_wd_workbench
/sap/bc/webdynpro/sap/fdt_wd_object_manager
/sap/bc/webdynpro/sap/fdt_wd_catalog_browser

Labels in this area