5
Subscribe today. Visit www.SAPinsideronline.com. This article appeared in the Apr n May n Jun 2009 issue of SAP Insider and appears here with permission from the publisher, Wellesley Information Services (WIS), www.WISpubs.com. Rajagopalan Narayanan, SAP Labs India Technical column | SAP NetWeaver Unleashed Business Rules Change All the Time, But Your Applications Don’t Have To Manage and Modify Rules with SAP NetWeaver BRM Organizations routinely rely on business rules — oper- ations, definitions, and constraints based on corporate policies, business guidelines, or laws and regulations — to make day-to-day decisions and achieve their business goals. For example, a retail company sets business rules to determine consumer discounts: “If a buyer’s credit is good and the purchase order value is greater than US$500, then we can grant the buyer a 12% discount.” As the buyer’s credit rating changes, the company must adjust its discount calculations accordingly. In another example, an organization may create calculation rules to drive tax computations, but these rules must change as the tax laws and codes on which they’re based are modified. Business rules are embedded with business knowl- edge. IT alone doesn’t know how business rules will change or what impact those changes will have. But IT is responsible for maintaining and executing rules programmatically. Typically, business rules are imple- mented manually, hardwired into a software system, or coded into a program. These methods can be cumbersome and inefficient for developers, as busi- ness rules change frequently — so you need a way to effectively manage rules without having to modify your system with each iteration. That’s why it’s prudent to maintain business rules outside of their associated applications, where business analysts can manage them on an ongoing basis (see sidebar on page 64). SAP offers SAP NetWeaver Business Rules Manage- ment (SAP NetWeaver BRM) to help you manage your ever-growing — and ever-evolving — business rules, and to maintain more flexible and agile applications that reflect these changing rules. The solution is a set of pure Java components and tools that provide rules modeling and execution capabilities within SAP NetWeaver Composition Environment (SAP NetWeaver CE). You can use SAP NetWeaver BRM on its own, and you can also leverage it in conjunction with SAP NetWeaver Business Process Management (SAP NetWeaver BPM) to integrate, model, and modify rules within the context of a business process. 1 Here I’ll provide an overview of the tools within SAP NetWeaver BRM, break down how to manage business rules with this solution, explain the benefits of combining SAP NetWeaver BRM and SAP NetWeaver BPM, and show you where business rules manage- ment is headed. The Building Blocks of SAP NetWeaver BRM SAP NetWeaver BRM currently consists of two tools (see Figure 1): The Rules Composer is the rule modeling and implementation environment of SAP NetWeaver BRM. This tool is a perspective in the Eclipse-based SAP NetWeaver Developer Studio designed for IT rule developers. Because it is integrated within SAP NetWeaver Developer Studio, the Rules Composer is the most efficient way for developers to build rules- based applications targeted at the SAP NetWeaver platform. The Rules Engine is the run-time engine of SAP NetWeaver BRM, available as a predeployed stateless session bean in the SAP NetWeaver Application Server (SAP NetWeaver AS) Java of SAP NetWeaver CE. This tool gives IT developers the ability to generate reusable rules services out of the box, which is particularly helpful for integrating rules into composite applications. Three additional tools will be added in future releases of SAP NetWeaver BRM (again, see Figure 1). For more information on SAP NetWeaver BPM, please see “Gain Control of Your Critical Business Processes: Design, Document, and Deploy Them with SAP NetWeaver Business Process Management” by Donka Dimitrova and Ralf Schaub in the January-March 2009 issue of SAP Insider (www.SAPinsideronline.com). Rajagopalan (Rajgo) Narayanan (rajagopalan.narayanan@sap. com) is a Development Manager on the SAP NetWeaver Business Rules Management team at SAP Labs India. Prior to this role, Rajgo was a Product Manager in the same area. He has more than eight years of experience working in business rules management. The immediate and most important value gained when you employ a rules-based approach is that you can externalize and separately manage the most critical and volatile business rules in your applications.

May Jun 2009 issue of SAP Insider and appears here with ... · Effective business rules management consists of three core steps. Let’s look at each of these steps within the context

  • Upload
    others

  • View
    0

  • Download
    0

Embed Size (px)

Citation preview

Page 1: May Jun 2009 issue of SAP Insider and appears here with ... · Effective business rules management consists of three core steps. Let’s look at each of these steps within the context

Subscribe today. Visit www.SAPinsideronline.com.

This article appeared in the Apr n May n Jun 2009 issue of SAP Insider and appears here with permission from the publisher, Wellesley Information Services (WIS), www.WISpubs.com.

Rajagopalan Narayanan, SAP Labs India

Technical column | SAP NetWeaver Unleashed

Business Rules Change All the Time, But Your Applications Don’t Have ToManage and Modify Rules with SAP NetWeaver BRM

Organizations routinely rely on business rules — oper-

ations, definitions, and constraints based on corporate

policies, business guidelines, or laws and regulations

— to make day-to-day decisions and achieve their

business goals. For example, a retail company sets

business rules to determine consumer discounts: “If a

buyer’s credit is good and the purchase order value is

greater than US$500, then we can grant the buyer a

12% discount.” As the buyer’s credit rating changes,

the company must adjust its discount calculations

accordingly. In another example, an organization may

create calculation rules to drive tax computations, but

these rules must change as the tax laws and codes on

which they’re based are modified.

Business rules are embedded with business knowl-

edge. IT alone doesn’t know how business rules will

change or what impact those changes will have. But

IT is responsible for maintaining and executing rules

programmatically. Typically, business rules are imple-

mented manually, hardwired into a software system,

or coded into a program. These methods can be

cumbersome and inefficient for developers, as busi-

ness rules change frequently — so you need a way to

effectively manage rules without having to modify

your system with each iteration. That’s why it’s

prudent to maintain business rules outside of their

associated applications, where business analysts can

manage them on an ongoing basis (see sidebar on

page 64).

SAP offers SAP NetWeaver Business Rules Manage-

ment (SAP NetWeaver BRM) to help you manage your

ever-growing — and ever-evolving — business rules,

and to maintain more flexible and agile applications

that reflect these changing rules. The solution is a set

of pure Java components and tools that provide rules

modeling and execution capabilities within SAP

NetWeaver Composition Environment (SAP NetWeaver

CE). You can use SAP NetWeaver BRM on its own,

and you can also leverage it in conjunction with

SAP NetWeaver Business Process Management (SAP

NetWeaver BPM) to integrate, model, and modify rules

within the context of a business process.1

Here I’ll provide an overview of the tools within

SAP NetWeaver BRM, break down how to manage

business rules with this solution, explain the benefits

of combining SAP NetWeaver BRM and SAP NetWeaver

BPM, and show you where business rules manage-

ment is headed.

The Building Blocks of SAP NetWeaver BRM SAP NetWeaver BRM currently consists of two tools

(see Figure 1):

The Rules Composer is the rule modeling and

implementation environment of SAP NetWeaver BRM.

This tool is a perspective in the Eclipse-based

SAP NetWeaver Developer Studio designed for IT rule

developers. Because it is integrated within SAP

NetWeaver Developer Studio, the Rules Composer is

the most efficient way for developers to build rules-

based applications targeted at the SAP NetWeaver

platform.

The Rules Engine is the run-time engine of SAP

NetWeaver BRM, available as a predeployed stateless

session bean in the SAP NetWeaver Application

Server (SAP NetWeaver AS) Java of SAP NetWeaver

CE. This tool gives IT developers the ability to

generate reusable rules services out of the box,

which is particularly helpful for integrating rules

into composite applications.

Three additional tools will be added in future

releases of SAP NetWeaver BRM (again, see Figure 1).

� FormoreinformationonSAPNetWeaverBPM,pleasesee“GainControlofYourCriticalBusinessProcesses:Design,Document,andDeployThemwithSAPNetWeaverBusinessProcessManagement”byDonkaDimitrovaandRalfSchaubintheJanuary-March2009issueofSAPInsider(www.SAPinsideronline.com).

Rajagopalan (Rajgo) Narayanan ([email protected]) is a Development Manager on the SAP NetWeaver Business Rules Management team at SAP Labs India. Prior to this role, Rajgo was a Product Manager in the same area. He has more than eight years of experience working in business rules management.

The immediate and

most important value

gained when you

employ a rules-based

approach is that you

can externalize and

separately manage the

most critical and

volatile business rules

in your applications.

Page 2: May Jun 2009 issue of SAP Insider and appears here with ... · Effective business rules management consists of three core steps. Let’s look at each of these steps within the context

Subscribe today. Visit www.SAPinsideronline.com.

The Rules Repository will provide developers and

administrators with rules versioning, role-based

access control to rules, and historical rules invoca-

tion. The Rules Manager will feature a Web-based

collaborative rule maintenance interface for business

analysts. And the Rules Analyzer, a targeted envi-

ronment for business analysts, will allow them to

model, test, simulate, and analyze business rules

without assistance from developers.

Getting Started with Business Rules Management: An OverviewEffective business rules management consists of

three core steps. Let’s look at each of these steps

within the context of SAP NetWeaver BRM.

Step #1: Create a Business Vocabulary

Before you can model business rules, you need to

establish a set of business terms — your business

vocabulary. For example, consider the following

“if/then” rule used to determine whether a buyer is

qualified to make a particular purchase:

IF Buyer’s CreditScore > 720 THEN ASSIGN

Qualified=true.

Here, the business terms are Buyer’s CreditScore

and Qualified. You can infer these terms from an exist-

ing data model available as an XML schema or a Java

class. You can also define your own business terms

independent of a data model with SAP NetWeaver

BRM. Moreover, you can provide user-friendly, busi-

ness-oriented names for these terms to represent the

rules in a more natural-language format.

Step #2: Model Business Rules

Business rules are ubiquitous. You likely will see a

requirement for using a rules-based approach in

many kinds of applications, including plain Java

applications, composite applications, and business

processes. To facilitate such a diverse set of usage

requirements, SAP NetWeaver BRM enables you to

model business rules in two ways: independently

through rules modeling, or through an integrated

approach that combines rules modeling and process

modeling (see Figure 2).

SAP NetWeaver BRM supports the independent

rules modeling approach through the Rules Com-

poser environment. Later in the article, I’ll cover

integrated rules and process modeling (in the “Com-

bining SAP NetWeaver BRM with SAP NetWeaver

BPM” section).

The main unit of work in SAP NetWeaver BRM is a

ruleset, a group of logically related rules. Rulesets

are important from an application viewpoint because

when an application calls a rule engine, it asks for a

ruleset name, not individual rules inside a ruleset.

Component Description Target Users

Rules Composer

Rule modeling and implementation environment

IT developers

Rules Manager

Web-based collaborative rule maintenance interface

Business analysts

Rules Analyzer

Environment to model, test, simulate, and analyze business rules without IT

Business analysts

Rules Engine

Run-time engine providing out-of-the-box generation of reusable rules services

IT developers

Rules Repository

Environment for rules versioning, role-based access control to rules, and historical rules invocation

IT developers and adminis-trators

FiGuRe 1 p The five techni-

cal building blocks of

SaP netWeaver BRm;

the Rules composer and

the Rules engine are

currently available, and

the other tools will be

available in future

versions of the solution

FiGuRe 2 t Depending on

an application’s require-

ments, developers can

use SaP netWeaver BRm

or SaP netWeaver BPm

to model rules

Page 3: May Jun 2009 issue of SAP Insider and appears here with ... · Effective business rules management consists of three core steps. Let’s look at each of these steps within the context

Subscribe today. Visit www.SAPinsideronline.com.

Within the Rules Composer, the Project Explorer

view (the rules tree) shows a list of all of the rules

projects — collections of logically related rulesets —

in a workspace (see Figure 3). You can see the rule-

sets in the Outline view.

Business rules can be represented in many

forms, mainly as if/then rules (inference or produc-

tion rules) and decision tables (score cards or tabu-

lar rules). Future versions of SAP NetWeaver BRM

will introduce additional representations, including

flow rules.

For technical details on modeling rules with SAP

NetWeaver BRM, please visit https://www.sdn.sap.

com/irj/sdn/nw-rules-management.

Step #3: Integrate Rules Engines with

Applications

Business rules are reusable assets. The Rules Engine

of SAP NetWeaver BRM enables the reuse of rules

and rules-based operations. Because the Rules

Engine is available as a predeployed stateless session

bean, Java and J2EE applications can directly use this

stateless EJB to integrate their applications with the

Rules Engine.

This design enables the consumption of rules

from any kind of application, regardless of whether

the application uses SAP or non-SAP technology. In

fact, SAP NetWeaver BRM is an ideal rules manage-

ment technology for building rules-based composite

Benefits of a Rules-Based ApproachThe Architecture of a Typical Business Rules Scenario

If you employ the right architectural approach to managing

business rules, and then those rules change, you can make any

necessary system modifications without affecting the calling

application. Developers can externalize critical business rules by

moving them outside of the core application; there, they can

model and maintain rules using business rules management

software such as SAP NetWeaver BRM.

The figure to the bottom right shows the standard structure

of a rules-enabled application — here, a tax calculation opera-

tion. In this scenario, the tax calculation rules are separate

from the compute tax application. To execute the operation, the

application calls a rules engine, which is a logic engine, and then

the rules engine calls the rulesets containing the rules. Because

those tax calculation rules reside outside of the application,

rewriting them when tax laws and regulations change does not

affect the application.

A rules-based operation like the one shown

here can be realized in many forms, such as a

stateless session bean (EJB) or a stateless Web

service. An immediate extension of this architec-

ture is that rules and rules-based operations

(services) can be used across multiple applica-

tions and process scenarios.

Some additional notes on working with rules:

With SAP NetWeaver BRM, rules are modeled

with the Rules Composer. As of SAP NetWeaver

CE 7.1.1, any changes to rules will flow from

the Rules Composer. So, if you need to change

tax calculation rules, you can do so and then

redeploy the rules.

From a landscape perspective, you can set up your environ-

ment such that all changes will flow from your development

(DEV) environment to staging only. To then move from staging to

production (PROD), you’d use the standard transport mechanism

available in SAP NetWeaver Development Infrastructure to

control the change.

From an application perspective, the application calls the rules

engine, asking the engine to execute a ruleset by name. Here is

what the rules engine invocation API looks like:

Listoutput=ruleEngine.invokeRuleset(String

projectName,StringrulesetName,List

inputObjects);

If you were dealing with our example tax calculation decision,

and the input is a set of products and a tax object, then the out-

put will be the products and a modified tax object. (Note that

here, the rules themselves would have been modeled using the

product and tax objects.)

p The typical architecture of a rules-based application; business rules are

externalized from the application and are executed by the rules engine

Page 4: May Jun 2009 issue of SAP Insider and appears here with ... · Effective business rules management consists of three core steps. Let’s look at each of these steps within the context

Subscribe today. Visit www.SAPinsideronline.com.

applications and service-oriented architecture (SOA)-

style applications. These applications can use the

Rules Engine — and therefore, rules-based operations

— as stateless Web services. What’s more, SAP

customers can successfully employ business rules

management in a variety of business scenarios

involving pure composite applications at the edge of

the application core, and in many system-to-system

application integration scenarios — for example,

destination determination rules in SAP NetWeaver

Process Integration (SAP NetWeaver PI), or precise

and targeted campaign management in SAP Customer

Relationship Management (SAP CRM).

Combining SAP NetWeaver BRM with SAP NetWeaver BPMSAP NetWeaver BRM and SAP NetWeaver BPM are

complementary technologies. You can use them sepa-

rately — but when you use them together, they are a

powerful combination, especially for processes with

numerous steps that involve changing or evolving rules.

Here is a nonexhaustive list of common scenarios

in which business rules add value to business process

management:

Complex rules-based decisions, such as pricing

and credit decisions

Responsibility determination, such as rules-based

task assignment

Recognition of business events, such as fraud

detection

Routing rules, such as receiver determination

Parameter thresholds and tolerance, such as

constraint rules

An organization can use SAP NetWeaver BRM and

SAP NetWeaver BPM to assess financial liability for a

warranty claim, for example. Figure 4 on the next

page illustrates a warranty claims process modeled

with SAP NetWeaver BPM. Here, SAP NetWeaver BPM

manages the whole process, but the Rules Engine of

SAP NetWeaver BRM helps to both validate a particu-

lar claim request and assess financial liability for it.

To determine financial responsibility — one step in

the process — you use a set of liability assessment

rules based on contracts with your suppliers, which

may change yearly. The Rules Engine calls the liabil-

ity assessment rules, which are managed and modi-

fied outside of the application. Business rules have

been modeled in the context of a business process,

Case Study: An Airline Company Streamlines Rules Management and Reduces CostsOne SAP customer, a major airline that operates a maintenance/repairs facil-

ity, moved to a rules-based system for calculating custom duties and taxes

on parts acquired from different countries. Before the company employed a

rules engine, a team of six to eight experts manually computed the approxi-

mately 1,000 rules — which changed every three months — associated with

the taxes. By implementing business rules management and modeling

if/then rules, the organization trimmed the team down to one to two people.

4 NOTe!

When modeling

business rules in

the context of a

business process,

you use the same

tools available in

the Rules composer.

FiGuRe 3 q Developers

work within the Rules

composer environment

of SaP netWeaver BRm

The Project explorer view displays all active rules projects

The outline view displays available rulesets

a modeled business rule is shown here

a decision table is a common way to represent tabular rules

Page 5: May Jun 2009 issue of SAP Insider and appears here with ... · Effective business rules management consists of three core steps. Let’s look at each of these steps within the context

Subscribe today. Visit www.SAPinsideronline.com.

and these same rules have been used in the business

process model.

The Future of SAP NetWeaver BRM: Roadmap HighlightsGoing forward, SAP NetWeaver BRM will continue to

complement and accelerate SOA, composition, and

business process management via the automation

and alignment of critical business rules.

The interactivity between SAP NetWeaver BRM and

SAP NetWeaver BPM will continually add value as

companies integrate their business process and busi-

ness rules management capabilities. SAP will provide

seamless navigation from business process models

into business rules definitions that drive decisions

within processes, as well as integrated rules model-

ing in a business process model context.

And, aimed at increased business analyst enable-

ment, future versions of SAP NetWeaver BRM will:

Support the modeling of complex business

decision sequences

Enable business user participation and collabora-

tion toward rules authoring and tactical change

management

Allow rules-based responses to business events in

real-time business scenarios

Facilitate advanced rules analysis capabilities to align

with business goals through simulations and replays

Enable business analysts to model business rules

ConclusionWith SAP NetWeaver BRM, you need only adapt your

business rules — not your complete systems — to chang-

ing business requirements. As a result, a real-world

competitive benefit emerges: Companies can consider-

ably reduce maintenance and operational costs and,

at the same time, lower time-to-market pressures.

For additional information about SAP NetWeaver

BRM, please visit https://www.sdn.sap.com/irj/sdn/

nw-rules-management and click the “Rules Tutorial

Center Is Available” link. Here you’ll find ready-to-

download applications to use with the Rules Engine. n

FiGuRe 4 u modeling busi-

ness rules in the context

of a warranty claims

business process using

SaP netWeaver BRm and

SaP netWeaver BPm

...from

“Gain Control of Your Critical Business Processes: Design, Document, and

Deploy Them with SAP NetWeaver Business Process Management,” an

SAP NetWeaver Unleashed column by Donka Dimitrova and Ralf Schaub

(SAP Insider, January-March 2009, www.SAPinsideronline.com)

The SAP NetWeaver/BI and Portals 2010 conference in Orlando, March

23-26, 2010, for strategies and best practices on using SAP NetWeaver

technology (www.sapnetweaver2010.com)

“SAP BPM Tools,” an SAP Insider Multimedia Training CD, which includes

an introduction to SAP NetWeaver Business Rules Management

(www.SAPinsidermultimedia.com)

AdditionalResources...

claim validation rules

Warranty claims process