《SAP ABAP 开发指南》第六单元第三课时 - Switch
2018-08-20 本文已影响11人
46b61a5f089d
翱翔云天的SAP 技术网校
程序源代码
*&---------------------------------------------------------------------*
*& Report zaxyt_c6u3_switch_old
*&---------------------------------------------------------------------*
*& 课程:ABAP 开发入门
*& 章节:第六单元第三课时
*& 作者:A_216 @ Aug 20, 2018
*&---------------------------------------------------------------------*
REPORT zaxyt_c6u3_switch_new.
PARAMETERS: p_date LIKE sy-datum.
DATA: l_indicator LIKE scal-indicator,
l_day TYPE char10.
CALL FUNCTION 'DATE_COMPUTE_DAY'
EXPORTING
date = p_date
IMPORTING
day = l_indicator.
l_day = switch #( l_indicator
when 1 THEN 'Monday'(326)
when 2 THEN 'Tuesday'(327)
when 3 THEN 'Wednesday'(328)
when 4 THEN 'Thursday'(329)
when 5 THEN 'Friday'(330)
when 6 THEN 'Saturday'(331)
when 7 THEN 'Sunday'(332)
ELSE 'nothing'
).
WRITE: l_day.
运行结果展示
和 Switch old 运行结果一样。