FORM frm_convert_date USING pv_value pv_datum LIKE sy-datum.
DATA:lv_yy TYPE n LENGTH 4,
lv_mm TYPE n LENGTH 2,
lv_dd TYPE n LENGTH 2.
DATA:lv_flag TYPE c.
CLEAR pv_datum.
IF pv_value CS '/'.
SPLIT pv_value AT '/' INTO lv_yy lv_mm lv_dd.
lv_flag = 'X'.
ENDIF.
IF pv_value CS '\'.
SPLIT pv_value AT '\' INTO lv_yy lv_mm lv_dd.
lv_flag = 'X'.
ENDIF.
IF pv_value CS '.'.
SPLIT pv_value AT '.' INTO lv_yy lv_mm lv_dd.
lv_flag = 'X'.
ENDIF.
IF pv_value CS '-'.
SPLIT pv_value AT '-' INTO lv_yy lv_mm lv_dd.
lv_flag = 'X'.
ENDIF.
IF lv_flag = ''.
pv_datum = pv_value.
EXIT.
ENDIF.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
input = lv_yy
IMPORTING
output = lv_yy.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
input = lv_mm
IMPORTING
output = lv_mm.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
input = lv_dd
IMPORTING
output = lv_dd.
pv_datum = lv_yy && lv_mm && lv_dd.
ENDFORM. "frm_convert_date
阅读(1670) | 评论(0) | 转发(0) |