Show TOC

Background documentationCase Expression

 

The Case expression is used for modeling use cases where you want to compare an incoming value against a predefined list of discrete values that you already know in advance. Examples of such a closed list of known values could be values indicating different country or region codes, means of transportation, tax codes, and so on. If an input value occurs that has not been foreseen, you can deal with that with an optional Otherwise branch, covering all the values that are not explicitly treated by the expression.

Structure

The BRFplus Case expression is similar to the ABAP CASE statement. The expression takes an input parameter from the context (the case parameter) and checks its value against a number of test parameters.

For each of these test parameters, a corresponding return parameter is specified in the When table. As soon as one of the test parameters matches the case parameter, the corresponding return parameter is evaluated and a result is returned. If none of the specific test parameters matches the case parameter then a generic parameter is evaluated in order to specify the result.

All parameters can be context data objects or nested expressions. Typically, the case parameter is a context data object, the test parameters are constants and the result parameters are nested expressions.

Features

Result Type

You can decide whether a case expression shall return a value or perform an action:

  • Return Value: In this mode, you have to take care that all comparison values have a return value or expression assigned with the same type as the result data object of the case expression.

    Note Note

    When defining a case expression in the BRFplus workbench, first assign a result data object to the expression before you start to define the results for the comparison values. Only under this condition the system gives you access to suitable expressions, default objects (like the current user or the logon language), or lets you enter result values directly. With no result data object defined, you can only assign element data objects to a comparison value as a result.

    End of the note.
  • Perform Action: In this mode, the case expression triggers the action assigned to the return value that matches the input. The result data object is automatically set to the predefined Actions table that returns the list of IDs of the actions (result action plus follow-up actions that may be associated with that action) that are executed.

Once the result type settings have been made and the expression has been saved, the system displays these settings in the Detail section of the UI by default.

Note Note

Changing the result type settings leads in most cases to the need for a complete reassignment of objects to the comparison values of the expression. We therefore recommend to take extra care before you decide to change the result type settings of an already defined case expression.

End of the note.
Case-Sensitivity

If you assign a context data object of type text as the expressions case parameter, the system lets you define whether the value comparisons shall be done in case-sensitive mode or not.