What is BRF+ and the importance in S/4HANA?
BRF+ is an ABAP based framework and part of the NetWeaver stack. BRF+ stands for Business Rule Framework Plus and it provides a comprehensive application programming interface and user interface for defining business rules. It enables you to define business rules without the need of wiring ABAP code. The generated Business Rules can be incorporated into other SAP programs or Substitution/Validation rules.
Further technical and functional detail about BRF+ is available at SAP help via this link.
There are many uses cases for BRF+, I will give you two Finance specific use cases further on in this blog.
BRF+ is not new and even not directly related to S/4HANA, but with the release of S/4HANA 1610, BRF+ gained more attention since it is launched as the go-to solution for some business processes. The most important ones are the changes in output management for Billing and Purchasing. For the form determination rules BRF+ functionality is used in S/4HANA. Details can be found in the simplification list of S/4HANA 1610 and 1709.
As of release 1709 BRF+ is implemented for the following processes:
- CPE Simplified Formula Assembly & Formula Evaluation
- Output Management Adoption in Purchase Order
- Engineering Change Management ECR/ECO
- Billing Document Output Management
In the next chapter I will explain and show two Finance related use cases were BRF+ can come in very handy. The same logic can be applied to many more use cases. You just need to get used to the way BRF+ can be incorporated into SAP.
Make your life easy with BRF+
Simple use cases to show you how BRF+ can be applied in the area of finance. I assume that you all are familiar with how SAP works with account determination for Sales and Inventory accounting. The way how sales account determination (VKOA) works is not fully comparable with how Inventory Account Determination (OBYC) works.
In some projects I came across Business Requirements where customers want to determine inventory consumption accounts in the same way as they determine revenue accounts. Not very straight forward in SAP.
When the requirement occurs that companies would like to report their revenues on different GL accounts based on the account assignment group of the customers we can easily configure this in transaction VKOA. But when companies would like to differentiate the Cost of Goods Sold in the same way, based on the same logic we face the limitations of SAP. Unfortunately, SAP does not support any differentiation based on customer account group in account assignment for inventory postings.
You can face the same limitations when your customers want to differentiate consumption accounts based on order types (Maintenance/Production).
I have faced these requirements and thought that the functionality provided in BRF+ can be helpful without the need of hardcore programming or changing standard SAP functionality.
So, let’s see how BRF+ can work for both business requirements. In this example you can see how I differentiate the consumption GL account at the moment of Goods Issue based on Customer Account Assignment Group.
Basically, the same logic as how the revenue accounts are determined in VKOA. I will explain how BRF+ needs to be configured and how you incorporate the business rule in SAP.
First of all, check if BRF+ framework is activated in your system. In order to use BRF+ the following services need to be activated through transaction SICF:
You can launch BRF+ UI afterwards by entering t-code BRF+ or BRFplus.
Now I will show how BRF+ needs to be configured, tested and integrated in SAP. The steps in the BRF+ UI will consist of the follow steps:
- Application creation
- Data Object Creation
- Function Creation
- Decision Table Creation
- Ruleset Creation
- Assigning ruleset to function
- Simulation of the Business Rule
First step in BRF+ is to create the application.
I highly recommend adding a text in the documentation field containing the purpose of the logic and the point of the user exit. Otherwise it can be very hard to relate back to the program where the user exit is used.
Create Data Object
First create a data object element. By right clicking on the application, a menu will appear where you can create the data object element.
In this particular case we need the following 2 data elements:
- Account Assignment Group
- GL account
Account Assignment Group
Make sure that you create the element from a DDIC object.
Under the domain values you will see all possible values which are coming from the customizing tables:
In the same way create a Data object element for GL Accounts. Make sure to create it from DDIC object HKONT!
In the domain values you will again see all possible HKONT entries in the system:
Next step is to create a function:
At the time you are creating a Function, the Expression is not yet created. So don’t be confused after seeing this printscreen. Currently you only need to assign the Component ‘Account Assignment Group’ and the Result Data Object ‘GL’.
The Function will be created and will generate a unique ID. We will need this ID at a later point when creating the user exit in SAP.
Create decision table
Now we can create a decision table where we define the input and output parameters. In this use case the Account assignment group is used as an input. Based on the group the decision table will return a GL account accordingly.
Create an Expression with Decision Table:
In the Context overview check the following:
The rule set will be assigned to the function we have created in the first step. As you can see the set contains a rule that change the GL account after processing decision HKONT.
Under Context check the following:
Assign Ruleset to Function
Check and assign the ruleset to the Function.
Simulate the Business Rule
It is possible and recommended to simulate the Rule Set to see if your function is working fine. Go to the Function and navigate to the simulation screen:
Select the Continue button:
In the below screen you can select you input parameter, being the Account Assignment Group:
I have selected Y6 as input parameter:
Check if the output is in line with your decision table and expectations. In this case the function is successfully tested. Output is as expected.
Create Substitution in SAP
After we have finalized the configuration in BRF+ we need to call up the business rules somewhere from a program in SAP. The business rules in BRF+ can be called up from any program in SAP depending on the business requirement. In this use case I will create an substitution with user exit.
The user exit in function pool ZRGGBS000 will be handled in the next chapter.
Define User Exit
I will create a user exit in the function pool for the substitution I have defined.
Which Substitution function pool is used in your system depend on your configuration. You can check which function pool is assigned to substitutions in transaction GCX2.
My exit Look like below:
I select the Account Assignment Group (KTGRD) from table Sales Document: Business Data (VBKD).
In the BRF+ Configuration steps I have mentioned the ID in the Function which is generated by BRF+. Now I need the number from the rule set to include in the ABAP code.
Enhancement to enable HKONT substitution
Program GBTAMFIJ is a Generated module pool for substitution output. In most cases this pool is preventing you from substituting BSEG-HKONT. Even adding BSEG-HKONT to the substitutable fields in customizing, will not help without enhancing this function pool.
First include HKONT in table GB01
In standard system BSEG-HKONT is excluded from substitution. In transaction SM30 you can maintain table GB01 with maintenance view VWTYGB01. In the below entries uncheck the ‘exclude’ box.
Check function pool GBTAMFIJ for substitution output if BSEG-HKONT is included in the list. If not implement the below enhancement to include BSEG-HKONT here.
I hope you have enjoyed this post and looking forward to read about your toughs or possible use cases with BRF+ in the comments section.