Is there a ternary or conditional operator available in the ABAP syntax? I haven't found one so am assuming that the answer is no but is there then an alternative that I can use to clear up the common "dumb" IF statements that I routinely use?
For example, consider a method that logs a message with optional message parameters. To decide between using the imported parameter or the default I have to check the value like so:
IF iv_class IS INITIAL.
    lv_message_class = 'DEFAULT'.
ELSE.
    lv_message_class = iv_class.
ENDIF.
IF iv_number IS INITIAL.
    lv_message_number = '000'.
ELSE.
    lv_message_number = iv_number.
ENDIF.
IF iv_type IS INITIAL.
    lv_message_type = 'E'.
ELSE.
    lv_message_type = iv_type.
ENDIF.
A ternary operator would reduce each of these five-line statements to a single line as seen in the below code block. It could even make the use of a temporary variable unnecessary when the operator is used in-line.
lv_message_class  = iv_class  IS INITIAL ? 'DEFAULT' : iv_class.
lv_message_number = iv_number IS INITIAL ? '000'     : iv_number .
lv_message_type   = iv_type   IS INITIAL ? 'E'       : iv_type   .
Is there a way to approximate this kind of programming style in ABAP or am I stuck with the clutter?
 
     
     
     
     
    