ABAP HANA 7.51: COND & SWITCH operator
COND – This is a Conditional Operator just like SWITCH with some differences. When must be specified at least once in this operator. COND Operator can be clubbed with LET Operator. This operator has two variants just like VALUE Operator:
- Non-generic data type which can be for example declared before its use
- # character as an operand, however, in this case, operand type should be fully identifiable
SWITCH – This is a Conditional Operator just like COND with some differences. When must be specified at least once in this operator. SWITCH Operator can be clubbed with LET Operator. This operator has two variants just like VALUE Operator:
- Non-generic data type which can be for example declared before its use
- # character as an operand, however, in this case, operand type should be fully identifiable
In SWITCH operator condition variable has to be mentioned only once whereas, in COND Operator, this appears multiple times.
Sample Source Code: COND Operator
Output: COND Operator
Sample Source Code: SWITCH Operator
Output: SWITCH Operator
Check the video for Illustration and Example:
Find the code on GitHub: