COND Operator instead of IF/ELSE in ABAP New Syntax
As case statements are used to evaluate only one variable condition at a time, we use if/else to consider multiple logical conditions.
Consider the below example.
DATA: lv_text(20). IF lv_vehicle = '01' AND lv_type = 'C'. lv_text = 'Hyundai. ELSE. IF lv_vehicle ='02' AND lv_type = 'C'. lv_text = 'KIA' ELSE. IF lv_vehicle ='03' AND lv_type = 'C'. lv_text = 'Maruti'. .. ENDIF.
DATA(lv_text) = COND text20( WHEN lv_vehicle ='01' AND lv_type = 'C' THEN 'Hyundai' WHEN lv_vehicle ='02' AND lv_type = 'C' THEN 'KIA' WHEN lv_vehicle ='03' AND lv_type = 'C' THEN 'Maruti').
Tags
ABAP 7.4/7.5