首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 企业软件 > 行业软件 >

Calculate the days, months and years between 二 dates

2012-10-20 
Calculate the days, months and years between 2 dates.FORM compute_2date_diff.DATA: lv_date1 LIKE sy

Calculate the days, months and years between 2 dates.

FORM compute_2date_diff.  DATA: lv_date1 LIKE sy-datum,        lv_date2 LIKE sy-datum,        lv_month TYPE pea_scrmm,        lv_days  TYPE pea_scrdd.*lv_date1 must be greater than lv_date2  lv_date1 = '20120201'.  lv_date2 = '20120101'.  CALL FUNCTION 'HR_HK_DIFF_BT_2_DATES'    EXPORTING      date1                         = lv_date1      date2                         = lv_date2     OUTPUT_FORMAT                 = '05'   IMPORTING*     YEARS                         =     months                        = lv_month     days                          = lv_days   EXCEPTIONS     invalid_dates_specified       = 1     OTHERS                        = 2.  IF sy-subrc <> 0.    MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno            WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.  ENDIF.ENDFORM.                    "compute_2date_diff

热点排行