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.
Step2:In the XSD tab of the Message Type, copy or export the XSD to a local file.
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.
Select Development Component and Click on Next
Select the Rules Composer and Click on Next
Select MyComponent under LocalDevelopment and click on Next.
Name the project as per your functionality and click on FInish.
Step5:Import the XSD into the Project .
select xsd option and click on next
Now browse your xsd file from your local machine and click on Finish.Now we can see our XSD Imported into our Project.
Step6:Add the XSD by double-click on “Project Resources”, select the “Alias” tab and click on “Add” and select “XSD Element”:
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.
Step7:Create a ruleset by right-click on “Rules Modeling” and select “New Ruleset”:
Give the name to ruleset and click on OK.
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…”:
Give the name for DecisionTable and click on Next
Select Grade and Region as the conditions of the table (These are the inputs) and click on down arrow button
Click on Next
Select the Action HikeCalc/Region and click on down arrow button ,now below screen will appear.
Click on Finish.
Now for adding condition ,Right click on DefaultValue under HikeCalc/Grade column and click on "Add Condition Values by Pressing Ctrl++"
Give the values (one value in one line) and click on OK.
Repeat the same for HikeCalc/Region.
Now enter the Values for HikeCalc/Hike by double clicking and entering values manually.
Step9:Now Create a Rule by double clicking on Rules folder-->New Rule
Give the name for the Rule and click on OK.
Double click on below highlighted rule
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.
Now assign the Decision table by clicking on “+” under the “Then” clause, and select your Decision Table “EmpHikeCalcTable”.
Now below screen will appear.
Step10:Now create a web service from the Rule.Use the below navigation to create.
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
<-----------------------------------------------------------------Deploying the BRM Project----------------------------------------------------------------->
Step11:Now we need to deploy the project by right clicking on project-->Development Component-->Deploy-->Click OK
<-----------------------------------------------------------------Testing----------------------------------------------------------------->
Step12:You can test your BRM rule using WSNavigator
Go to NWA-->SOA-->Application and Scenario Communication-->Single Service Administration
GIve your project relevant filter say "*empHike*"-->Click on Go-->Select your WSDL port type Name-->Click on WSDLs-->
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.
Give the Input Values and click on next
Below is the desired o/p.
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