REPORT z_barry_test NO STANDARD PAGE HEADING .
DATA: date1 LIKE sy-datum,
date2(30).
date1 = sy-datum.
DO 400 TIMES.
date1 = date1 + 1 .
PERFORM get_date2 USING date1 CHANGING date2.
WRITE / date2.
ENDDO.
*&---------------------------------------------------------------------*
*& Form get_date2
*&---------------------------------------------------------------------*
FORM get_date2 USING value(date_in) LIKE sy-datum
CHANGING date_str.
DATA: yy(10),
mm(10),
dd(10).
DATA: len TYPE i.
len = 3 - cl_abap_char_utilities=>charsize.
yy = date_in+0(4).
mm = date_in+4(2).
dd = date_in+6(2).
TRANSLATE yy USING '0〇1一2二3三4四5五6六7七8八9九'.
TRANSLATE mm USING '1一2二3三4四5五6六7七8八9九'.
TRANSLATE dd USING '1一2二3三4四5五6六7七8八9九'.
IF date_in+4(2) > 9.
SHIFT mm BY len PLACES .
CONCATENATE '十' mm INTO mm.
ENDIF.
IF date_in+6(2) > 29 .
SHIFT dd BY len PLACES .
CONCATENATE '三十' dd INTO dd.
ELSEIF date_in+6(2) > 19 .
SHIFT dd BY len PLACES .
CONCATENATE '二十' dd INTO dd.
ELSEIF date_in+6(2) > 9.
SHIFT dd BY len PLACES .
CONCATENATE '十' dd INTO dd.
ENDIF.
CONCATENATE yy '年' mm'月' dd '日' INTO date_str.
REPLACE ALL OCCURRENCES OF '0' IN date_str WITH ``.
ENDFORM.
阅读(2946) | 评论(0) | 转发(1) |