Step-by-step guide to use BRM (Business Rules Management) using Java Classes

...Previous

Assign a package for this class named as “com.sap.travelrules” and name our class as “Travelrules”. Add the contents to the “Travelrules.java”.  

In this class we have to write setter and getter methods for input and output fields.  

In our example, as we are dealing with Travel Rules which can defined using the grade of the Employee and Trip location.  

Hence Employee name, Grade and Trip type will be the input parameters. And all the allowances like airfare, daily allowances, food allowances, and accommodation etc., will be our output parameters. As well in this class we will provide setter and getter methods for the all the I/O parameters. For generating Setter/Getter methods, right click in the class, choose Source and choose Generate Getters and Setters.  

The class will look like the following

Fig 10.  

After creating the class, go to Development Infrastructure perspective, and add public node to it, by choosing Add in the Public Parts tab. The steps for doing this is  

Ø       In the Component Browser view, expand the Local Development node, MyComponents [demo.sap.com] node, and select the travelrules_web node.

Ø       In the Component Properties view, choose the Public Parts tab and in the page that appears, choose Add.

Ø       In the screen that appears, enter public in the Name field. Choose Finish.  

After adding the public node, it will appear as the Figure 11.  

Next in the context menu of the public node, choose Manage Entities and

in the screen that appears, under the Entities section, expand the Java Class, com, sap and TravelRules nodes, select the TravelRules java class checkbox and choose Finish. It will look like as Figure 12.  

Fig 11.  

Fig 12.  

After this we have to add Dependencies between our Development components. For this,  

Ø       In the Component Browser view, expand the Local Development node, MyComponents [demo.sap.com] node and double-click the TravelRules node.

Ø       In the Component Properties view, choose the Dependencies tab and in the page that appears, choose Add.

Ø       In the dialog box that appears, expand the MyComponents node and select the travelrules_web checkbox. Choose Next.

Ø       In the screen that appears, under Dependency Details section, select the Design Time, Deploy Time and Run Time checkboxes.

Ø       Choose Finish.

Ø       In the Dependencies tab page, expand the travelrules_web node and choose the war node. Choose Remove and in the dialog box that appears choose Yes.

Ø       In the Component Browser view, expand the MyComponents [demo.sap.com] node and in the context menu of the travelrules node, choose Build. Choose OK.

Adding Classes to the Rules Composer DC

Get into Rules Composer perspective.  

Ø       In the Project Explorer view, expand the travelrules node, the Rules Modeling node and double-click the Aliases node.

Ø       In the Project Aliases Editor that appears, choose the Class Aliases tab and in the tab page that appears, choose the Add Classes tab.

Ø       In the dialog box that appears, expand the com.sap.travelrules node and double-click travelrules as shown in the figure 13.

Ø       Choose Finish.  

Ø       Under the Aliases Name section, expand the TravelRules node and select all the relevant classes.

Ø       Save the changes.  

Fig 13.

Creating the Ruleset  

In the Project Explorer view, expand the travelrules node and in the context menu of the Rules Modeling node, choose New Ruleset.  

In the dialog box that appears, enter travel_rules in the field. Choose OK.

In the Project Explorer view you should see the travel_rules node under the Rules Modeling node as shown below:  

Click here to continue...

 

Please send us your feedback/suggestions at webmaster@SAPTechnical.COM 

HomeContribute About Us Privacy Terms Of Use • Disclaimer • SafeCompanies: Advertise on SAPTechnical.COM | Post JobContact Us  

Graphic Design by Round the Bend Wizards

footer image footer image