Skip to Content

BRM integration in BPM (Java Class)

This is my first blog in the SDN.

I would like to share my experience in exploring the integration of BRM’s Rules Composer in BPM’s Process Composer with EHP1 Netweaver CE 7.1. After following the example tutorial “SAP Netveaver BPM – End to End Process Implementation Example“, i’d decided to add a simple rule to the example process in the tutorial with rule composer 🙂 


1) Completed the above example tutorial.

2) Make sure that the latest file is deployed to avoid the BRM bug, as explained in details in the blog BRM application deployment issue with SDN CE 7.1.1 Preview Version 


The tutorial is about building a process flow that will let a User_A to enter the name and age in a Web Dynpro UI form (as a UWL task in the portal), then the data entered will be sent to the User_B (also as a UWL task in the portal). I will add a simple rule to this process, ie, if the entered age by User_A is greater than 30, then it will return a comment as “old” and then send the task to the User_B, else if it’s below 30, comment as “young” and send the task to User_C, depicted by the following diagram.


Figure 1: Process diagram in the process composer.

Process Flow Diagram


By the way, i will not show a “dried” step-by-step guide here. Also, i dont intend to insult those with age over 30 as “old” 🙂 I’m an olddie myself. 

There are 2 ways of creating the rule with rule composer, ie, Java Class and XML. In this blog, i will share how to use the Java Class. Next blog, if there is, i will share how to use the XML file. 


1)  Create our new rule – if the age is more than 30, then set the “Comment” as “old”; if the age is below 30, set the “Comment” as “young”. 


    a) Create a java bean class with 3 attributes, ie, “Name”, “Age” and “Comment”, with getters and setters. can be placed in the Web Dynpro project “wd_ui_mna” as was created in the example tutorial. Exposed it as public part, as shown below.


Figure 2: Exposed as public part. 

public part  

Please refer to Model your Business Rules in Rules Composer and this tutorial for a more detailed step-by-step guide to compose business rule.


   b) Create a new Rules Composer DC project and add the NameAge class as an Alias.


Figure 3: as an a Alias.


      c) Create a new ruleset called “agerules” and add 2 new rules, one is called “YoungAge” and another is called “HighAge”. Build and deploy the DC.


Figure 4: “YoungAge” rule in “agerules” ruleset.


Figure 5: “HighAge” rule in “agerules” ruleset. 



2) Integrate rule into Web dynpro – Web Dynpro UI will invoke the rule engine by passing the entered age by User_A, and based on defined rule, get the comment accordingly.


   a) In the “wd_ui_mna” Web Dynpro DC project -> C_FillMyNameAge component, create an additional context attribute “Comment” of type String in the Component Controller and copy it to the Interface controller of the Local Component Interface. Lastly, map the “Comment” attribute to the View Context. This is the same step as what was shown in the example tutorial for “Name” and “Age”.


Figure 6: View context attribute “Comment”. 



    b)  To invoke the above defined rules in rules engine, add the following codes in m_FillMyNameAge method in C_FillMyNameAge’s component controller (  


Figure 7: m_FillMyNameAge method in


    c) Create a new java class as in this tutorial, page 22. But, change the RemoteHome to LocaHome in the getRuleEngine static method.

Note: More information on looking up rule engine can be found here.


Figure 8: getRuleEngine static method in the



    d) Re-create the public part “API” C_FillMyNameAge and C_DisplayMyNameAge component. Build and deploy the “wd_ui_mna” Web Dynpro DC.


3) Create a new role and human activity for the User_C, to receive a UWL task, if the “Age” entered by User_A is more than 30.


   a) Re-add the “wd_ui_mna” to the “dc_my_name_age” Process Composer DC Project in the “Required DC”, since the public part “API” has been changed.


Figure 9: Re-add the “API” of the “wd_ui_mna”.



    b) Create a new role, human activity and Exclusive choice 0 gateway in the process composer as in the Figure 1.


   c) Re-add the process context “DO_Context”. “DO_Context” will now have the additional attribute “Comment”. Re-map the “Output Mapping” of the first human activity “Fill Name Age” to reflect the changes.


Figure 10: Re-map the “Output Mapping” -> “TaskOutput” -> “UIResponse” for “Fill Name Age” activity.


    d) Create a new task called “DisplayMyOldNameAge”, which has been assigned to User_C, as below. The step to create a User_C in the UME is described in the example tutorial. The task will have the UI from the “wm_ui_mna” WebDynpro DC (same as for User_B).


Figure 11: Role assigned to User_C.


Figure 12: UI assigned to the “DisplayMyOldNameAge” task.



    e) Create a condition for the “Old” connection and set the “Young” connection as default, as following.


Figure 13: “Old” condition must matched the value “old” in the “Comment” of the context attribute.


    f) Build and deploy the “cd_my_name_age” Process Composer DC.


4) Test the process flow – go to “Configuration Management” -> “Processes and Tasks” -> “Process Repository” and start the process.


Figure 14: User_A login to portal and enter name and age in a portal UWL task.


Figure 15: User_C login to portal and open the a received portal UWL task.



Did i mention that this is not going to be a “dried” guide? ohh, i was wrong 🙂

You must be Logged on to comment or reply to a post.
  • Hi,
    May I know where did you add the EngineInvoker class?
    I added the class into my wd_ui_mna project but the build keeps failing with the following error:
    “cannot access javax.ejb.EJBLocalHome. file javax/ejb/EJBLocalHome.class not found”
    at the line:
    “return (RuleEngine)home.create();”
  • Dear Julius,

    Excellent Blog!
    I am really glad to find my end-to-end example extended with a business rule and I believe your example will help the BPM community members to go further with their SAP NetWeaver BPM and SAP NetWeaver BRM experience!

    Kind regards,
    Donka Dimitrova

    • I would like to add that, both your blogs are good.

      @Donka – The pdf was well written and it didnt take me much to complete it. Thanks for describing even the minute details like putting a semicolon after the java code :).

      Looking forward for more articles from both of you along with others 🙂

      – antony

  • Hallo,

    thank you very much for this interesting tutorial!!!

    I did everything you said in the tutorial. All my components can be deployed. My problem is now is that my process is getting automatically suspended from server after i fulfilled the the first task of UserA. I believe that there is a problem with the rule engine, but i don’t get an error message anywhere. I tried to build try catch block inside the mehtod m_fillMyNameAge and in case of exception put the exception message in the variable Comment. But even doing that, when i am in the Process Instance view of NW server and i select the “Context Data” tab of “Details of Process Instance” and then select to DO_Context object, only the Name and the Age are filled with data the Comment attribute is not even listed.

    Does anybody have any suggestions and ideas on that problem?
    Please help!!!

    • Could you access the WDP URL directly (without going through task in the portal) and trigger the rule? Try to display the result message or exception.
      • Hello Julius,

        Thank you very much for answer. In order to catch the massage i build a Web Dynpro application and i try to find out the position in the code where the problem is. After some outputs, I figured  out that the attribute Comment remains null because in the NameAge object the attribute comment is not properly set. I modified the following code in my method where i call the rule:

        if (obj instanceof String) {
        if (obj.equals(“old”)) {
        } else if (obj instanceof NameAge) {
        } else {
        wdContext.currentContextElement().setComment(“Object to String:  ” + obj.toString()+ ”  Class ” + obj.getClass());

        the result is that i get following error message “Object to String:  Error in fact.eval  Class class java.lang.String”

        As I searched so far in the Forum I believe that that the agerule doesn’t have any access to the NameAge Class of the Web Dynpro component in order to set the value, eventhough the depency to the wd comp. is there. At this point I tried to build and deploy every component again, but the result remains the same.
        Any suggestions what I should do next?

        Kind regards