COND & SWITCH operator

Index

 

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:

  1. Non-generic data type which can be for example declared before its use
  2. # 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:

  1. Non-generic data type which can be for example declared before its use
  2. # 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

COND_Var1_source

Output: COND Operator

COND_Var1_output

Sample Source Code: SWITCH Operator

SWITCH_Var1_source

Output: SWITCH Operator

SWITCH_Var1_output

Check the video for Illustration and Example:

Find the code on GitHub:

Go to Code

Index

 

Leave a Reply