Skip to Content

Dear SCN Friends,

SAP NetWeaver Business Rules Management (BRM) provides a powerful toolset covering all aspects of rule handling in business applications. Message processing in SAP NetWeaver Process integration (PI) can take advantage of those business rules in multiple ways.

Below are the most common use cases in PO where we can make use of BRM .

1)Within routings, business rules may provide additional data

      Ex:Extended Receiver Determinations and Enhanced Interface Determinations

2)Within a mapping step, business rules information may enrich the original data providing lookup and value mapping functionality.BRM lookup will be effective compared to other lookups(calling external systems) ,when it is installed along with PO server in a single instance. 

3)Within NW BPM, rules may also be used to enrich process data or to provide decision criteria for conditions steps

I Would like to share my knowledge on BRM Rule set creation by taking a simple use case to explain .

UseCase:We need to calculate Employee Hike based on his/her Region and Grade .

Step1 :In PO server Create a Data type (HikeCalc),Message Type (HikeCalc) with the below fields.

BRM_DT.jpg

Step2:In the XSD tab of the Message Type, copy or export the XSD to a local file.

BRM_MT_Export.jpg

Step3:Now open NWDS server and follow the below navigation to open BRM Rules Composer

Windows–>Open Prospective–>Other–>Rules composer.

<—————————————————————–BRM Project Creation—————————————————————–>


Step4:Create a New Project in BRM Rules Composer.

FIle–>New–>Project.

Project.jpg

Select Development Component and Click on Next

DC.jpg

Select the Rules Composer and Click on Next

RC.jpg

Select MyComponent under LocalDevelopment and click on Next.

SWC.jpg

Name the project as per your functionality and click on FInish.

Proj.jpg

Step5:Import the XSD into the Project .

WSDL_Import.jpg

select xsd option and click on next

XSDImport.jpg

Now browse your xsd file from your local machine and click on Finish.Now we can see our XSD Imported into our Project.

WSDL.jpg

Step6:Add the XSD by double-click on “Project Resources”, select the “Alias” tab and click on “Add” and select “XSD Element”:

AddXSD.jpg

Select the imported XSD and click on “Finish”.

Select the XSD elements which will be used in the development of rule or decision table.Expand the XSD structure and check the following elements to be used:

  • HikeCalc/Grade
  • HikeCalc/Region
  • HikeCalc/Hike = {String}

Those elements designated as “= {something}”, such as Discount, is used for output. Those without it are used as input.

BRMRules1.jpg

Step7:Create a ruleset by right-click on “Rules Modeling” and select “New Ruleset”:

RulesSet.jpg

Give the name to ruleset and click on OK.

NewRules.jpg

Step8:Now Create a Decision Table .This will help to determine the employee hike .This  table consists of Grade and Region as input, and Hike as the output.

   Create a new decision table by right-click on “Decision Table” and select “New Decision Table…”:

DT.jpg

Give the name for DecisionTable and click on Next

DTName.jpg

Select Grade and Region as the conditions of the table (These are the inputs) and click on down arrow button

COND1.jpg

  Click on Next

COND2.jpg

Select the Action HikeCalc/Region and click on down arrow button ,now below screen will appear.

COND3.jpg

Click on Finish.

Now for adding condition ,Right click on DefaultValue under HikeCalc/Grade column and click on “Add Condition Values by Pressing Ctrl++”

Table.jpg

Give the values (one value in one line) and click on OK.

Val.jpg

Repeat the same for HikeCalc/Region.

Now enter the Values for HikeCalc/Hike by double clicking and entering values manually.

Val2.jpg

Step9:Now Create a Rule by double clicking on Rules folder–>New Rule

NewRules.jpg

Give the name for the Rule and click on OK.

RulesCreation.jpg

Double click on below highlighted rule

Rules.jpg

In the Rule development screen, click “+” under the “If” condition.Replace the left-hand side with “Boolean.TRUE” .Repeat the same for the right-hand side of the Equals.

Rules_CC.jpg

Now assign the Decision table by clicking on “+” under the “Then” clause, and select your Decision Table “EmpHikeCalcTable”.

DecTable.jpg

Now below screen will appear.

DTable.jpg

Step10:Now create a web service from the Rule.Use the below navigation to create.

WS.jpg

Just Navigate through couple of screens and click on Finish button.

<—————————————————————–Building the BRM Project—————————————————————–>

Step10:Now we need to build the project by right clicking on project–>Development Component–>Build–>Click OK

DC_Build.jpg

<—————————————————————–Deploying the BRM Project—————————————————————–>


Step11:Now we need to deploy the project by right clicking on project–>Development Component–>Deploy–>Click OK

Deploy.jpg

<—————————————————————–Testing—————————————————————–>


Step12:You can test your BRM rule using WSNavigator

  Go to NWA–>SOA–>Application and Scenario Communication–>Single Service Administration

Testing.jpg

GIve your project relevant filter say “*empHike*”–>Click on Go–>Select your WSDL port type Name–>Click on WSDLs–>

Testing1.jpg

You can see two buttons “ZIP Download” and “Test”.First Click on “Test” ;it will navigate to WSNavigator page.

Select “invokeRules” and click on Next.

WSNav.jpg

Give the Input Values and click on next

TestInp.jpg

Below is the desired o/p.

Output.jpg

Now we are done with BRM part …. 🙂

In blog I covered ,calling the above BRM rules from SAP PO mapping(Using SOAP Lookup) and calling Directly from BPM by taking an use case.

For this pre requisite is downloading wsdl .In the above “Single Service Administration” click on Zip Download button and save the wsdl in your local machine.

Regards

Venkat

To report this post you need to login first.

3 Comments

You must be Logged on to comment or reply to a post.

  1. Donny Xu

    Simple and clear guide. Helps a lot.

    Just one question, for the rule TRUE == TRUE, is it mandatory to invoke the decision table? I mean even if I don’t have any rules, I still need one to access decision table, right?

    Cheers,

    Donny

    (0) 

Leave a Reply