Adding the Classes
Procedure
Creating the Web Module
-
In the SAP NetWeaver Developer Studio, choose .
-
In the wizard that appears, expand the Development Infrastructure node and choose Development Component . Choose Next .
-
In the screen that appears, expand the J2EE node, and choose Web Module . Choose Next .
-
In the screen that appears, choose the software component where you want to create the DCs. For example, expand the 'Local Development' node and choose MyComponents [demo.sap.com] . Choose Next .
-
In the screen that appears, enter buyer_wm in the Name field. Choose Finish .
The Java EE perspective opens and in the Project Explorer view, you should see the buyer_wm node.
Creating Classes in the Web Module
Make sure you are in the Java EE perspective.
-
In the Project Explorer view, expand the buyer_wm node and in the context menu of Java Resources: source node, choose
-
In the screen that appears, enter com.sap.buyer in the Package field.
-
Enter Buyer in the Name field and choose Finish .
You should see the com.sap.buyer node under the Java Resources: source node.
-
Double-click Buyer.java under the com.sap.buyer node.
The Buyer.java window appears.
-
Delete all existing lines and copy the following lines into the window:
package com.sap.buyer; import java.io.Serializable; public class Buyer implements Serializable{ public Buyer() { } String buyersname; String buyersspendinghabit; String buyerscredit; double setdiscount; public String getBuyersname() { return buyersname; } public void setBuyersname(String buyersname) { this.buyersname = buyersname; } public String getBuyersspendinghabit() { return buyersspendinghabit; } public void setBuyersspendinghabit(String buyersspendinghabit) { this.buyersspendinghabit = buyersspendinghabit; } public String getBuyerscredit() { return buyerscredit; } public void setBuyerscredit(String buyerscredit) { this.buyerscredit = buyerscredit; } public double getSetdiscount() { return setdiscount; } public void setSetdiscount(double setdiscount) { this.setdiscount = setdiscount; } } -
Press Ctrl + Shift + F .
-
Save the changes.
Defining the Public Parts
Make sure you are in the Development Infrastructure perspective.
-
In the Component Browser view, expand the Local Development node, MyComponents [demo.sap.com] node (the software component in which Development Component has been created), and double-click the buyer_wm 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 .
You should see the public node under the Defined Public Parts section.
-
In the context menu of the public node, choose Manage Entities .
-
In the screen that appears, under the Entities section, expand the Java Class , com , sap and buyer nodes, select the Buyer java class checkbox.
-
Choose Finish .
Adding Dependencies to the Rules Composer DC
-
In the Component Browser view, view, expand the Local Development node, MyComponents [demo.sap.com] node (the software component in which Development Component has been created) and double-click the buyerrules 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 buyer_wm checkbox. Choose Next .
-
In the screen that appears, under Dependency Details section, only select the Design Time checkbox.
-
Choose Finish .
-
In the Dependencies tab page, expand the buyer_wm 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 buyerrules node, choose Build . Choose OK .
-
Check the Infrastructure Console for message.
Adding Classes to the Rules Composer DC
Make sure you are in the Rules Composer perspective.
-
In the Project Explorer view, expand the buyerrules node, the Rules Modeling node and double-click the Project Resources node.
-
In the Project Aliases Editor that appears, choose the Aliases tab and in the tab page that appears, choose the Add button and in the menu that appears choose Class .
-
In the dialog box that appears, expand the com.sap.buyer node and double-click Buyer .
-
Choose Finish .
-
In the Alias Name section, expand the Buyer node and select all the relevant classes.
-
Save the changes.
Next Step

