function zconversion_user_date_format .
*"----------------------------------------------------------------------
*"*"Local interface:
*" IMPORTING
*" REFERENCE(IMP_DATE) TYPE CHAR8
*" CHANGING
*" REFERENCE(CHG_DATE) TYPE CHAR10
*"----------------------------------------------------------------------
data: datfm like usr01-datfm.
select single datfm into datfm from usr01
where bname = sy-uname.
if sy-subrc = 0.
perform frm_formatdate using datfm imp_date
chg_date.
endif.
endfunction.
*----------------------------------------------------------------------*
***INCLUDE LZFG_DATEF01 .
*----------------------------------------------------------------------*
*&---------------------------------------------------------------------*
*& Form FRM_FORMATDATE
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
form frm_formatdate using f_strtype type c
f_stridate type any
f_strcdate type any
.
data: dtdate type d.
data: stryear(4) type c.
data: strmonth(2) type c.
data: strday(2) type c.
data: strspeareted type c.
dtdate = f_stridate.
stryear = dtdate(4).
strmonth = dtdate+4(2).
strday = dtdate+6(2).
* clear: dtdate,stryear,strmonth,strday.
perform getdateseperated using f_strtype
changing strspeareted.
case f_strtype.
when '1'.
concatenate strday strmonth stryear
into f_strcdate separated by strspeareted.
when '2' or '3'.
concatenate strmonth strday stryear
into f_strcdate separated by strspeareted.
when '4' or '5' or '6' or 'A' or 'B' or 'C'.
concatenate stryear strmonth strday
into f_strcdate separated by strspeareted.
endcase.
endform. "frm_FormatDate
*&---------------------------------------------------------------------*
*& Form GETDATESEPERATED
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
form getdateseperated using f_strdatetype type c
changing f_strseperated type c.
case f_strdatetype.
when '1' or '4' or '7'.
f_strseperated = '.'.
when '2' or '5' or '8' or 'A' or 'B' or 'C'.
f_strseperated = '/'.
when '3' or '6' or '9'.
f_strseperated = '-'.
endcase.
endform. "GetDateSeperated
阅读(613) | 评论(0) | 转发(0) |