The applications of the SAP Business Suite package, such as SAP ERP, CRM and SRM allow implementation of complex business processes, supporting enterprises practically in all areas of their business activities. The impressive adaptation possibilities of the SAP Business Suite package applications to the most complex requirements of business processes are widely known. The applications of the SAP Business Suite package can be configured using standard tools e.g. creating entries in hundreds of control tables; they can also be enhanced by logic implemented in the ABAP extensions specific for a given enterprise.

Starting from the ABAP application server version 7.02, a new tool increasing possibilities to adjust the SAP Business Suite package applications based on business rules, so called Business Rules Framework Plus (BRF+), is available. Introduction of a Business Rules Management System (BRMS), such as BRF+, into the ABAP application server suits the current direction of development of IT systems.

Business rules

Business rules are present in all enterprises and they assume various forms, e.g. they can constitute guidelines gathered in documentation available on the company’s portal, particular algorithms implemented in the IT system or tacit knowledge. Regardless of the form, business rules have a fundamental meaning for the operations of all companies.

There are numerous more or less formal definitions of a business rule. For example, according to Business Rules Group, which is an organization associating experts and defining standards in the field of business rules management, “a business rule is a statement which defines or constrains some aspect of a business. It is expected to ensure business structure or to control or impact business behavior.” In the context of IT systems, it is much more comfortable to assume a more technical definition, which states that “a business rule expresses certain limitations related to creation, update and removal of persistent data in an IT system.”

Examples of business rule applications:

  • calculating the credit rating of a person applying for a mortgage,
  • calculating the amount of a car third party insurance contribution,
  • calculating the product sales price,
  • classification of the outgoing bank transfer to the category/subcategory in order to analyze expenses,
  • assigning the right approval path to purchase requisition.

Business Rules Management System – BRMS

Business rules, used by IT systems, are maintained in the business rules management systems – BRMS. They are IT systems that allow defining, simulating, executing, monitoring and persistent storage of business rules. Basically, these types of systems consist of three components:

  1. environment for designing and maintaining rules (user interface),
  2. rule execution engine (interpreter),
  3. rule repository (persistent memory, rule database).

In the design environment, rules are defined using a predefined set of expressions. The design environment has a graphical user interface, which is convenient and intuitive not only for technical employees, but mostly for professional staff. Business rules are frequently expressed in a natural language understandable for people without technical background. The design environment also allows organization of rules, e.g. into easily managed catalogues. BRMS components are shown on the diagram below.

BRMS components

Application architecture

Over the last 30 years, the architecture of IT systems for business has been subject to continuous evolution. Old systems were built in such a way that everything contained in them (data, rules, processes) was implemented in one monolithic component. The first revolution involved the introduction of database management systems (DBMS) on a large scale. Databases introduced data outside the systems that allowed their independent storage. The revolution occurring currently introduces processes and/or business rules outside the systems, e.g. into dedicated BPMS (Business Process Management Systems) and BRMS. This process was presented on the diagram below.

Evolution of the application architecture

An essential advantage of separating rules from processes (as well as the application code) involves the possibility to manage them in a fully independent way. Processes and the application code do not have to be modified when business rules change. Business rules have a tendency to change frequently, as the environment in which businesses operate nowadays is remarkably dynamic. Market conditions change, as well as legal regulations, etc. If we do not have a BRMS, support of IT specialists is necessary. Having the BRMS, we can involve professional staff in the maintenance and continuous adaptation of business rules.

Road to BRF+

The SAP systems have always been configurable. A key functionality was and still is a possibility to configure them using configuration tables, gathered in the so-called IMG (Implementation Guide). Very complex requirements can be implemented using the ABAP extensions. For years clients have been able to take advantage of the entire spectrum of tools and frameworks which have a lot in common with business rules, e.g. validations and substitutions in FI/CO/PS modules, condition technique present in MM/SD modules used to determine price conditions and output information (printouts, e-mails, etc.) or rules modelled in the workflow templates, controlling e.g. whether a given workflow task is sent.

Noticing changes in the way of thinking about business rules in IT systems, SAP AG made a decision about the necessity to implement a completely new, fully-fledged  BRMS that would be appropriately flexible and transparent. This new tool was supposed to most of all guarantee quick implementation of business rules, allow continuous optimization and adaptation of business logic to changing external conditions, decrease dependency of professional staff on IT specialists, engaging them in the process of maintaining business rules. BRF+ was created in such a way and it is the first fully-fledged BRMS completely integrated with the ABAP application server.

New SAP systems (e.g. SAP TM – Transportation Management), as well as new functionalities made available within the EHP packages for the SAP ERP system (e.g. a shopping cart in SAP ERP similar to the one from SAP SRM) are more and more frequently based on the maintenance of business rules in BRF+. An increasing broader application of BRF+ rules suits the long-term strategy of SAP AG.

The diagram presenting the latest concept of the application architecture for the SAP ERP system was presented in the diagram below. The processes are implemented by the SAP ERP system modules, such as FI, CO, PS, MM, PP, SD, etc. However, the processes use business rules modelled in the BRF+ environment in key decision points. All data (both process data, as well as rules data) are stored in a separate database.

Illustrative SAP ERP architecture with a separate BRMS system – BRF+

BRF+ as the BRMS

BRF+ as a fully-fledged BRMS consists of three components described before:

  • environment for designing and maintaining rules (BRFPLUS or BRF+ transactions),
  • rule execution engine (ABAP API to execute rules),
  • rules repository (a dedicated set of tables in the SAP database).

The BRF+ environment for designing and maintaining rules can be executed through the BRFPLUS or BRF+ transaction codes. Transaction execution redirects the user to the web browser in which the BRFplus Workbench application is run, implemented in the WebDynpro for ABAP (WDA) technology. The BRF+ environment for designing rules (screenshot 1) has the following functions:

  • it supports defining and managing all BRF+ objects: applications, functions, rulesets, rules, expressions, and actions. The BRF+ objects can be organized into catalogues (further in the article the terms are explained);
  • it can be executed on the workstation where SAP GUI is not installed;
  • it is fully integrated with the ABAP dictionary which allows the use of the same data elements used by the SAP applications, as well as the use of the same F1/F4 support mechanisms;
  • it can be executed in two modes: expert (provided for technical employees/consultants) and regular (provided for professional staff);
  • it makes numerous tools available, e.g. import/export rules into XML files, rules simulation, generating web services/RFC modules to execute rules, analysis of the transport requests, etc.

Screenshot 1

[1] Environment for designing and maintaining rules – BRFplus Workbench

The BRF+ rules execution engine is a set of ABAP tools which allows calling and interpreting the BRF+ rules in a programmatic way. Calling the BRF+ rules from the application code takes literally several lines of the ABAP code. Business rules modelled with BRF+ can be made available outside the SAP system in the form of web services, as well as in the form of remote function modules.

The BRF+ execution engine has two operation modes: interpretation mode (slow) and generation mode (fast). In the interpretation mode, the BRF+ rules are read and interpreted in their initial form. In the generation mode, the modelled logic in the form of the BRF+ rules is first converted in the background into a clear ABAP code and then – after the conversion – it is interpreted. Moreover, the BRF+ rules are executed in the context of the time stamp (BRF+ supports rules versioning).

The BRF+ rules are stored in dedicated tables of the SAP database, which in full constitute the repository. The repository is managed by the BRFplus Workbench application. The repository is constructed in such a way that it allows management of the BRF+ objects in the following way:

  • the BRF+ objects can be stored client-depended or client-independent;
  • the BRF+ objects can be transportable or they can be local;
  • the BRF+ objects can be imported/exported from/into XML files;
  • access to the BRF+ objects is controlled by standard authorization and blocking mechanisms;
  • the BRF+ objects can be versioned.

BRF+ objects

Business rules are defined in BRF+ using so-called BRF+ objects. In the table, a list of all BRF+ objects was included together with a description of their functions.

BRF+ objects
BRF+ objectFunction of the BRF+ object
ApplicationAn application is a top container containing defined business rules. Its purpose is to group subordinate BRF+ objects in one related entirety. Within the application, some default data and limitations for subordinate BRF+ objects are defined. In the system, many various BRF+ applications can be defined.
FunctionA function is the most important BRF+ object and it represents a so-called decision service, which is the element that is in fact invoked by the application. The function has a so-called context within which there is a set of input data. The function also has exactly one result data object (containing the result of the execution of the rules). The function can be implemented in two different ways: in the functional and event modes. In the functional mode, it is possible to use exactly one expression to model the required logic, e.g. a regular mathematic formula. In the event mode, the function is assigned one or more rulesets. In the event mode, it is possible to model an arbitrarily complex business logic. Each BRF+ application can have numerous BRF+ functions.
Data objectA data object is a carrier of a particular value in BRF+. Elementary, structural and tabular data objects are at the disposal. It is possible to process numbers, quantities (numbers referring to a measuring unit), amounts (numbers referring to a currency) and texts, as well as dates/times (time stamps).
RulesetA ruleset is a container containing a set of rules. Each ruleset has a priority assigned to it: from 01 (highest) to 99 (lowest). If the function in the event mode has more than one ruleset assigned, then first of all they are processed in the order of the assigned priorities, and secondly the processing is stopped, if the set with a higher priority generated the correct result. Thanks to this kind of organization, it is possible to model the hierarchical rules, e.g. more precise rules, specific rules have a higher priority, and rules that are more general have a lower priority.
RulesA rule is an element included in the ruleset. A rule models the fundamental conditional logic, such as:
IF <X> THEN <Y> ELSE <Z>
Instead of <X> an expression with a logical value is inserted: TRUE/FALSE.
Instead of <Y> one or more BRF+ expressions/actions are inserted.
Instead of <Z> also one or more BRF+ expressions/actions are inserted.
ExpressionsAn expression is a fundamental BRF+ element that allows modelling of business rules. The following expressions are available: logical expression, value range, constant, random number, case, formula, decision table, decision tree, search tree, DB lookup, loop, table operation, dynamic expression, function call, procedure call, connector with the external BRMS system, XSL transformation.
ActionsAn action is a fundamental BRF+ element that allows executions of some tasks outside the BRF+ environment, which do not constitute the content of the business rules. The following actions are available: log message, send e-mail, start workflow, workflow event.

Example

In order to demonstrate how business rules implemented in BRF+ work, we present a simple example of calculating the final sales price of a given quantity of materials (the presented example has only an illustrative nature and it is not related anyhow with the SD module functionality).

The first BRF+ object, which has to be created, is a BRF+ application, e.g. called ZKU_PRICE_DETERMINATION. On screenshot 2, some default data is visible, e.g. object/sub-object of the standard application log in which messages will be saved (ZKU_BRF_TESTS/ZKU_BRF_SUB_TESTS).

Screenshot 2

[2] Definition of the ZKU_PRICE_DETERMINATION application – default settings screen

Another BRF+ object is a BRF+ function called PRICE_DETERMINATION that will implement the decision service involving calculation of the final sales price based on the material number and its quantity. On screenshot 3, it is visible that the function will work in the event mode (which means that it is necessary to assign the ruleset). In addition, the context is presented (input parameters: material and quantity) and the result data object (final sales price).

Screenshot 3

[3] Definition of the PRICE_DETERMINATION function – signature screen

One ruleset called DETERMINE_PRICE (screenshot 4) was assigned to the function. The ruleset is correctly defined, it is active (green status) and it isexecutable.

Screenshot 4

[4] Assignment of the DETERMINE_PRICE ruleset to the PRICE_DETERMINATION function

In the DETERMINE_PRICE ruleset, there are exactly two rules (screenshot 5). The first rule is responsible for retrieval of the base price of the material given at the function input. The rule uses a decision table called DETERMINE_BASE_PRICE (screenshot 6). If the base price of the material was found, the second rule performs the logic of calculating the final sales price; if the base price was not found, the NOTIFICATION action is executed which sends an e-mail to the person responsible for maintaining business rules of a given application.

Screenshot 5

Screenshot 6

In the block responsible for calculating the final sales price, first a discount is determined on the basis of a search tree called DETERMINE_DISCOUNT (screenshot 7), and then the final sales price is calculated by the FINAL_PRICE formula (screenshot 8). The last step involves saving the message in the application log by the FINAL_MESSAGE action.

Screenshot 7

Screenshot 8

[5] The DETERMINE_PRICE ruleset – containing two rules used to calculate the final sales price

[6] The DETERMINE_BASE_PRICE decision table

[7] The DETERMINE_DISCOUNT searching tree

[8] The FINAL_PRICE formula

For the material 12345 and the quantity of 15, the presented BRF+ function would work in the following way:

  • rule no. 1 would return the base price of 80 EUR;
  • rule no. 2 would firstly determine a discount of 10 (i.e. the value of the discount in %), and then it would calculate the final sales price from the formula:

80 EUR * 15 * (1 – 10/100) = 80 EUR * 15 * (1 – 0.1) = 80 EUR * 15 * 0.9 = 1080 EUR.

The environment for designing and maintaining the BRF+ rules contains a tool for immediate simulation of the designed rules. Introducing appropriate values of the context, having activated the simulation, the system presents the final sales price; which is an exact price as the one calculated above (screenshot 9).

Screenshot 9

[9] Simulation of the BRF+ PRICE_DETERMINATION function

Calling any BRF+ function in the ABAP code is very simple. In the environment for designing and maintaining the BRF+ rules, it is possible to generate the entire ABAP code necessary to implement such a call (screenshot 10). It is enough to ask a programmer to integrate the call in the right place, e.g. in the BAdl type ABAP extension.

Screenshot 10

[10] Generated ABAP code which allows calling the presented BRF+ function (in the red frame there is actual invocation of the BRF+ rule engine)

Exemplary application of BRF+ instead of ABAP extensions

BRF+ can be applied to implement numerous different business requirements usually implemented using classic techniques which are not effective or flexible, which lack transparency and require knowledge of programming. The following elements can be replaced with BRF+:

  • non-standard configuration tables, especially those which are frequently changed and have hundreds of records (the decision table expression allows simple reloading of the content from BRF+ to MS Excel and back);
  • never-ending sequences of conditional instructions (IF-ELSEIF-ELSE-ENDIF) which reflect a complex business logic;
  • extensions used to send e-mails in the background;
  • extensions performing complex mathematical calculations;
  • classification used to determine approval paths for purchasing documents;
  • conditions controlling the course of workflow processes (SAP Business Workflow environment was even enriched with a special type of the BRF+ task);
  • validations of fields in master data records, e.g. materials or vendors, etc.

Benefits of applying BRMS, especially BRF+

There are many benefits of applying BRMS. The highest priority benefits include most of all:

  • impressing flexibility of solutions based on business rules,
  • controlled automation of business decisions made by the system,
  • significantly improved visibility of business rules for professional staff,
  • significantly quicker and easier implementation of changes in the existing business rules,
  • decreased costs of maintaining and adapting business rules to changing conditions

BRF+ as a fully-fledged BRMS has the following advantages:

  • it is available in all SAP systems based on the ABAP application server from version 7.02;
  • it is available within the framework of the standard license and it does not require any additional costs (apart from implementation costs);
  • it practically does not require any initial configuration (apart from activation of several services);
  • it can be easily integrated with the existing ABAP extensions or it can even replace them;
  • it is a stable and mature technology that has been present in the system for several years.

Future…

SAP AG has not stood still and they have made available another product supporting the application of business rules – SAP Decision Service Management (SAP DSM). SAP DSM is based on BRF+, but it goes further. BRF+ allows managing rules within one system/one system landscape (DEV>QAE>PRD). SAP DSM allows managing business rules in multi-system system landscapes. However, this is a subject for another article.

I have used a book by Carsten Ziegler and Thomas Albrecht: BRFplus – Business Rules Management for ABAP Applications (SAP Press, 2011).

BCC offer
Based on many years of experience in SAP projects and the competencies of our consultants, BCC (now All for One Poland) offers provision of the following services related to the implementation of Business Rules Management Plus (BRF+) in the SAP Business Suite solutions:
– projects within which implementation of decision services and ABAP extensions based on the BRF+ technology is included
– projects of refactoring the existing ABAP extensions which are problematic in their maintenance and which require frequent changes and involvement of ABAP programmers
– trainings for the client’s technical personnel in the field of designing, modelling and using the BRF+ objects