Creating Rules with the Rules Composer

Objective

After completing this lesson, you will be able to create rules with the Rules Composer

Rules Composer Overview

Rules Composer allows you model, implement, test, and refine rules.

In Rules Composer you can define the following rules-based objects:

  • Flow rulesets including rule flow elements, rule scripts, and gateways.
  • Common definitions
  • Rule overrides
  • Activities
  • Enumeration types

Rules Composer comes with the following features:

  • Integrating rules with Microsoft Office Excel.
  • Testing XSD rulesets.
  • HTML reporting of entities within rulesets and decision tables.
  • Storing different versions of rulesets in DTR using addition, modification, and deletion data.
  • Generating Web services for rulesets.

Rule Flow Task Modelling

A flow ruleset executes rules as designed in the Composite Explorer flow chart. Flow rulesets always have a single, main flow with potentially many other rule flows. The execution of the ruleset starts with the main flow.

A rule flow is a reusable entity within a flow ruleset and is based on activities associated with artifacts including rule scripts, rule flow, rulesets, rules, and decision tables.

Flow Rule Elements are:

  • Start and end events and error elements — A rule flow has a single start event and can have one or more end events and error elements.
  • Rule scripts — A rule script is a reusable artifact within a flow ruleset and is a sequence of actions.
  • Exclusive choice gateway — An exclusive choice gateway has at least two named branches, one being the default branch. Each named branch has a condition associated with it.
  • Ruleset — Rulesets are a collection of multiple rules related to a specific business situation.
  • If-Then rules — If-Then rules use the following syntax: IF the conditions are satisfied, THEN the action is started.
  • Decision tables — Decision tables are a collection of If-Then rules that have conditions with the same structure. These can be viewed in as a spreadsheet.
  • Connectors — Connectors join all activities and elements in a rule flow to each other.

Decision Tables and Rule Scripts Implementation

An exclusive choice gateway has at least two named branches, one of these being a default. Each named branch has a condition associated with it. A rule script is a sequence of actions.

A rule override helps resolve conflicts between two satisfied If-Then rules by suppressing execution of lower priority rule. Date effectivity can be used to specify the time period during which a rule is effective, and can thereby be executed. The rules composer provides the capability for rules, decision tables to use restricted value from a list of drop-down choices in conditions and action. These restricted drop-down choices are enumeration types, or groups of values of a standard primitive type.

The Rules Composer provides the capability to export a decision table to a spreadsheet. Users are able to seamlessly edit and analyze data using the capabilities of Microsoft Excel. It is possible to import these changes back into the decision table without any loss of data.

The Rules Composer provides a capability to generate a printable report for ruleset and decision tables. The reports include information about all entities within a ruleset.

The Rules Composer also allows you to compare different versions of rulesets in the Design Time Repository (DTR) in a text format. DIFF captures three types of edit operations between two different versions of ruleset, name addition, modification, and deletion.

Rules Composer provides a simple menu driven facility to provision a Web service for a ruleset written on XML schema. When the rules are deployed on a server, the Web server also gets deployed. It can be verified using the SAP NetWeaver Administrator.

The figure illustrates the steps for a web service generation of a ruleset.

Rule override and date effectivity are managed as follows:

  • Rule override — Resolves conflicts between two satisfied If-Then rules by allowing the rule with the highest priority to start.
  • Date effectivity — Used to specify the time period during which a rule is effective and can be executed.

The Rules Composer provides the capability for rules and decision tables to use restricted condition and action values. Restricted values are available from a drop-down menus. These restricted drop-down menu choices are enumeration types, or groups of standard, primitive type values.

Rulesets as a Web Service

Rules Composer provides a simple menu driven UI to create Web services for rulesets written using an XML schema. When rules are deployed on a server, the Web service is also deployed. Web services can be verified using SAP NetWeaver Administrator.

To Set Rulesets as a Web Service

To set rulesets as a Web service, use the following procedure:

Steps

  1. In the Project Explorer view, expand the Rules Composer DC and the Rules Modeling nodes.

  2. In the context menu of a ruleset or flow ruleset, choose Web Service Create WSDL Artifact.

  3. In the dialog box that appears, in the Ruleset Name: Service Attributes area, accept the defaults values or makes changes. Then, choose Next.

  4. In the Ruleset Name: Service Signature area, the input and output types appear and the checkboxes are selected. Choose Next.

  5. In the Ruleset Name: WSDL Preview area, the contents of the WSDL artifact appear. Choose Finish.

  6. Deploy the rules composer DC.

Result

The Web service is now ready for use.

Log in to track your progress & complete quizzes