Uploaded by Glaucio Coutinho

dlscrib.com brfplus-training-material

advertisement
SAP Technical
Business Rule Framework plus
Course Objectives
Overview
Business
BRFplus
Rule
– Workbench
Expressions
Action
Tools
Tips
Types
and Administration
and Tricks
Appendix
Hands
on exercises
2
Course Objectives
Overview
Business
BRFplus
Rule
– Workbench
Expressions
Action
Tools
Tips
Types
and Administration
and Tricks
Appendix
Hands
on exercises
2
Business Rules
What are business rules?
1.
2.
Business
Busine
ss rul
rules
es rep
repres
resent
ent corp
corpora
orate
te poli
policies
cies or busi
busines
ness
s gui
guidel
deline
ines
s
Busin
Bu
sines
ess
s rul
rules
es ar
are
e own
owned
ed by
by the
the bu
busin
sines
ess,
s, no
nott by
by IT
Example:-
1.
2.
If yo
you
u buy
buy th
thre
ree
e ite
items
ms yo
you
u get
get on
one
e fre
free.
e.
Dis
isco
coun
unts
ts fo
forr prem
premiu
ium
m cust
custom
omer
ers
s
3
Business Rules - Examples of Business Process
1.
2.
3.
Figure Shows a simplified diagram for loan approval process.
For Each Steps, the business rules are depicted.
Quality and efficiency of the management of the rules becomes crucial for
organization’s success
4
Business Rules - Examples from Across Industries
5
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 operational
processes of an organization is critical to its success.
An Effective way of managing business rules is a Business Rule Management
System (BRMS)
6
Business Rules - Representation
Separating the business rules lifecycle from the application development
cycle enables more timely responses to business Changes
For Transparency to non technical users and to enable to perform changes
themselves, the BRMS needs to provide a collection of rule representation
that can be understood by all users groups.
The most common approaches are:
1.
2.
3.
4.
5.
6.
Rules and Rulesets
Rule Flows
Decision Tables
Decision Trees
Formulas
Scorecards
7
Business Rules - Representation
1.
Pain Rules are also called IF-THEN rules. They are set of textual statements.
2.
They contain a condition part introduce by IF term, and an action part, connected to
the THEN term. When condition is true action is executed.
3.
Rulesets allow grouping of rules for better organization, structuring, and management
8
Business Rules - Representation
1.
2.
3.
4.
Decision Tables provide a very structured and organized view of interrelated business
rules.
Contain condition columns with each cell in the column being part a particular
condition.
If all conditions of a row match, the results from the corresponding result column cells
are returned or actions are performed.
Decision tables are very popular because of their spreadsheet like nature and the
ability to exchange data easily with office applications such as Microsoft excel.
9
Business Rules - Representation
1.
2.
3.
4.
Formulas are business rules that produce a value according to a specified
mathematical algorithm.
BRMS usually provides a set of built-in functions for usage in formulas such as
for financial mathematics.
A scorecard is a special form of table that examines different properties or
characteristics or an object or transaction and assigns weights based on the
values.
All underlying weights are added to arrive at an overall score, which can be
compared to other scores for a rank based decision.
10
Business Rules - Representation
1.
2.
Rule Flows define the graphically maintained sequence of execution steps in a
decision process, using tasks, branching, and iterations.
Tasks hold collection of rules or other representation formats such as decision tables
and decision trees.
11
Enforcing Business Rules — Conventional Methods
1.
To Solve this conflict, business rules needs to be considered in the architecture of the
application at the early stage.
12
BRMS - Overview
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 in
the form of business rules that are used by operational systems with
an 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
13
BRMS - Benefits of Business Rule Management System
14
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
15
SAP’s Business Rules strategy and Recommendations
Recommendation For Best Performance
“A Rule engine that integrates deeply into the execution stack of the
business application is generally recommended”.
For ABAP Stack use cases, BRFplus shipped with the business suite
is best suited.
For JAVA Stack use cases, BRM usually is best suited.
Example:-
1.
2.
Customer wants to leverage business rules in a business suite application or add
flexibility to a business suite process, BRFplus is a ideal choice.
Customer creating composite applications and process using SAP NetWeaver
CR, BRM would be usually appropriate.
16
Alignment NW BRM / BRFplus Alignment Themes
17
BRFplus Workbench - Overview
“The term BRFplus workbench refers to the web-enabled rule
authoring and management tool that provides an environment with
common paradigms for the maintenance, testing, and management
Of 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, creation
of web services and XML export and import.
18
BRFplus Workbench - Prerequisites
Activation of BRFplus is straightforward:Authorization
1.
Assign the role SAP_BC_FDT_ADMINISTRATOR to the user of the BRFplus
workbench.
WD Configuration
1.
2.
Activate the following ICF nodes for BRFplus:
Activate the WebDynpro services for BRFplus in transaction SICF



/sap/bc/webdynpro/sap/fdt_wd_workbench
/sap/bc/webdynpro/sap/fdt_wd_object_manager
/sap/bc/webdynpro/sap/fdt_wd_catalog_browser
SAP NetWeaver 7.0 enhancement pack 2 or higher
Note: In SAP note 1088717, you will find more information on how to
activate a node.
19
Benefits
20
Challenges
21
Benefits of BRFPlus
22
BRFplus Workbench - Starting the BRFplus workbench
1.
Transaction BRF+ and BRFplus were introduced in SAP NetWeaver 7.0
Enhancement Package 2.
2.
The Old Transaction was FDT_WORKBENCH used in earlier releases.
23
BRFplus Workbench - Starting the BRFplus workbench
1.
The BRFplus workbench is a
graphical user interface for the
design and maintenance of business
rules
2.
It is:
-Web based
-User Specific and enhance able
3.
BRFplus objects can also be
accessed directly through API.
4.
The Inclusion of customized and role
specific UI elements is possible.
24
BRFplus Workbench - Elements of Workbench
The BRFplus workbench consist of four areas
25
BRFplus Workbench - Navigation Panel
The Navigation Panel Offers four views:-
1.
Repository View: it provides access to all BRFplus objects
2.
Recently used View: Provides access to last 20 objects which have recently been
displayed or edited.
3.
Favorites View: it makes it possible to maintain and access a list of favorite
objects.
4.
Catalog View: It gives access to the catalog objects selected by the user
26
BRFplus Workbench - Object Manager
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 for
other users and certain activities. The Display mode doesn’t lock the object and it
3.
is not possible to change it.
Furthermore each object can have an inactive or active status. Only active
objects can be used in rule determination
This Information is Displayed in the Object Header as shown below.
4.
Other Common Activities are displayed in the Object Toolbar.
2.
27
BRFplus Workbench - Object Toolbar
1.
2.
3.
4.
5.
6.
7.
8.
9.
Navigate Back to the last displayed object
Toggles between change and display mode
Checks the object for consistency
Saves the object
Activates the object
Writes the object into a transport (object has to be non local, consistent and
activated)
Marks the object as obsolete
Marks the object for deletion, or deletes it
Click on.. You can also “reveals other actions:


Copy the object
Show the usage of the object in other objects
28
BRFplus Workbench - Object Lifecycle
BRFplus object Lifecycle can be defined through their status
29
Rule Creation Process
30
Rule Creation Process – Application Creation
31
BRFplus Workbench - Application Purpose
An Application is a container to group related BRFplus objects.
Rule logic that is implemented in BRFplus consists of several
BRFplus objects. In Order to group and manage them, they must
belong to an application
32
BRFplus Workbench – Application Creation
Two ways of creating an application
33
BRFplus Workbench – Application Creation
Name of the application
Short Text
As a local or transportable
34
BRFplus Workbench – Application Creation
Customizing (Client dependent) object or
workbench (client Independent) object
Or System
35
BRFplus Workbench – Access levels: Usage
Access levels determine how the object can be accessed by other objects.
By Default the accessibility is set to the most restrictive type ( Same application ). Access Levels
are defined in General Tab
36
BRFplus Workbench Versioning: Usage
Versioning enables change tracking and time dependant use of rules .
1.
2.
3.
4.
5.
6.
7.
Generally an object can always have two versions active and inactive
Only Consistent (error-free) objects can be activated.
Only active objects can be processed.
Versioning can be individually switched on or off for all BRFplus objects. It can
also be switched for the objects contained in an application
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 timestamp
General Section allows to toggle the versioning
The Tab version displays further information including an overview of all versions
37
BRFplus Workbench Versioning: Usage
Switch On Versioning
Versions Tab with Object Versions
38
Rule Creation Process – Function Creation
Next is to Create Function and define Signature
39
BRFplus Workbench - Function Overview
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 that
calls 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 be
5.
called programmatically from any application using

ABAP API

RFC

Web Services

Other BRFplus objects
A Function takes parameters from a call and processes the rule logic through
other BRFplus objects to return a value. Functions can be called directly from
application code or from certain BRFplus objects.
40
BRFplus Workbench - Function Signature
The Signature defines what type of data will be processed by the
Function.

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 the
called.
41
BRFplus Workbench - Signature Purpose
1. The Signature Defines Input and output parameters of the function
2. 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 primarily
optional parameter. Subsequent rule logic can be read and write on these data
objects.
4. The Result data object contains the results of the rules processing. It is possible to
return a single element, a structure or a table.
Importing
Exporting
42
BRFplus Workbench - Function Mode of Operations
The Mode of operation of functions determine how the rules are
processed.
Requires top expression;
used for more simple cases
Uses rule sets to trigger
processing
instead of top expression
43
BRFplus Workbench - Event Mode
1.
44
BRFplus Workbench - Functional Mode
45
BRFplus Workbench - Function Execution Mode
Functions can be executed using generated code.
1. BRFplus has a powerful feature of code generation. This means that the rule logic
is generated as code. This results in high performance at runtime. BRFplus tries to
generate functions an their related objects whenever possible.
2. The alternative execution mode is called interpretation mode. Where each object is
called at runtime and interpreted individually. This mode is usually slower ( One or
two orders of magnitude )and is only executed when code generation is not
available ( e:g when simulated )
46
Rule Creation Process – Rule Set Creation
47
BRFplus Workbench – Rulesets Purpose
1.
2.
3.
4.
5.
6.
A ruleset is a collection of rules.
A ruleset bundles a set of sequential rules into a logical unit.
A ruleset is the link between the function and the expression that implement the
business rule.
It contains information on when to trigger the rules.
A rule is a condition structure that can process actions and expressions among
others, for each condition.
It is associated to a function, and can be enrich the function context with
additional variables.
48
BRFplus Workbench – Rulesets Header
The ruleset Header handles information that is relevant to all
contained rules
The ruleset Header has the following features:-
1.
2.
3.
It can be enabled or disabled. This affects the processing of all the contained
rules.
Additionally, a precondition can be assigned, even if the ruleset is enabled. This
can be based on the context parameters or other values such as the system
status.
The Ruleset Header can define additional ruleset variables, which are made
available to the contained rules as temporary context parameters.
49
BRFplus Workbench – Rulesets Variables
Examples of Ruleset Header and Ruleset Variables
50
BRFplus Workbench – Rules in a Ruleset
Rules in a ruleset are executed top-down, one after the other
51
Example : Rules
52
BRFplus Workbench – Basic Object Handling
Objects in BRFplus share some basic handling operations.
Rules in BRFplus are composed of objects. These objects can be
handled and managed using some common operations.
These common actions contribute to the usability of BRFplus. They
can be categorized as follows:
1.
2.
3.
Object creation
Object selection
Object maintenance
53
BRFplus Workbench – Object Creation
Two ways for creating an element
From Link MENU….
Or through repository right click….
54
BRFplus Workbench – Object Selection
There are several ways to select an object.
Scenario 1:
Searching and selecting an object to be displayed or edited
Scenario 2:
Searching and selecting an object to be linked to another
Either scenario ends up opening a search and selection screen. Selection
Criteria make it possible to refine the search.
55
BRFplus Workbench – Object Selection Repository Search
Scenario1: Basic Object Search
With an Object ID or (Search help)
or through repository search
56
BRFplus Workbench – Object Selection Object Linking
Scenario 2: Linking an object to another
From Link Menu…….
Query Dialog: it is possible to refine the search
parameter.
For example by searching in a particular
application
Using Default Objects….
57
BRFplus Workbench – Attributes and properties
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 be
changed.
Both attributes and properties are displayed in the “General” section of the
screen.This section can be expanded to show more attributes and
properties.
58
BRFplus Workbench – Attributes
General Section
Reduce View
Extended View
59
BRFplus Workbench – Names: Usage
Objects can generally be unnamed
1. Unnamed objects have exactly one host object and cannot be reused by other
objects
2. Some objects like functions and applications are reusable by definition, so they
must be named.
3. Object names can generally be non-unique. Application and function names must
be unique, However objects can be renamed
60
BRFplus Workbench Text and Documentation Usage
BRFplus objects can be enriched with texts and documentation
Text up to 20 characters
Text up to 80 characters
61
BRFplus Workbench - Data Objects
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. These
characteristics 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 data
object can be used.
4. Different Kinds of data objects make it possible to tailor the design of a rule
application.
5. Data Object determines the type of data that can be handled by other BRFplus
objects and serve as data carriers.
62
BRFplus Workbench - Data Objects: Types of Elements
There are three different kinds of data object:
Elements
Structures
Tables
63
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 sections
1.
The
Th
e firs
firstt sect
sectio
ion
n ena
enabl
bles
es th
the
e bind
bindin
ing
g Of
Of a DDI
DDIC
C type
type..
2.
The
Th
e second
second sec
sectio
tion
n defin
defines
es the
the elem
element
ent typ
type
e and wh
what
at comp
comparis
arisons
ons are allo
allowe
wed
d
for this element (For example: it might not be allowed to use a “Larger than… “
operator for a specific number
number element).
element).
3.
The
Th
e last
last se
sect
ctio
ion
n def
defin
ines
es len
lengt
gth
h of
of the
the Dat
Data
a ele
eleme
ment
nt..
64
BRFplus Workbench - Data Objects: Element – Domain Values
1.
Unbo
Un
boun
und
d Elem
Elemen
ents
ts can
can be
be enha
enhanc
nced
ed wit
with
h Doma
Domain
in Val
Value
ues.
s.
2.
These doma
These
domain
in value
values
s become
become avai
availab
lable
le when
wheneve
everr this elem
element
ent is
is displa
displayed
yed in the
the
BRFplus workbench
65
BRFplus Workbench - Data Objects: Element – Message Check
1.
Chec
Ch
eck
k Messa
Message
ge beh
behav
avio
iorr can
can be adj
adjus
uste
ted
d for
for each
each elem
elemen
ent.
t.
2.
Whenever
Whenev
er a BRFp
BRFplus
lus obje
object
ct is che
checked
cked for cons
consist
istenc
ency,
y, a mess
message
age is displ
display
ayed
ed
for the check results. The type for these messages can be defined in the
additional 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)
66
BRFplus Workbench - Data Objects: Structure
Example of Structure
67
BRFplus Workbench - Data Objects: Table
Example of Table
68
Calling BRFPlus From Backend
• Calling a BRF Function from ABAP
1. 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 needed
3. Use Standard Program FDT_TEMPLATE_FUNCTION_PROCESS to
generate the BRFPlus code
•
Calling BRFPlus Function via web service.
69
BRFplus Workbench - Calling Function from Backend
• Calling BRFplus Function via an ABAP Function Module
1. A Function Module for a RFC can also be generated using the web service
generation feature. This function module can be called from other systems or
applications using the RFC protocol
70
BRFplus Workbench – Sample Expressions

Procedure Call

DB Lookup

Table operation
The 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 as
receive the results, making it possible to implement powerful logic.
The DB Lookup expression type enables the access to database tables to check or
retrieve data according to a flexible construct of parameters.
The table operation expression type allows the handling of table objects through the
execution of common operations such as deletions, row count determination, sorting
and the determination of averages, among many others.
71
BRFplus Workbench – Predefined Expressions Types


















Boolean Expression
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
72
BRFplus Workbench – Commonly Used Expressions
Static
Method
Call
Table
Operations
Decision
Table
Decision
Tree
Rule
Expressions
Loop
Formula
Function
Call
Database
Lookup
73
BRFplus Workbench – Decision Table
The Decision Table expression type offers a powerful way to Express
business rules:
1. Decision tables primarily consists of rows and columns. The columns are further
divided 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 condition
in each input column cell of a row is met, the field values in the result columns are
returned.
3. It is possible to enter expressions of direct values in these cells. This enables the
use of deep, or nested, decision tables.
4. If is also possible to evaluate the values in each cell by using comparison
operators, value ranges and pattern.
74
BRFplus Workbench – Decision Table Example
The Detailed section gives access to table operators with which rows
can be inserted, copied, edited and removed. The Table rows can be
moved and arranged as well, so that the most specific condition
are tested first. Finally table can be exported and imported to and
from excel, and the table settings screen can be accessed.
75
BRFplus Workbench – Decision Table: Table settings
76
BRFplus Workbench – Decision Table
77
BRFplus Workbench – Formula
A wide array of calculations on data objects is made possible
with the formula expression type
1.
This inclu
This
includes
des mat
mathem
hemati
atical
cal oper
operati
ations
ons as
as well
well as a lar
large
ge selec
selectio
tion
n of for
formul
mula
a
functions. Context parameters, expressions results and direct values can be used
as well in these formulas.
2.
A formu
formula
la can
can be crea
created
ted wit
with
h buildi
building
ng bloc
blocks,
ks, or using
using dire
direct
ct text
text entry
entry in
in exper
expertt
mode.
3.
The availa
The
available
ble for
formul
mula
a functi
functions
ons can
can be
be filtere
filtered
d by categ
categorie
ories
s or search
search patt
pattern
erns,
s,
and are documented with an explanation on purpose and syntax of the function, it
is possible to define own formula functions.
78
BRFplus Workbench – Formula: Detail Area overview
Detail are overview:
1.
Main Input Area
2.
Context Parameters
3.
Ope
pera
rato
tors
rs and in
inpu
putt ob
obje
ject
cts
s
4.
Formula fu
functions
79
BRFplus Workbench – Formula: Detail Area overview
Main Input area
1.
A result data object can be defined for the formula expression. The input are
shows the formula itself. In simple mode, the input cursor can be moved to insert
new operators and operands. These can also be deleted.
2.
A switch to expert mode is also possible. In Expert mode it is possible to put
together formulas using the object IDs and parameters in free text mode.
80
BRFplus Workbench – Formula: Detail Area overview
Context and Panel Button
1.
The context panel contains all available context data objects that can be
manipulated in the formula.
2.
The button panel inserts the displayed object or operand at the cursor location in
the input box.
3.
The formula functions panel shows the available formula functions, which can be
filtered by category and text.
81
BRFplus Workbench – Formula: Example
82
BRFplus Workbench – Case Expression
The case expression type maps input values to a defined set of
output values
1.
This expression tests for the value of an expression or context parameters among
a list of defined cases. If one of these cases applies, its corresponding return
value is given back
83
BRFplus Workbench – Decision Tree
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 level
can be a condition or the end result. This result can be a value or an action
84
BRFplus Workbench – Search Tree
A Search tree may have an arbitrary amount nodes at each level.
1.
In contrast to the decision tree, the search tree can have nodes with both
conditions and result.
2.
The results match node determines how results are evaluated. Multiple match
mode for example returns all matches that were found in the tree.
85
BRFplus Workbench – Boolean
Boolean expressions can be built with a template or free style.
1.
A Boolean expression is built with concatenated Boolean values or conditions,
using Boolean operators ( AND, OR, NOT).
2.
Existing templates can be used to build the expression.
86
BRFplus Workbench – DB Lookup
Database tables can be checked or read with this expression.
There are three different modes:
1.
Data retrieval: Either single or multiple lines can be read.
2.
Aggregation: A single value is aggregated using one of the following functions:
Minimum, Maximum, Average, Sum or count.
3.
Existence check: Only the existence of at least one table line is checked. Returns
a Boolean value.
4.
Several conditions can be defined for each mode, with both inclusion and
exclusion entries.
87
BRFplus Workbench – Procedure Call Example
88
BRFplus Workbench – Action Types
Action are special type of expressions that are similar to
expressions, but do not return a result value
1.
2.
3.
4.
They trigger changes and notifications outside of BRFplus, using context
parameters or nested expressions as inputs.
The execution of action can trigger the execution of subsequent actions.
Action are instances of action types.
Action can define follow-up actions that will be executed in the defined order.
89
BRFplus Workbench – Action Types
Context
Change
Start
Workflow
Message
Log
Actions
Send Mail
Static
Method
Call
90
BRFplus Workbench – Action Types: Send Email
Send Email: The send email action type makes it possible to create
and send an email when being executed. Elements like the
recipients, the subject and the body can be enriched with the values
derived from context parameters or nested expressions.
1.
2.
It is possible to include placeholders in the texts to include variables such as
context parameters
The addressees can be determined dynamically as well.
91
BRFplus Workbench – Action Types: Send Email
Start Workflow: The start workflow action type enables the rule to trigger a specific
workflow in the system. A workflow can then be used to trigger other tasks or invoke
the decisions of persons or agents.
92
Functional Mode Function : Example
Go

to Properties Tab
Change the mode as Functional Mode

Enter the Top Expression for the Function by
clicking on Create
93
Functional Mode Function : Example
First
Screen of Formula
Specify
Result data Object as EV_SYSID

Write Formula in the space
and activate the formula

Go back to the function
94
Functional Mode Function : Example
Activate
the Function
as well

Simulate the Function to test its
functionality

Click on Start Simulation Button
95
Functional Mode Function : Example
Trace
Result
96
BRFplus Workbench – Tools and Administration
1.
2.
3.
BRFplus provides a set off supportive tools that is accessible via the tools menu.
To Access specific tool, the user must have the required authorization.
Authorization object FDT_WORKB, field FDT_WB_ACT is used for this purpose.
Each tool corresponds to specific numeric value for this field. The values are
listed in the documentation for the field in the transaction SU21, Alternatively they
can be retrieved from the domain FDT_WORKBENCH_ACTIVITY.
97
Rule Creation Process – Simulation
98
BRFplus Workbench – Tools and Administration
1. Simulation – Testing and debugging purpose
2. Application Administration – Manager Objects
3. Application Usage – Interrelationships among applications
4. Transport Analysis – Transports can be analyzed and corrected
5. Web service – web service call for a function can be generated
6. XML Export – BRF plus objects can be exported into XML file
7. XML Import – BRF plus objects can be imported from an XML file
99
BRFplus Workbench – Simulation Tool
1. With the Simulation tool a function can be processed for testing or Debugging
purpose.
2. Only Last active version of the function and its referenced objects will be
simulated.
3. The tool can be invoked either from TOOLS menu or also directly from the tool bar
in the DETAIL section of the function UI as depicted below.
4. When simulating the Function, you can enter respective input parameters
5. The simulation mode can be either show only result or show also results of
intermediate steps
100
BRFplus Workbench – Simulation Tool
101
BRFplus Workbench – Show only Result
102
BRFplus Workbench – Show also results of intermediate
intermediate steps
103
BRFplus Workbench – Mass Testing
1.
2.
3.
4.
The simu
The
simula
lati
tion
on to
tool
ol can
can al
also
so be us
used
ed fo
forr mass
mass tes
testin
ting.
g.
It supp
support
orts
s import
import test
test dat
data
a for
for the con
contex
textt param
paramete
eters
rs from
from a Mic
Micros
rosoft
oft exce
excell
sheet.
Forr import
Fo
importing
ing ther
there
e is a limit
limitati
ation
on that
that tab
table
le data
data object
objects
s are not sup
suppor
ported
ted.. If
table data objects are part of the function context the import button is disabled.
When
Whe
n Butto
Button
n is click
clicked
ed on , the sec
sectio
tion
n CONT
CONTEXT
EXT EXP
EXPORT
ORT/IM
/IMPOR
PORT
T that
that is
depicted as shown below
104
BRFplus Workbench – Mass Testing
105
BRFplus Workbench – Web service Generation tool
A BRFplus function can be regarded as a local interface to a
business rule service.
If need arises to call such a service from external system, you could
manually develop a web service that acts as a connector to the
BRFplus function.
The Web service generation tool allows you to create such a Web
service without having to program a single line of code.
Pre-requisites:-
1. Starting with SAP NetWeaver 7.02, SAP_BC_WEBSERVICE_ADMIN_TEC role
can be assigned for Web service creation.
2. First, the tool creates a Remote Function Call module(RFC) in ABAP with an
interface that matches the intended BRFplus function.
3. The function context is mapped to importing parameters, whereas the result data
object is mapped to an exporting parameter.
4. Second, a Web service definition that connects to the RFC is generated.
Note: Can be used only for BRFplus functions with flat context and results.
106
BRFplus Workbench – Invocation
The Web service generation tool can be invoked in the workbench
either from the TOOLS menu or in the function UI from the toolbar
of the DETAIL section as shown below
107
BRFplus Workbench – Web service Generation tool
108
BRFplus Workbench – XML Export and Import
1. The BRFplus XML export and import functionality lets you transfer one or more
BRFplus objects from one system to another, assuming that both systems support
BRFplus.
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 export
and import arises in the following scenarios:
BRFplus content needs to be transferred to other SAP systems that are
not 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.
109
BRFplus Workbench – XML Export and Import
Schema
External and internal schema types are supported by BRFplus. The schema
type 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 an
underscore is used as a word separator. Also, the values are abbreviations
of the actual description. For example,
<FDTNS:DATA_OBJECT_TYPE> E</FDTNS:DATA_OBJECT_TYPE>
<FDTNS:ELEMENT_TYPE>T</FDTNS:ELEMENT_TYPE>
External
Schema Type
The names are formatted according to the upper camel case scheme. There
is no underscore separating the words. The values are actual description of
abbreviations. For example,
<FDTNS:DataObjectTypeFixedValue="E">Element</FDTNS:DataObjectType>
<FDTNS:ElementType FixedValue="T">Text</FDTNS:ElementType>
110
BRFplus Workbench – XML Export
The XML export tool allow you to generate an XML file for selected Objects or even a
whole application.
The file will contain all data that is required to recreate the last active versions of the
object.
Previous versions of inactive versions cannot be exported with the tool. This can only
be achieved via the API.
Together with the XML import tool it is possible to move or copy objects from one
system to another without using ABAP transports.
The XML export tool needs to be run in the source system.
Exporting Process is divided into three major steps:-
1. Select an object
2. Generate XML File
3. Download XML File
111
BRFplus Workbench – XML Export
112
BRFplus Workbench – XML Export: Select an object
113
BRFplus Workbench – XML Export: Generate XML file
114
BRFplus Workbench – XML Export: Generate XML file
115
BRFplus Workbench – XML Export: Download XML file
116
BRFplus Workbench – XML Import Tool
The XML import tool needs to be run in the target system. it requires first an XML file
that contains the desired, previously exported BRFplus objects.
The XML version of the file must be lower than or equal to the highest supported
version which is displayed just above the button UPLOAD FILE.
117
BRFplus Workbench – XML Import Tool
118
BRFplus Workbench – XML Import Tool: Test Run
119
BRFplus Workbench – XML Import Tool: Imported
1.
2.
3.
4.
5.
The XML import is internally handled similar to import of a transport
request.
An ID starting with $X2 for a virtual transport request will be generated
and displayed in the success message.
The ID allows tracking the origin of the imported object version.
An Alternative to the tool in the workbench is report
FDT_XML_IMPORT.
In addition to the standard XML import, it supports a “repair mode” to fix
corrupt objects.
120
Rule Creation Process – Simulation
121
BRFplus Workbench - Implement Function Call
122
BRFplus Workbench - Implement Function Call
123
Tips and Tricks
The following naming conventions apply in the BRF
Objects
BRF events
SAP Namesspace
0 to 9 (such as 0FLIGHT)
A to W
0 to 9
A to W
Other BRF objects
Prefix from 0 to 9
Application classes
Customer/Parter Namespace
X to Z
Namespace prefix /MY_COMPANY/
X to Z
A to Z
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 and
unpackaged again
Calling remote function module asynchronously usually causes further delays
Web services require more memory and processing resources than remote function
Calls
Note: The overhead for remote communication can be reduced significantly if it is
possible to bundle multiple BRFplus function calls into one remote call.
124
Tips and Tricks
If the Functions is called Locally, there are two different approaches that mainly
influence the performance.
1. Method IF_FDT_FUNCTION~PROCESS can be called for an object instance of
the corresponding function.
Advantage: This is easy to implement and understand.
Disadvantage: It requires loading the function and possibly the also related data
Objects from the database. Thus performs worst than the second approach.
2. The static Method CL_FDT_FUNCTION_PROCESS=>PROCESS can be called
without instantiating any objects. Context data can be passed by reference
variables. 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 performance
1. Local, Static method call
2. Local method call on a function instance
3. Remote Function call
4. Web service
125
Hands on exercises
1.
Set Delivery Block(VBAK-FAKSK) to “01” for Sales Orders of document type
“OR”
2.
Set up below rule based on input parameters to calculate SKU.
Input
PRODUCT
AG
OCCASION
Wedding
PLAN ART UNITS
BUDGET ART
UNITS
1000
1500
Decision Table
Product Line
Occasion Complexity Percent
AG
Wedding Complex
AG
Wedding Medium
20%
AG
Wedding Simple
10%
condition
30%
output
Output
Complexity
Percent
Budget
Plan
Complex
30
300
450
Medium
20
200
300
Simple
10
100
150
126
Download