Skip to content

ABAP Keyword Documentation →  ABAP - Reference →  Program Flow Logic →  Conditional Expressions 

COND, SWITCH - result

Other versions: 7.31 | 7.40 | 7.54


...   operand 
  | { THROW [RESUMABLE] cx_class( [p1 = a1 p2 = a2 ...] ) } ...


1. ... operand

2. ... THROW [RESUMABLE] cx_class( [p1 = a1 p2 = a2 ...] )


These strings specified after THEN and ELSE in the conditional expressions COND and SWITCH determine the result of the expression if the appropriate branch is selected.

Alternative 1

... operand


If an operand operand is specified, its value is converted to the data type type, if necessary, and returned as the result of the conditional expression. operand is a general expression position with the following restrictions:

  • If operand is specified as a bit expression, type must be byte-like.


When an operand is selected, the condition operators COND and SWITCH create a temporary data object (from a technical perspective) whose data type is determined by the specified type and whose content is determined by the selected operand. This data object is used as the operand of a statement and then deleted. It is deleted when the current statements is closed or after the analysis of a relational expression once the logical value has been determined.

Alternative 2

... THROW [RESUMABLE] cx_class( [p1 = a1 p2 = a2 ...] )


If THROW is specified, an exception of the following exception class cx_class is raised in accordance with the rules of the statement RAISE EXCEPTION. Here, the input parameters p1, p2, ... of the instance constructor can be filled with the actual parameters a1, a2.


  • If the exception class is specified after THROW, the parentheses must always be specified, even if no actual parameters are passed. EXPORTING cannot be specified, nor does it need to be.