A BRF+ function can run in functional mode, event mode, or both. What is the difference, and which would you choose for a rule that must check an order and also log why it was rejected?
Say your answer out loud first.
Practise another way
Functional mode needs a top expression, often a decision table, and returns its result: good for clear questions like 'which discount?'.
Event mode has no top expression; it processes the assigned rulesets, whose rules have conditions and actions, and the result is the table of actions performed.
Functional and event mode runs the top expression first and then the rulesets. For check-plus-log I would use event mode or the combined mode, with a log message action, and return a clear result.
Functional mode The function needs a top expression and a result data object. At runtime the function evaluates the top expression, which may nest others (a decision table calling a formula, for example), and returns its result.
Use it when the caller asks a question with one clear answer: a discount, an approval level, a G/L account.
Event mode There is no top expression. The function processes its assigned rulesets. Each ruleset contains rules; a rule has a condition and operations, and can be restricted by preconditions, time dependency and an enabled flag.
When a condition holds, the rule processes expressions, changes context values or triggers actions such as log message, send e-mail, start workflow or procedure call.
The predefined Actions table, listing what ran, is the result data object. SAP Learning notes that the calling program usually does not expect a particular value back in this mode.
Functional and event mode A top expression and result data object are mandatory, and after the top expression the rulesets run. This fits 'compute a value, then react to it'.
Rulesets in practice
- A function can have several rulesets; you define their order (priority). One ruleset can serve several functions.
- Rules can only use context data shared by every ruleset they belong to.
- Helper values for intermediate steps go into ruleset variables, which can be initialised at the start of the ruleset.
The check-and-log scenario The rule must return a decision (accept or reject) plus a reason in the application log.
Function CHECK_ORDER mode: functional and event
Top expression: decision table DT_ORDER_CHECK
-> result REJECT_REASON (initial = accepted)
Ruleset RS_LOG
Rule: IF REJECT_REASON is not initial
THEN action LOG_REJECTION (log message, object ZSD, sub-object CHECK)
The caller reads the reason from the result. The log action writes to an application log object (maintained in SLG0, read in SLG1).
A caution on actions If this function is called inside a RAP transaction or a BAdI, a persisted log message or a started workflow is a side effect at the wrong moment.
Either log in memory and let the caller persist, or keep the function in functional mode and let the application log.
Explains top expression versus rulesets, what each mode returns, how rulesets are ordered, and chooses a mode for the scenario with the side-effect risk in mind.
Thinks event mode is about SAP events or workflow events, or cannot say what the function returns in each mode.
Choosing event mode and then expecting a business value back. In event mode the result is the list of actions performed, unless you also use functional mode.
- What is the result data object of a function in event mode?
- How do you control the order of two rulesets on one function?
- What is a ruleset variable, and when do you need one?
3 official pages. Confidence: high. Checked 3 Dec 2026.
- Official page Backs the answer.
- Official page Backs the answer.
- Official page Backs the answer.