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 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 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 is entirely dependent on the business use-case.
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:
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 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 Shipping condition is ‘Express’ then result is a ‘Parcel carrier’, ELSE process a decision table to find the best suitable carrier based on other input parameters (Example, Source & Destination Locations and weight breaks).
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.
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 a point A to a 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 ApplicationsBack