matinal:SAP ABAP 7.40及以上新语法SWITCH 操作符

2023-10-31 13:54:45 浏览数 (2)

代码语言:javascript复制
*定义
… SWITCH dtype|#( operand
WHEN const1 THEN result1
[ WHEN const2 THEN result2 ]
…
[ ELSE resultn ] ) …
*案例1
DATA(LANGU) = SWITCH #( SY-LANGU
                       WHEN 'D' THEN 'DE'
                       WHEN 'E' THEN 'EN'
                       WHEN '1' THEN 'ZH'
                      ).
 
CL_DEMO_OUTPUT=>DISPLAY( LANGU ).

0 人点赞