BRF+ allows only scalar data elements and expressions as columns in decision tables. Conditions on non-scalar values (tables) usually require you to add expression columns with scalar result values. This approach therefore requires changing the decision table settings every time a check for a new value needs to be tested for.
An alternative is to use the boolean constant expression True as a column and to add the table expressions directly into the cells of the decision table.
We use a SAP workflow solution that can be configured entirely via BRF+ (rule-based Workflow of SAP Master Data Governance). We want to implement the following rules:
- If data governed by a certain department (e.g. controlling) was changed, request approval from that department
- Else skip the approval
The list of content owner departments (more than 10) is known, but can of course change over time. There is one approval path in the workflow for each of the departments. While on the path, a BRF+ rule is queried to determine whether the actual approval is required or not.
In a request process, an arbitrary number of data fields can be changed. Each data field is assigned to exactly one group, but there is no restriction on the number of field groups in a change request.
The implementations shown are reduced to the decision table. Instead of outputting the values needed to steer the workflow, we just use some log actions to showcase the idea.
In the standard approach, we create expressions with scalar return values (here: Boolean). Each expression searches for the occurrence of a given field group name in the list of changed field groups.
The resulting decision table schema looks like this:
Now we can fill the decision table like this:
While this solution is working, adding a new field group requires changing the table schema, a change that requires re-testing of the table, since this change affects the complete decision table. Also, the table gets harder to maintain as we add more values to check for, as each value requires a new column.
Expression in row
An alternative implementation inverts the notion of value and expression by placing the constant expression True in a column and the expressions into the rows of the table.
The table schema is depicted in the following image. Note that you can get the constant True by clicking the “include FDT standard application” check-box in the context search dialog:
In the table, add the expressions by choosing Select… from the context menu of the table cell. We can re-use the expressions created for the first approach here, as long as those expressions return a boolean value:
- The condition on the Amount value was added only for instructional purposes, to show that you can place any condition into the table cell as long as its return value is of type boolean. Since Amount is already a scalar value in BRF+, you should rather use it in a column of its own, since this form is much less expressive than the original range expression on a dedicated column.
- You cannot use a range expression on Amount directly in the cell, despite that range expressions also have a boolean result type. Trying to do so gives an error message about “True is not used as input”. To work around this issue, use a boolean expression that contains the range.
I hope this tip is something new & useful for the community. I have found a ton of interesting material in the forums and blogs already that helped me in my project, and I hope I can give something back this way. BRF+ is a fun & exciting tool to work with, and I want to thank Carsten Ziegler for writing & constantly improving it. 🙂