Skip to Content

Expense Statement Demo with BRM

In my previous blog Easy process implementation with SAP NetWeaver BPM, I described how easy it was to model and implement a process with SAP NetWeaver BPM which is included in the SAP Composition Environment 7.1 EHP1. At that time I also wanted to use a business rule, created with BRM, within my Expense Demo process. Unfortunately I did not succeed in that. With the help from Arti (SAP Product Management BRM) we found out that this issue was due to the download version I was using.
I used build id: 200809132152, downloaded in October 2008. Now with the current download (January 2009) I have build id: 200811082206. Even the SAP NetWeaver Developer Studio got an update, more on this build ID and how to find out can be found in my forum question: Integration of BRM within BPM does not work.

These updates made my BRM life much easier as I have my demo process now running as expected. Here’s a recap of what I did to implement the rule in my Expense Demo.

Process

I started off with the same process as used in December, the only difference is that a mapping step is added right after the ‘Enter Expense’ step.
In short: the entered expense is validated on amount height. When it is under 25 – automatic approval is applicable. When above, the manager has to approve or reject.

process with BRM

Ruleset

To create a rule, you first have to create a rule set:

Ruleset editor
 
At ‘Return type’ you need to state the context that you want to use in the rule set. Good integration realized by SAP: you can reuse the context from the Web Dynpro applications. I reused the same context as I used for the process project, the one from the first step: ‘Enter Expense’.
The ‘Parameter’ arg1 is also based on this same context. And at ‘Result’ you specify the arg1 parameter.
Take care as you can not change this Signature once it has been created. Bit strange though.

Rule

The ruleset is finished and now you can create your rule.

Rule start screen

When you click on the plus sign under the If statement you get a default condition. Each part can be changed according to your wishes by clicking on it. First it turns yellow and then you get a popup where you can specify the argument.
Here I select the ExpenseAmount field from the context as I want this field to be validated.

Next step is to define what needs to be done when the If statement is applicable. In my demo I want to set the Approved field to True.
Click on the plus under Then and specify the method.

When you’re finished it will look like this:

Final rule

 

Mapping

Back in the process you need to specify that you want to use the rule. This is handled in the mapping step ‘Validate Expense’. Make sure that the mapping line from DO_Context to DO_Context is selected (orange line) and select the Expression editor button. In the popup search for your rule under Rules and Functions. Double click on it and it will appear on the left side of the popup. Make sure that the context is placed between brackets.

mapping

For the gates from the gateway the proper conditions need to be specified.

For ‘Auto approval’: DO_Context/Approved=true.
And for ‘Manager approval’: DO_Context/Approved=false.
 

Now build, deploy and run your process.

Hope you have as much fun as I had in using SAP NetWeaver BPM with BRM. Next step for me is to integrate a real backend system in the scenario and to model the applications with the Visual Composer – but that will be for a next time.

I have created a ‘tutorial’ movie on this, hope it is useful to you, despite the blurriness.

To report this post you need to login first.

5 Comments

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

  1. Marilyn Pratt
    Hi Twan,
    Perhaps it should be clearer where you attached the video.  You can either link using the url field of the blog or embed it directly into the blog itself.
    Glad you share your challenges and create tutorials for others to follow.
    (0) 
    1. Twan van den Broek Post author
      Hi Marilyn,

      Thanks for your reply, I did embed the Google video at the bottom of the blog. I now also added the direct URL to the video on top of the blog.

      Kind regards
      Twan

      (0) 
      1. Twan van den Broek Post author
        hmm it appears that the embedded video is not visible at some locations. It should be at the bottom of the blog. Don’t know why, -security?-
        Anyway, the direct URL can be found on top of this blog.
        (0) 
  2. chandru m
    Hi,
       Nice blog. I tried to do the same. But the mapping step is not workin for me. The changes of the values done in the BRM is not reflected after mapping.

    Please guide in this.

    (0) 

Leave a Reply