
Visualising BRF+ expressions (part 1)
Previous blog posts explained the Business Rule Framework visualisation for functions, rulesets and rules. It gives you sufficient detail to make straightforward decisions within BRF+, using the available context.
The context exists of the function signature, function result and the additional variables defined within the ruleset.
![]() |
Function input |
![]() |
Function result |
![]() |
Ruleset input |
For example, a rule returns an error message when the combination of the material type and material group is not allowed.
You see that these types of validations are simple and do not take advantage of the capabilities within the Business Rule Framework tool.
You use expressions to add complexity in the decision making.
Expressions allow you to use the context to enrich the data within the BRF+ function, ruleset or rule. They are the foundation for modular development.
This blog post uses SAP calendars as an example of how to work with expressions.
The BRF+ function DAY_IS_WORKING_DAY exists to check if a specific date is a working day.
The result is the boolean element WORKING_DAY, returning either a true or false value.
Three types of input exist. The table CALENDARS contains all entries of the SAP table TFACS. The structure PLANT includes the configuration data of a specific plant from the SAP table T001W. The element DATE consists of the date to be checked and linked to the domain DATUM in the SAP data dictionary.
You only need one ruleset, named DETERMINE_WORKING_DAY.
Within this ruleset, you only want to check if the date is a working day.
You start with extracting the year, month and day from the DATE. New ruleset variables YEAR, MONTH and DAY are required. The expression for the formula fills the variables with a value.
![]() |
Expression: Formula |
You determine a value for a field using specific formula functions allowing you to play with mathematical equations, string manipulations and also date conversions.
You extract the year, month and day from a specific date via the formula functions DT_PART_YEARS, DT_PART_MONTHS and DT_PART_DAYS.
You continue with selecting the specific calendar for the plant, using the table operation expression.
![]() |
Expression: Table operation |
You can select a specific row in the CALENDARS table and store it in the new structure CALENDAR_SELECTED.
The selection criteria are the factory calendar of the plant, available in the field PLANT-FABKL and the YEAR from the date supplied.
You proceed with selecting the month of the selected calendar, utilising the case expression.
![]() |
Expression: Case |
The calendar details store the working days month-by-month in a specific field within the structure CALENDAR_SELECTED. The field MON01 represents January and MON12 December.
You use the MONTH from the DATE to select the calendar month in the CALENDAR_SELECTED and store the result in the new element DAYS_IN_MONTH.
The element DAYS_IN_MONTH contains a string of 0 and 1 values, each character representing a day. The first day of the month is the first character, and the last day the last character. The value 1 identifies a working day.
You can now create a new formula to determine the new DAY_IN_MONTH element, using the formula function SUBSTRING and element DAY to locate the working day indicator.
You now have all the information for a simple IF-THEN-ELSE statement.
If the DAY_IN_MONTH has the value 1, then WORKING_DAY is true, else WORKING_DAY is false.
Visualising this BRF+ function has the following result:
