!--a11y-->
Expression Type 
Defines how an expression is calculated. In turn, the expression type is determined by the implementing class.
“Implementing class“
is more of a technical term. It is used synonymously for expression type (and
also action type) in the sense of “implementing class of an
expression”.
SAP delivers the following standard expression types. You can also add own expression types:
· Constant (Implementing Class 0CN001)
The constant is the trivial expression type. Apart from the value and the typing, usually no other information is required.
With currencies (result type M), the currency key must also be specified.
The date and time (result type D, T) must be specified in the technical format (YYYYMMDD or and HHMMSS).
The Boolean value TRUE is represented by "X“, and the value FALSE by SPACE.
· Simple value request (field of a structure)
Use this expression type if the required value is in a structure in the application. For example, if you want to determine the current user in the SAP system, the system accesses the uname field in the SYST structure (sy-uname).
The application must only contain an access function module that makes the structure available to the BRF. The BRF then extracts the particular field itself.
You can find more information under
Making
Application Data Available to the BRF.
To create own data source modules you can use
the module BRF_DATA_GET_TEMPLATE as a copy template. In function group
BRF_DEMO you can find further examples for data sources (get-
modules).
· Field of a line of an internal table (0TB001)
This expression type operates in the same way as the expression type Simple value request (field of a structure).
In addition, you must specify the corresponding table line using a SELECT mechanism: SELECT <FIELD> FROM <ITAB> WHERE <CONDITION>.
<ITAB> must be available via an access function module (data source), and <FIELD> must be a component of the internal table <ITAB>.
The type of a the internal table
must refer to the data dictionary (DDIC).
<CONDITION> describes the selection condition in a simple form. In <CONDITION>, simple comparison operations may be performed (<, <=, =, >=, >, <>), whereby you can use AND and OR to link them with one another sequentially (in other words, without considering the priority of the operators) and without compounding.
· Call function module/method (0CF001)
Use this expression type if no other expression types in the BRF are suitable for the purpose in mind.
A special expression can be implemented in a function module. You can also transfer parameters (such as other expressions) to the function module. In theory, you can realize any value request and any operation in this way. You can use function module BRF_CALL_FUNCTION_TEMPLATE as a copy template.
Using this expression type you can also call the Business Add-In (BAdI) BRF_EXPRESSION. The filter values for the BAdI are stored in view M_TBRF330.
However, we recommend that you use this
expression type only for expressions that are required infrequently, as the
special features of the function that might be behind the function module
cannot be considered. Maintenance of the expression in the BRF is unable to
consider these special features.
With frequently used expressions, you should implement both the runtime class and the maintenance class, in other words add own expression types.
· Three-operand arithmetic (03O001)
Using this expression type, which has a Boolean result type, you can link three Boolean expressions logically with one another. In addition to the simple links “A AND B AND C” as well as “A OR B OR C”, you can also use the compounded links “(A AND B) OR C” as well as “A AND (B OR C)”.
You can also negate each A, B, C expression.
· Simple formula (0FR001)
Sometimes it is rather tedious to derive facts from existing expression types. Instead, use the simple formula.
With the aid of the simple formula you can perform simple arithmetical and logical calculations that consider the sequence of the operators and compounding.
· SAP formula interpreter (0FB001)
This expression type operates in the same way as the simple formula expression type. However, as this expression type uses the SAP formula editor/formula interpreter, it is far more powerful than the Simple Formula.
You can use the SAP formula editor to define time-dependent expressions as well.
The time functions are available in the SAP formula editor in function category TIME_FUNC (date and time functions). They can only be called in connection with the Business Rule Framework via the class interface CL_FOEV_TIME_FUNC_BRF. For more information on the time functions that are available, see the class documentation and the class methods.
· Truth table ("bit pattern recognition") (0PM001)
Use this expression type in the environment of configurable status administration. All the incoming expressions in a truth table have a Boolean result type. A truth table always delivers a scaleable return value.
The following example describes how a truth table functions:
Return Value |
Expression 1 |
Expression 2 |
Expression 3 |
3 |
True |
* |
False |
1 |
True |
True |
* |
4 |
* |
* |
* |
The system calculates expressions 1 to 3 at runtime. Then the system checks each line one by one to see if the bit pattern matches the current line.
¡ If the bit pattern matches, the return value of the corresponding line is given as the result of the expression. All other lines are ignored.
¡ If the bit pattern does not match, the system checks the next line.
¡ If the bit pattern does not match any line at all, the behavior is not defined. For this reason you should explicitly introduce a last line in which each column contains an asterisk (*).
An asterisk means that the value of the expression of the corresponding column is irrelevant. For example, you get the return value 3 with TRUE/TRUE/FALSE and also with TRUE/FALSE/FALSE. In this case, the value of expression 2 is irrelevant.
Examples:
¡ (True, True, False): Return value 3, as the first line already matches.
¡ (True, True, True): Return value 1, as the second line already matches.
¡ (False, False, True): Return value 4, as only the third line matches.
We make the following
recommendation:
If you are not sure whether you have explicitly checked all possible combinations, add a last line that contains an asterisk (*) for each expression and that returns a value. In the area of status calculation, this value could have the meaning "unexpected status“.
· Case expression (0CE001)
You can use this expression type to assign just one of multiple sub-expressions or literals to the result of the case expression, depending on the case variables.
The default branch is displayed at the beginning of the WHEN list, but a run is only performed if none of the listed WHEN values match the value of the case variable.
· Date interval (0DI001)
When you create an expression of this type, the system checks whether the date to be tested is within the limits or on the limits of the date interval. If this is the case, the expression, whose result is always Boolean, delivers the value TRUE.
The date to be tested can either be the point in time "now“ (in other words, the system date at the time this expression was calculated) or a different expression with the type D (date). The limits can be literals or expressions of type D (date). This expression type only operates “accurately to one day“.
· Random generator (0RV001)
You can use the random generator expression type in two variants:
¡ Variant 1:
The result is Boolean. A configurable share of TRUE results is created. You can specify this share statically as a literal, or dynamically as an expression.
¡ Variant 2
An integer number between 0 and the specified maximum value is created. The maximum value is determined statically or dynamically by another BRF expression.
· Range Expression (0RE001)
A range expression checks whether the value of a check expression is within the specified range conditions. It behaves similarly to the select options.
You can define both single values as well as intervals. These single values or intervals can be either “inclusive” or “exclusive”.
A range expression always has a Boolean result type. The relevant result of the range expression has the following meaning:
¡ TRUE
The range expression delivers the value TRUE if all the following conditions are met:
§ The value of the check expression corresponds to an inclusive single value or is within an inclusive interval.
§ The value of the check expression does not correspond to an exclusive single value and is not within an exclusive interval.
¡ FALSE
The range expression delivers the value FALSE if one the following conditions is met:
§ The value of the check expression corresponds to an exclusive single value.
§ The value of the check expression lies within an exclusive interval.
§ The value of the check expression does not meet any range conditions.
· AND / OR Linking of Expressions (0AO001)
You can use this expression type to “AND” link or “OR” link any expressions that have a Boolean result type.
· Reference-Like Expression (0RF001)
This expression type is the only expression type in the BRF that has a non-primitive result type, namely result type R (for Reference Acc. To DDIC Type). The result of this expression type is a reference to a structure or an internal table. Access is performed in the same way as with the expression types Simple Value Request (0SM001) and Field of a Line of an Internal Table (0TB001) via data sources.
Specify the following attributes:
¡ Specify whether you want to access a structure or an internal table.
¡ Specify the DDIC definition according to which the structure or the internal table has been declared.
If access is successful, the system displays the data source module and the exact typing of this BRF expression. If access fails, this is usually because the data source has not been defined.
You can only use reference-like expressions as sub-expressions in the action types Start Workflow (0WF001) and Trigger BOR-Event (0BE001) to fill the Workflow-Container with structure-like or table-like attributes.