PMC163
Own Your Business Logic With
Business Rule Framework Plus
Wolfgang Schaper, BRFplus, Corporate Functions Platform, SAP AG
Carsten Ziegler, BRFplus, Corporate Functions Platform, SAP AG
Jeff Gebo, SAP Technology RIG, SAP Labs LLC
Claudia Pacheco, SAP Technology RIG, SAP Labs Canada
Susan Keohan, Information Services Department, MIT Lincoln Laboratory
October 20, 2010
© 2010 SAP AG. All rights reserved. / Page 2
Agenda
1. About Business Rules
2. Business Rule Framework plus
3. Exercises
Exercise 1: Create an Application, Function, and Ruleset
Exercise 2: Define a Simple Rule
Exercise 3: Define more Complex Rules
Exercise 4: Run the Rules
Exercise 5: Call the Function
4. Summary and Outlook
© 2010 SAP AG. All rights reserved. / Page 3
Agenda
1. About Business Rules
2. Business Rule Framework plus
3. Exercises
Exercise 1: Create an Application, Function, and Ruleset
Exercise 2: Define a Simple Rule
Exercise 3: Define more Complex Rules
Exercise 4: Run the Rules
Exercise 5: Call the Function
4. Summary and Outlook
© 2010 SAP AG. All rights reserved. / Page 4
What are Business Rules?
Procurement
Planning and
Analysis
Procurement
Purchase Order
Processing
Goods Receipt
and Service Entry
Invoice
Processing
Payment
Demand /
Request Creation
RFx can be created manually or by a predecessor document. RFx specific information (e.g. submission deadline, suppliers) is maintained.
RFx is sent to the selected suppliers to obtain a bid.
Bids are received and can be evaluated according to different criteria (e.g. best price).
Best source of supply is selected and notification of acceptance is sent to the supplier. Rejection is sent to other suppliers.
Optimized process output Adherence to regulations/policies Process automation
Business Rules
A set of decisions / calculation mechanisms applied to a business process:
RFx
Processing
Purchase
Request
Processing
© 2010 SAP AG. All rights reserved. / Page 5
Problems with Conventional Methods
Rules inside Code
Business
User
Rules
Roles
UI
Workflow
& Task
Event
Data
Process Context
Create Claim
Analyze Budget Impact
Analyze Resource Impact
Rules
Roles
UI
Workflow
& Task
Event
Data
Process Context
Create Claim
Analyze Budget Impact
Analyze Resource Impact
Out
of
stock
Product
15 min
Reple-
nish-
ment
order
Out
of
stock
Product
15 min
Reple-
nish-
ment
order
Business
Expert
Rules
Roles
UI
Workflow
& Task
Event
Data
Process Context
Create Claim
Analyze Budget Impact
Analyze Resource Impact
Rules
Roles
UI
Workflow
& Task
Event
Data
Process Context
Create Claim
Analyze Budget Impact
Analyze Resource Impact
Out
of
stock
Product
15 min
Reple-
nish-
ment
order
Out
of
stock
Product
15 min
Reple-
nish-
ment
order
Business
Analyst
Rules
Roles
UI
Workflow
& Task
Event
Data
Process Context
Create Claim
Analyze Budget Impact
Analyze Resource Impact
Rules
Roles
UI
Workflow
& Task
Event
Data
Process Context
Create Claim
Analyze Budget Impact
Analyze Resource Impact
Out
of
stock
Product
15 min
Reple-
nish-
ment
order
Out
of
stock
Product
15 min
Reple-
nish-
ment
order
Rules as Tacit Knowledge
Rules in Documents
Rules inside Database
Sales Commissions
Premium Calculations
…Triggers
Stored
Procedures
Costs, archiving, backups, compliance?Agility, visibility for business, changes?
© 2010 SAP AG. All rights reserved. / Page 6
Business Rules Management
Flexible & agile business systems Precise & informed decision making
Faster turnaround times for changes Improved visibility for the business
Reduced cost for changes
Benefits of Using Business Rules ManagementRules
Roles
UI
Workflow
& Task
Event
Data
Process Context
Create Claim
Analyze Budget Impact
Analyze Resource Impact
Rules
Roles
UI
Workflow
& Task
Event
Data
Process Context
Create Claim
Analyze Budget Impact
Analyze Resource Impact
Out
of
stock
Product
15 min
Reple-
nish-
ment
order
Out
of
stock
Product
15 min
Reple-
nish-
ment
order
Model
Refine
Automate
Manage
Business Rules Management Benefit
Separation of business rules
and code
Agile and maintainable systems
Modeling of complex business
logic
Automation of key business
decisions
Central management of
business rules
Consistent application of
corporate policy and
government regulations
Business Experts can find,
change and test critical
business rules
Visibility, accountability and
error-free business
© 2010 SAP AG. All rights reserved. / Page 7
Ubiquitous Business Rules
Banking: Relationship based Pricing,
Scorecards, Credit Decisioning
Education: Fee Calculations,
Course Selections
Healthcare: Claims, Patient
Monitoring, Fraud Detection
Logistics and Shipping: Parts
Management, Duties Calculations,
Pricing Calculations
Public Sector: Tax Calculations,
Customs Duties, Land Regulations,
License Fee Calculations
Insurance: New Products, Claims
Settlement, Agent Commissions
© 2010 SAP AG. All rights reserved. / Page 8
Agenda
1. About Business Rules
2. Business Rule Framework plus
3. Exercises
Exercise 1: Create an Application, Function, and Ruleset
Exercise 2: Define a Simple Rule
Exercise 3: Define more Complex Rules
Exercise 4: Run the Rules
Exercise 5: Call the Function
4. Summary and Outlook
© 2010 SAP AG. All rights reserved. / Page 9
Rules Creation Process
Create and Assign Rules
Create and Assign Rule Set(s)
Create and Assign Expressions
Create and Assign Actions
Create Function
Create and Assign Context Data Objects
Create and Assign Result Data Object
Start
End
Create Application
Implement Function Call
Simulate Function
Activate Objects
© 2010 SAP AG. All rights reserved. / Page 10
Mode of Operation
Function
Application Code
Ruleset
Application Code calls BRFplus
Function
Only 6 lines of code needed
Context input data
Result output data
BRFplus Function processes
rules from assigned ruleset(s)
Rules can evaluate
conditions, change data and
perform actions
© 2010 SAP AG. All rights reserved. / Page 11
Ruleset
Name, text, documentation, version
overview, change tracking, release
information, technical ID
Variables for intermediate values,
initializations (code, DB, values, rules)
Ruleset precondition, priority,
function assignment
Rule validity information and description
Rules to change data by value assignment, variable
assignment, and expressions (decision tables, formulas, …)
Rules to trigger actions (email, workflow, message log)
© 2010 SAP AG. All rights reserved. / Page 12
Selected Action and Expression Types
Decision/
Search Tree
Traverses a binary/non-binary tree with nodes
being conditions and leafs being results
Decision
Table
Sequentially processes a table of value
ranges and returns the first row/all rows for
which all ranges returned true
Database
Lookup
Performs a database select to retrieve values
for processing
Formula Allows the definition of complex formulas to
be evaluated at run-time
Loop Process the array of data in the loop and
performs operation based on the rules
Table
Operations
Operates on entire tables to carry out
aggregations, existence checks, line counts…
Routine Call Calls an ABAP routine (method or function
module)
Email Sends Email
Message
Log
Writes message into message log
Workflow Triggers Business Workflow
Expression Types
Expression types define a
self-contained
computational unit with a
well-defined logic
Expressions use context
data or nest other
expressions to calculate,
determine or derive result
Action Types
Instead of returning a
result value, action types
trigger an action in
response to incoming data
© 2010 SAP AG. All rights reserved. / Page 13
Decision Table
Decision Tables
Powerful visualization - compact and structured
Completeness and consistency – error prevention made easier
Modular knowledge organization - rules grouped into a single table
Column definition: condition, result or action,
comparison options, mandatory columns
Table definition: any number of condition or
result columns, return of first or all matches
Rows: Checks for
overlaps or gaps
Cells: include/exclude,
enumerations, many
options (equals, greater,
less or equals, pattern
matching, between, …)
Powerful cell options
reduce amount of data
compared to DB table
DemoDEMO
Setting up an Application with SAP Business Rule Framework plus
© 2010 SAP AG. All rights reserved. / Page 15
Building a Sample Application
Use Case Hotel Room Rate
For given check-in and check-out dates the total rate
for a specific room type is being calculated
A check for check-out date later than check-in date is
included
A notification mail with the relevant data is triggered
© 2010 SAP AG. All rights reserved. / Page 40
Agenda
1. About Business Rules
2. Business Rule Framework plus
3. Exercises
Exercise 1: Create an Application, Function, and Ruleset
Exercise 2: Define a Simple Rule
Exercise 3: Define more Complex Rules
Exercise 4: Run the Rules
Exercise 5: Call the Function
4. Summary and Outlook
© 2010 SAP AG. All rights reserved. / Page 41
Exercises
In the exercises we want to set up a sample
application (exercise 1)
that derives the price of some product (exercise 2),
adds shipping costs of 5%, but at least 2$, if the price
is under 100$ (exercise 3) and
sends a notification mail if a product is not found in
the price list (exercise 3)
Then we test the application (exercise 4)
Finally we implement the function call in backend
(exercise 5)
© 2010 SAP AG. All rights reserved. / Page 42
Login Information
Please log on to system M34, client 800
Your user is BRFPLUS_<nn>, where nn is the
number of your seat, e.g. BRFPLUS_07
The password is “Hands-On” (case sensitive)
That system is a SAP NetWeaver 7.02 SP04 system
In Ramp-Up, starting in Q4/2010, we will ship SP05
Be aware that SP04 is a preliminary version
Please keep that in mind in case you experience any
issues
© 2010 SAP AG. All rights reserved. / Page 72
Findings of the Exercises
Within one hour we set up an application
that is business driven and is based on a business
model
that checks for product prices and availability
that applies context sensitive logic
that triggers a follow up action
that can be adapted or extended at any time
that may have role based authorization
that is fully integrated with the backend
without one line of coding
modification free
without any previous training or upskilling
that can be called from backend very easily
© 2010 SAP AG. All rights reserved. / Page 73
Summary
Business User Empowerment
Graphical approach for intuitive rule composition and management (modeling rather than programming)
Transparency of rule execution and tracing for audit
Personalization and segmentation of rules (object catalogs, filters, personal configuration, etc.)
Zero Administration
Seamless integration with ABAP applications and ABAP server (ABAP, DDIC, Change and Transport System,
Web Service and RFC Generator)
High performance and nearly no footprint (<100 kB)
Zero setup effort before rule modeling (no installations, no plug-ins, no business vocabulary setup, no additional
sizing, browser-based UI)
Rapid Time-to-Value
Rapid prototyping with feedback-based build cycle (build, simulate, optimize) leading to lower project cycle
times (up to 60% reduction)
Business users can work with the rules in business semantics while IT experts can technically modify the
rules.
Both business and IT can work in the same environment.
© 2010 SAP AG. All rights reserved. / Page 74
Further Information
SAP Public WebBusiness Rules in SDN: http://www.sdn.sap.com/irj/sdn/nw-rules-management
BRFplus in SDN: https://www.sdn.sap.com/irj/sdn/index?rid=/webcontent/uuid/90754865-f283-2b10-
6d9f-b10f3c28c3a0
Related Workshops/Lectures at SAP TechEd 2010
PMC103, Business Rules Management with SAP (Overview of BRFplus and SAP NetWeaver BRM),
Lecture
PMC260, Accelerating Business Rules with SAP NetWeaver BRM,
Hands-On Session
PMC100, Overview of SAP NetWeaver BPM and SAP NetWeaver BRM,
Lecture (Las Vegas only)
PMC301, Orchestration using SAP NetWeaver BPM and SAP NetWeaver BRM,
Lecture (Las Vegas only)
MediaCarsten Ziegler, Thomas Albrecht: BRFplus – Business Rule Management
for ABAP Applications, SAP Press, 2010, ISBN 978-1-59229-293-6,
http://www.sap-press.com/products/BRFplus-%E2%80%93-Business-Rule-
Management-for-ABAP-Applications.html
Thank You!
ContactFeedback
Please complete your session evaluation.
Be courteous — deposit your trash,
and do not take the handouts for the following session.