sapdev logo background
sapdev logo sapdev logo
Comments

SAP CONDITIONAL EXPRESSION RESULT documentation, setup help and example usage



Return to SAP documentation index



COND , SWITCH - result

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

ABAP_ALTERNATIVES:
1 ... operand
2 ... THROW [RESUMABLE] cx_class( [p1 = a1 p2 = a2 ...] )


Effect
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.

ABAP_ALTERNATIVE_1 ... operand


Effect
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

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


  • Note
    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.

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


    Effect
    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 .

    Notes
  • 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.
  • Like the statement RAISE EXCEPTION

  • , THROW cannot be used in a method or function module in whose interface non-class-based exceptions are declared. Also, the statement does not permit simultaneous use of the statement CATCHSYSTEM-EXCEPTIONS for the obsolete handling of catchable runtime errors , and the statements RAISE
    or MESSAGE RAISING to raise non-class-based exceptions in the current processing block.
    Documentation extract taken from SAP system, � Copyright SAP AG. All rights reserved




    CONDITIONAL_EXPRESSION_GLOSRY
    CONDITIONAL_EXPRESSION_SWITCH




    comments powered by Disqus