
Visualising BRF+ rules and rulesets
The Business Rule Framework uses rules to determine a result based on an IF-THEN-ELSE structure.
The IF statement defines a condition that can be either true or false. When the IF statement is true, you set the actions in the THEN section. Otherwise, you use the ELSE section to list the tasks when the IF statement is false.
You have the ruleset to group the rules within a function by setting a sequence.
A function must have at least one ruleset that consists of at least one rule.
![]() |
Ruleset |
![]() |
Rule |
The ruleset can have a precondition. You want to use this to skip the rules within this ruleset and speed up the function processing time.
The rules will use data to determine the result. The data supplied in the function signature is available for decision making. When additional data is required, then define other variables within the ruleset.
The sequence in which variables added in the ruleset is essential. For example, when you have two additional variables, A and B, for the ruleset. When the value of A is needed to determine B, then define variable A before B.
![]() |
Ruleset precondition |
![]() |
Ruleset input |
The input parameters in the function and ruleset are also called the “context”. The context is an overview of all the data accessible to make a decision.
Imagine you want to select a specific factory calendar influencing a decision in a rule. You can supply all calendars as table CALENDARS via the function input parameters. The ruleset will define a new variable that filters all supplied calendars to only keep those linked to a specific factory calendar into CALENDARS_SELECTED.
The table CALENDARS uses the structure CALENDAR linked to the SAP data dictionary TFACS.
You cannot use the structure CALENDAR again to define another BRF+ table. Instead, you need to create a new structure CALENDAR_SELECTED, also linked to TFACS, as the basis for identifying the table CALENDARS_SELECTED.
The context contains two tables CALENDARS and CALENDARS_SELECTED and two structures CALENDAR and CALENDAR_SELECTED.
The table CALENDARS can contain all calendar information in the SAP database and passed to the BRF+ function. Then the ruleset can decide how to filter the data. One ruleset might filter on the plant, whereas other rulesets use the customer unloading point or shipping point.
The rule can have unlimited statements to get to a final result. The sequence of the steps within the THEN or ELSE section is important.
When the rule has two steps then they are processed sequentially top-down.
Assigning values to the context is done via expressions, explained in another blog post.