8/10/2019 BRFplus - Training Material http://slidepdf.com/reader/full/brfplus-training-material 1/127 SAP Technical Business Rule Framework plusThis presentation is for internal use only and not intended for external distribution. Its contents must be held in confidence.
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
1. Figure Shows a simplified diagram for loan approval process.2. For Each Steps, the business rules are depicted.3. Quality and efficiency of the management of the rules becomes crucial for
Business Rules - Types of Business Rules — A Compilation
No matter how simple or complex the business rules are, being able to create,maintain and track the business rules that are governing the operationalprocesses of an organization is critical to its success.
An Effective way of managing business rules is a Business Rule Management
Separating the business rules lifecycle from the application developmentcycle enables more timely responses to business Changes
For Transparency to non technical users and to enable to perform changesthemselves, the BRMS needs to provide a collection of rule representationthat can be understood by all users groups.
1. Decision Tables provide a very structured and organized view of interrelated businessrules.
2. Contain condition columns with each cell in the column being part a particularcondition.
3. If all conditions of a row match, the results from the corresponding result column cellsare returned or actions are performed.
4. Decision tables are very popular because of their spreadsheet like nature and theability to exchange data easily with office applications such as Microsoft excel.
1. Formulas are business rules that produce a value according to a specifiedmathematical algorithm.
2. BRMS usually provides a set of built-in functions for usage in formulas such asfor financial mathematics.
3. A scorecard is a special form of table that examines different properties orcharacteristics or an object or transaction and assigns weights based on thevalues.
4. All underlying weights are added to arrive at an overall score, which can becompared to other scores for a rank based decision.
Definition of a Business Rule Management System (BRMS)
“A BRMS is a software system used to define, deploy, execute, monitor, and maintain the variety and complexity of decision logic inthe form of business rules that are used by operational systems withan organization”.
A BRMS Consists of the following three components:
• Rule Authoring Environment, for defining and maintaining business rules• Rule Repository, for the storage of business rules• Rules Engines, for the execution of business rules by application code
Business Rules - Evolution of Business Application Architecture
1. Use of a database management system (DBMS) helps separate application data
and application logic
Tools optimized for data management
2. Use of a business rule management system (BRMS) Business rules should be considered early in the application lifecycle Tools optimized for business rules management, targeting also non-technical user
groups Once the BRMS services are defined and plugged into the application, rules changes
do not require programming skills Programmers continue to develop the remaining application logic, while business
experts are empowered to create and maintain the business rules
“The term BRFplus workbench refers to the web-enabled ruleauthoring and management tool that provides an environment withcommon paradigms for the maintenance, testing, and managementOf business rules content in BRFplus”.
Workbench Includes:-1. Search and navigation capabilities to find specific BRFplus objects.
2. Editors to create & change all the different types of BRFplus objects.(Such as
Functions, Data Objects, and Rulesets, expressions).3. Objects can be transported and deleted.
4. Additional Tools such as simulation of rules, detection of unused objects, creationof web services and XML export and import.
An Object can be always be visualized in two modes, change or Display Mode.
1. In change mode the object can be modified, and it becomes inaccessible forother users and certain activities. The Display mode doesn’t lock the object and itis not possible to change it.
2. Furthermore each object can have an inactive or active status. Only activeobjects can be used in rule determination
3. This Information is Displayed in the Object Header as shown below.
4. Other Common Activities are displayed in the Object Toolbar.
Versioning enables change tracking and time dependant use of rules.
1. Generally an object can always have two versions active and inactive2. Only Consistent (error-free) objects can be activated.3. Only active objects can be processed.4. Versioning can be individually switched on or off for all BRFplus objects. It can
also be switched for the objects contained in an application5. If versioning is switched on, activating an object saves a version for the time of
activation. This version can be processed at runtime using a timestamp6. General Section allows to toggle the versioning7. The Tab version displays further information including an overview of all versions
1. A Function is the Link between Application Code & the Business Rule.
2. A Function determines how rules are processed. It serves as an entry point thatcalls assigned Rulesets
3. To set this in motion. A function can be called from following sources:
4. It can be run directly in the BRFplus Workbench (Button “Start Simulation”) or becalled programmatically from any application using ABAP API RFC Web Services Other BRFplus objects
5. A Function takes parameters from a call and processes the rule logic throughother BRFplus objects to return a value. Functions can be called directly fromapplication code or from certain BRFplus objects.
The Signature defines what type of data will be processed by theFunction.
The Input data is defined in the signature. It is in charge of:- Define what type of data the function is expecting from the caller.- And defining what type of data is made available for the rule processing
The result data is also defined in the signature. It defines what is returned to thecalled.
1. The Signature Defines Input and output parameters of the function2. The Signature consists of the context and the result data object.
3. The context consists of data objects that are passed from the caller as primarilyoptional parameter. Subsequent rule logic can be read and write on these dataobjects.
4. The Result data object contains the results of the rules processing. It is possible toreturn a single element, a structure or a table.
1. BRFplus has a powerful feature of code generation. This means that the rule logicis generated as code. This results in high performance at runtime. BRFplus tries togenerate functions an their related objects whenever possible.
2. The alternative execution mode is called interpretation mode. Where each object iscalled at runtime and interpreted individually. This mode is usually slower ( One ortwo orders of magnitude )and is only executed when code generation is not
The ruleset Header handles information that is relevant to allcontained rules
The ruleset Header has the following features:-
1. It can be enabled or disabled. This affects the processing of all the containedrules.
2. Additionally, a precondition can be assigned, even if the ruleset is enabled. Thiscan be based on the context parameters or other values such as the systemstatus.
3. The Ruleset Header can define additional ruleset variables, which are madeavailable to the contained rules as temporary context parameters.
BRFplus objects share a common set of attributes and properties
Attributes are generated or derived at creation time and cannot be changed.
Properties might be derived from the associated application, but can bechanged.
Both attributes and properties are displayed in the “General” section of the screen.This section can be expanded to show more attributes andproperties.
1. Data objects make it possible to keep track of values during rule processing.
2. Data objects carry values in BRFplus. They can be bound to existing DDIC-types,from which they derive characteristics such as type, size and texts. Thesecharacteristics can also be set individually in case that no DDIC binding is needed.
3. In Some cases the creation of a data object is not needed. Instead a default dataobject can be used.
4. Different Kinds of data objects make it possible to tailor the design of a ruleapplication.
5. Data Object determines the type of data that can be handled by other BRFplusobjects and serve as data carriers.
BRFplus Workbench - Data Objects: Types of Elements
BRFplus Workbench Data Objects: Element Properties
Text Element as an Example data object
This screen shows the Element properties tab for the Text element.It is divided into three sections1. The first section enables the binding Of a DDIC type.
2. The second section defines the element type and what comparisons are allowedfor this element (For example: it might not be allowed to use a “Larger than… “operator for a specific number element).
3. The last section defines length of the Data element.
BRFplus Workbench - Data Objects: Element – Domain Values
BRFplus Workbench Data Objects: Element Message Check
1. Check Message behavior can be adjusted for each element.
2. Whenever a BRFplus object is checked for consistency, a message is displayedfor the check results. The type for these messages can be defined in theadditional properties tab.
3. This can apply for :Existence checks (whether a value is among the domain values for the element)Comparison checks ( whether the used operator is allowed for the element)
• Calling a BRF Function from ABAP1. The ABAP environment can be used to call a BRFPlus Function.
2. A Possible way to code this is presented below using BADI’s, Program exits,Function Modules can be used as needed3. Use Standard Program FDT_TEMPLATE_FUNCTION_PROCESS to
• Calling BRFplus Function via an ABAP Function Module
1. A Function Module for a RFC can also be generated using the web servicegeneration feature. This function module can be called from other systems orapplications using the RFC protocol
Procedure CallThe procedure call expression type enables the execution of an ABAP static method
or function module. The expression is thus able to pass the parameters, as well asreceive the results, making it possible to implement powerful logic.
DB LookupThe DB Lookup expression type enables the access to database tables to check orretrieve data according to a flexible construct of parameters.
Table operation
The table operation expression type allows the handling of table objects through theexecution of common operations such as deletions, row count determination, sortingand the determination of averages, among many others.
BRMS Connector Expression Case Expression Constant Expression DB Lookup Expression Decision Table Expression Decision Tree Expression Dynamic Expression Formula Expression
Function Call Expression Loop Expression Procedure Call Expression Random Number Expression Search Tree Expression Step Sequence Expression Table Operation Expression Value Range Expression XSL Transformation Expression
The Decision Table expression type offers a powerful way to Expressbusiness rules:
1. Decision tables primarily consists of rows and columns. The columns are furtherdivided in condition columns and results columns.
2. When a Decision table expression is called, every row is processed in sequence.In each row, every condition column is processed from left to right. If the conditionin each input column cell of a row is met, the field values in the result columns arereturned.
3. It is possible to enter expressions of direct values in these cells. This enables theuse of deep, or nested, decision tables.
4. If is also possible to evaluate the values in each cell by using comparisonoperators, value ranges and pattern.
The Detailed section gives access to table operators with which rowscan be inserted, copied, edited and removed. The Table rows can be
moved and arranged as well, so that the most specific conditionare tested first. Finally table can be exported and imported to andfrom excel, and the table settings screen can be accessed.
A wide array of calculations on data objects is made possiblewith the formula expression type
1. This includes mathematical operations as well as a large selection of formulafunctions. Context parameters, expressions results and direct values can be usedas well in these formulas.
2. A formula can be created with building blocks, or using direct text entry in expertmode.
3. The available formula functions can be filtered by categories or search patterns,and are documented with an explanation on purpose and syntax of the function, itis possible to define own formula functions.
1. A result data object can be defined for the formula expression. The input areshows the formula itself. In simple mode, the input cursor can be moved to insertnew operators and operands. These can also be deleted.
2. A switch to expert mode is also possible. In Expert mode it is possible to puttogether formulas using the object IDs and parameters in free text mode.
The case expression type maps input values to a defined set ofoutput values
1. This expression tests for the value of an expression or context parameters amonga list of defined cases. If one of these cases applies, its corresponding returnvalue is given back
The Decision Tree is a binary tree that is traversed in sequence.
1. Each level has a condition that can be evaluated to true or false. The next levelcan be a condition or the end result. This result can be a value or an action
Action are special type of expressions that are similar toexpressions, but do not return a result value
1. They trigger changes and notifications outside of BRFplus, using contextparameters or nested expressions as inputs.
2. The execution of action can trigger the execution of subsequent actions.3. Action are instances of action types.4. Action can define follow-up actions that will be executed in the defined order.
Start Workflow: The start workflow action type enables the rule to trigger a specificworkflow in the system. A workflow can then be used to trigger other tasks or invoke
1. BRFplus provides a set off supportive tools that is accessible via the tools menu.2. To Access specific tool, the user must have the required authorization.
Authorization object FDT_WORKB, field FDT_WB_ACT is used for this purpose.3. Each tool corresponds to specific numeric value for this field. The values arelisted in the documentation for the field in the transaction SU21, Alternatively theycan be retrieved from the domain FDT_WORKBENCH_ACTIVITY.
1. The simulation tool can also be used for mass testing.2. It supports import test data for the context parameters from a Microsoft excel
sheet.3. For importing there is a limitation that table data objects are not supported. Iftable data objects are part of the function context the import button is disabled.
4. When Button is clicked on , the section CONTEXT EXPORT/IMPORT that isdepicted as shown below
The Web service generation tool can be invoked in the workbencheither from the TOOLS menu or in the function UI from the toolbarof the DETAIL section as shown below
1. The BRFplus XML export and import functionality lets you transfer one or moreBRFplus objects from one system to another, assuming that both systems supportBRFplus.
2. Only the current active version of the BRFplus objects can be exported.3. An XML file is generated for the exported objects. From this file, the objects can be
imported to the target system.
Need for XML Export and Import Although BRFplus provides transport functionality, the need for XML exportand import arises in the following scenarios:
BRFplus content needs to be transferred to other SAP systems that arenot connected to the SAP transport system.
BRFplus content needs to be published to non-SAP systems.BRFplus content needs to be corrected with the use of an SAP note.
SchemaExternal and internal schema types are supported by BRFplus. The schematype information is stored in the root element FDT in the attribute
BRFplusSchema.Internal Schema Type
This is the default schema type. The names are capitalized and anunderscore is used as a word separator. Also, the values are abbreviationsof the actual description. For example,
The names are formatted according to the upper camel case scheme. Thereis no underscore separating the words. The values are actual description ofabbreviations. For example,
1. The XML import is internally handled similar to import of a transportrequest.
2. An ID starting with $X2 for a virtual transport request will be generatedand displayed in the success message.3. The ID allows tracking the origin of the imported object version.4. An Alternative to the tool in the workbench is report
FDT_XML_IMPORT.5. In addition to the standard XML import, it supports a “repair mode” to fix
A remote function call always cause some overhead with respect to resources and
Runtime. Data has to be packaged, sent over a network with unknown traffic andunpackaged again
Calling remote function module asynchronously usually causes further delays
Web services require more memory and processing resources than remote functionCalls
Note: The overhead for remote communication can be reduced significantly if it ispossible to bundle multiple BRFplus function calls into one remote call.
If the Functions is called Locally, there are two different approaches that mainlyinfluence the performance.
1. Method IF_FDT_FUNCTION~PROCESS can be called for an object instance ofthe corresponding function.
Advantage: This is easy to implement and understand.Disadvantage: It requires loading the function and possibly the also related dataObjects from the database. Thus performs worst than the second approach.
2. The static Method CL_FDT_FUNCTION_PROCESS=>PROCESS can be calledwithout instantiating any objects. Context data can be passed by referencevariables. If the context data is formatted according to BRFplus specific data types,the rule processing can start with almost no delay
Difference call types roughly be ordered with respect to decreasing performance1. Local, Static method call2. Local method call on a function instance