Ansicht
Dokumentation
ABENCONDITIONAL_EXPRESSION_RESULT - CONDITIONAL EXPRESSION RESULT
CPI1466 during Backup RFUMSV00 - Advance Return for Tax on Sales/PurchasesThis documentation is copyright by SAP AG.
COND, SWITCH, result
... operand
$| ${ THROW $[RESUMABLE$|SHORTDUMP$] cx_class( $[message$]
$[p1 = a1 p2 = a2 ...$] ) $} ...
Alternatives:
1. ... operand
2. ... THROW $[RESUMABLE$|SHORTDUMP$] cx_class( $[message$] $[p1 = a1 p2 = a2 ...$]
)
Effect
These specifications after THEN and ELSE in the
conditional
expressions COND
and SWITCH determine the result of the expression when the corresponding branch is selected.
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 specified, the conditional operators COND and SWITCH create a temporary
data object 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
either when the current statement is completed or when a relational expression is evaluated after the truth value is determined.
Example
Specification of the operands sum and sum + 1. The number of times a random number is less than half of its maximum value is counted.
Alternative 2
... THROW $[RESUMABLE$|SHORTDUMP$] cx_class( $[message$] $[p1 = a1 p2 = a2 ...$] )
Effect
The specification of THROW raises either an exception or a runtime error.
- If the addition SHORTDUMP is not specified, THROW works like the statement RAISE EXCEPTION TYPE and raises an exception of the exception class cx_class. The following applies here:
- The addition RESUMABLE can be used to make the exception resumable.
- A message can be passed to the exception object using the addition message.
- The input parameters p1, p2, ... of the instance constructor can be filled with actual parameters a1, a2.
- If the addition SHORTDUMP is specified, THROW works like the statement RAISE SHORTDUMP TYPE and raises a runtime error with the exception class cx_class, whereby a message can be also passed and the input parameters can be filled.
Notes
- If the exception class is specified after THROW, the parentheses must always be specified, even if no messages or actual parameters are passed. EXPORTING cannot be specified, nor is it necessary.
- Like the statement RAISE EXCEPTION, the specification THROW without the addition SHORTDUMP cannot be used in a method or function module in whose interface non-class-based exceptions are declared. Furthermore, it does not allow simultaneous use of the statement CATCH SYSTEM-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.
Example
Raising of an exception of the class CX_DEMO_DYN_T100 that implements the interface IF_T100_DYN_MSG.
Example
Raising of a runtime error with an exception object of the class CX_DEMO_DYN_T100, which implements the interface IF_T100_DYN_MSG.
PERFORM Short Reference BAL Application Log Documentation
This documentation is copyright by SAP AG.
Length: 6691 Date: 20240426 Time: 200013 sap01-206 ( 68 ms )