Referring to a recent blog post
(Is MS Excel driving your Transportation and Logistics processes?) on Novigoâs SAP Transportation Management (TM) projects that make use of BRFplus, this blog posting aims to provide a glimpse into the world of business rules. Certainly more technical than other blog postings, the reader will get an understanding of how SAP allows TM customers and partners alike to expand the TM usage to a high degree via a standard rules framework.
BRFplus (Business Rules Framework plus) is a powerful ABAP-based Rules Engine, which is used in many SAP (including ECC, CRM) and other custom applications. It has been integrated into SAP TM and works its magic under the shadow of the more popular âconditionsâ. Conditions in SAP TM use BRFplus as its origin to process such business rules. As a result, BRFplus has brought the ABAP code world to the end-user and empowers them to process complex business rules via an intuitive User Interface (BRFplus Workbench) â at the same time, it reduces the need for IT organizations to develop, customize and configure on top of the standard delivered SAP content.
When a condition is created in TM, the data access definitions form the context data (elements) that are passed into BRFplus for rules processing (in simple terms the âInputâ). The origin of the condition describes the type of âfunctionâ that will be created in BRFplus. BRFplus relevant condition origins are: âCondition based on BRFplus Expressionâ or âCondition based on BRFplus Decision Tableâ. Conditions created using either of the two origin types will create a corresponding BRFplus application and its corresponding function type, which can further be used to model complex business rules. For the advanced reader, it is important to understand that BRFplus dynamically creates ABAP coding at runtime, which is also described as âGenerated Codeâ.
A condition based on the BRFplus Decision Table origin type is the most simple and widely used condition in SAP TM. When created, this condition creates a decision table in BRFplus that processes simple âIFâŠTHENâ statements for every row of data. Data access definitions form the âIFâ(context data) part of the decision table and the result data object identified when the condition type is created forms the âTHENâ (result of the decision table row). A simple business scenario could be the following: IF âERP-SD Shipping Conditionâ EQUALS âExpressâ THEN result IS a carrier type âParcel Carrierâ.
A Condition based on BRFplus Expression is a more generic form of a BRFplus application. It creates a âfree-styleâ BRFplus application that only has the data access definitions passed into it and can then be used to model all the business rules. The Expressions type of condition is used to create a BRFplus application that enables the processing of multiple decision tables within rules/rule sets as opposed to a Decision Table-based BRFplus application where only one decision table can be used to process the entire logic.
Via the process controller (the standard SAP TM way to call Planning Methods or Heuristics), a standard strategy can be used to make a call to BRFplus with the use of a few lines of code. The strategy and methods to be used are entirely dependent on the business use case.
APPLICATION
An application works as a container/folder that stores other objects types such as Functions, Decision Tables, Rulesets, Formulas, etc. The application also determines the behavior of the objects that are contained within it. For example, versioning of contained objects can be set at the application level.
Some of the most commonly used object types within an application are briefly described below:
FUNCTION
Creates the context/ provides the access to the data access definitions created in the conditions to process the rules within it. For example, if the desired result from the processing of a BRFplus application is a Carrier, then the result data object will be the field âCarrierâ and the field âshipping conditionâ used for the determination of the carrier will form the context data object.
RULESETS
Rulesets are a collection/grouping of rules âfor better organization, structuring, and managementâ (Ziegler and Albrecht p.26). They are processed during runtime when the specific function that they are assigned to is processed during a call to BRFplus. For example, in the business scenario above, if the Shipping condition is âExpressâ then the result is a âParcel carrierâ, ELSE processes a decision table to find the best suitable carrier based on other input parameters (Example, Source & Destination Locations and weight breaks).
EXPRESSIONS
Expressions form the ââŠbuilding blocks of rulesâ (Ziegler and Albrecht p.215). The various expression types within BRFplus enable the processing of a specific logic. For example, Decision tables are expression types that enable the sequential processing of âIFâŠTHENâ statements. To build on the earlier example, IF âERP-SD Shipping Conditionâ EQUALS âExpressâAND âCountry of Destinationâ EQUALS âAustraliaâ THEN result IS carrier type âParcel Carrierâ and service level type âService 2 Day Airâ.
Formulas allow the processing of mathematical and logical rules and Loop statements repeat the processing of a set of rules, which can include the processing of other expressions. For example, miscellaneous formula functions such asâConvert Amountâ can be used to convert one currency into another currency. Multiple currencies can be converted into a standardized currency.
SIMULATION
The simulation tool within BRFplus allows the user to analyze and test the logic with test data. This provides tremendous flexibility to the users to test the rules before they are deployed into the productive system environment.
The examples above provided some simple ideas where BRFplus can be an applicable technology to enhance the standard solution footprint. Transportation as such is not a complex business process; it typically involves shipping goods from point A to point B. However, the involved parties and stakeholders, security regulations, service provisions, and many other requirements create an enormous amount of rules for how a particular transportation process shall be carried out. Very often the software vendor will not be able to provide out-of-the-box features for every single business rule.
BRFplus is a very elegant approach that SAP now delivers to model such specific business rules and bring the maintenance of the business rules to the End User while the modeling is still conducted by SAP application and technology consultants.
We plan to blog further on creating data access definitions (input data), conditions (for rules processing), and how they all tie in together to create a BRFplus application.
Reference: C. Ziegler, T. Albrecht, BRFplus Business Rule Management for ABAP Applications