13.2    SAP Business Rules Management

SAP BRM is an integral component of SAP PO and complements SAP BPM in the fundamental areas of modeling, maintenance, and execution of automated rule-based decisions (see Figure 13.2).

Positioning SAP BRM within SAP PO

Figure 13.2    Positioning SAP BRM within SAP PO

SAP BRM introduces transparency to the way rule-based decisions are enforced in your business processes. You can also easily decouple your process logic from your decision logic. SAP BRM is an all-in-one platform that helps you automate the execution of business rules and manage their entire lifecycle (i.e., model, execute, monitor, and improve in conjunction with the business processes they are part of).

SAP currently offers two different flavors of supporting automated business rules with SAP technology:

In this book, we only focus on the first category (SAP BRM), which is based on the Java-only stack of SAP PO and supports integration according to service-oriented architecture (SOA) principles and technologies.

SAP BRM is delivered as part of SAP PO and can be seen as an independent BRMS running in parallel with the SAP BPM and AEX engines on the SAP Java stack of SAP PO. It consists of three main components that support the different competencies (i.e., IT and business) within business rules management in an organization: Rules Composer, Rules Manager, and rules engine.

We’ll now discuss each of these tools in the following sections, how they are used, and when to use them.

13.2.1    Rules Composer

The Rules Composer represents the design time of SAP BRM. It’s the place where you create, model, develop, test, and deploy your business rules. SAP delivers this functionality as part of its Eclipse-based integrated development environment (IDE), SAP NetWeaver Developer Studio, which was introduced and discussed in Chapter 2 and Chapter 6.

SAP NetWeaver Developer Studio offers a rich palette of business rules perspectives, from which (depending on your role, e.g., business analyst, business rules developer, or the process owner of the business rule) you can model, develop, or maintain business rules. Figure 13.3 shows a simple business rule modeled as a rule flow using the SAP NetWeaver Developer Studio Rules Composer perspective.

Rules Composer with Flow Ruleset in SAP NetWeaver Developer Studio

Figure 13.3    Rules Composer with Flow Ruleset in SAP NetWeaver Developer Studio

As a developer, you can follow two different approaches for creating business rules:

When you’ve decided which method to apply for implementing your business rules (i.e., as rules service or embedded inside the context of a business process), then you also have to determine how to integrate the business rule within your business process. There are different ways of adding the business rules to your process flow in SAP BPM:

Embedded Rule as Gateway Condition in Process Flow

Figure 13.4    Embedded Rule as Gateway Condition in Process Flow

13.2.2    Rules Manager

Business rules are rarely static and tend to evolve according to the dynamics of the business. Therefore, a well-established set of procedures and tools must be in place to support the ongoing process of maintaining and changing business rules.

Rules Manager (see Figure 13.5) is a rule-centric Web Dynpro application that provides a web-based environment to administer and monitor previously deployed rules on the rules engine. It allows business managers, IT and functional administrators, and key users to modify business rules and implement changes instantaneously. With Rules Manager, it’s possible to create, update, and delete rules, scripts, and decision tables on the fly rather than via time-consuming transport procedures.

Rules Manager

Figure 13.5    Rules Manager

There are also different web-based tools built alongside Rules Manager that support the maintenance and management of business rules in SAP PO. Those tools are explained in the following subsections.

Business Rules Access Control Management

With the access control mechanism, you control the access and authorizations to the administration area for active rules on the rules engine. In the access control, you configure which user roles are allowed to perform changes to all rules or only to specific rules under a particular project.

Open the access control configuration screen via SAP NetWeaver Administrator (http://<hostname>:<port>/nwa), and then select the tabs ConfigurationSecurityIdentity Management (Figure 13.6).

Business Rules Access Control Management

Figure 13.6    Business Rules Access Control Management

Rules Manager Editing Tool for Functional and Business Users

Perhaps one of the most interesting features that Rules Manager has to offer is the Rules Manager online editing tool, which targets mainly non-IT users with knowledge of the business rules and the processes using them. The Rules Manager provides business analysts, administrators, and users with a tool to modify business rules and effect changes in real time. Figure 13.7 shows the Rules Manager online editing tool when editing a decision table deployed on the server. Remember that you can only see and edit rules that have been previously deployed to the server. Use this link to access the Rules Manager: http://<hostname>:<port>/rulesmanager.

Rules Manager Editing Tool

Figure 13.7    Rules Manager Editing Tool

Business Rules Execution Logs

You can access this functionality by navigating to SAP NetWeaver Administrator and then selecting TroubleshootingProcesses and tasksRules Business Logs (see Figure 13.8).

Business Rules Execution Logs

Figure 13.8    Business Rules Execution Logs

The rules engine stores technical logging and vital runtime information during rules execution; we call that type of logging business logs. The generated business logs and execution stack trace information can then be used for further analysis, debugging, testing, audit trails, and so on.

Using this function, technical and functional administrators can query the rules engine and search for the rule’s execution logs based on basic search parameters (e.g., execution timestamps) but also on advanced search requests based on business rule events and specific rule invocation IDs. Figure 13.9 shows the different types of search filter criteria you can select from the predefined list of business rule events. Note the link on the top-right side of the page where you can switch from Basic to Advanced search mode. When you click on Basic, the different business rules events are shown as search criteria.

Business Rules Execution Logs Advanced Search in SAP NetWeaver Administrator

Figure 13.9    Business Rules Execution Logs Advanced Search in SAP NetWeaver Administrator

Figure 13.10 shows the results returned by a search query when the business rule event All was previously selected (refer to Figure 13.9) as the search criteria. All the events related to the same rule invocation are automatically logged and correlated using one unique Rule Invocation ID for easy monitoring and tracing.

Business Rules Execution Logs Results in SAP NetWeaver Administrator

Figure 13.10    Business Rules Execution Logs Results in SAP NetWeaver Administrator

13.2.3    Rules Engine

When you’ve modeled, configured, and locally unit-tested your rules in SAP NetWeaver Developer Studio’s Rules Composer, it’s time to deploy the business rules and execute them on the SAP NetWeaver Application Server for Java (SAP NetWeaver AS Java). Executing the rules on SAP NetWeaver AS Java is the main job of the rules engine; it achieves this by interpreting and executing the business rules deployed on the application server. The rules engine is the runtime component of SAP BRM, and it can be found on the same Java stack (SAP NetWeaver AS Java), next to the adapter and process engine inside SAP PO (as shown in the Functional Unit area in Figure 13.11).

Rules Engine in the SAP NetWeaver Administrator Functional Units Screen

Figure 13.11    Rules Engine in the SAP NetWeaver Administrator Functional Units Screen

In the next section, we’ll explain how to create a business rule and add context to it, as well as how to test your rules from SAP NetWeaver Developer Studio and external tools. Section 13.4 will show you different ways of testing your business rules using internal and external methods.