关闭

Calculate years, months, days & calender days between 2 given dates

447人阅读 评论(0) 收藏 举报
分类:

I first use this FM in a HR ABAP program. For checking specifiy  qualification to an employee.The result of this FM is present as year , month and day. Below is the sample code

 

  METHOD check_qualifications.
    DATA: l_v_beg_da     TYPE D,
          l_v_end_da     TYPE D.
    DATA: l_v_no_day     TYPE I,
          l_v_no_month   TYPE I,
          l_v_no_year    TYPE I,
          l_v_no_cal_day TYPE I.

    l_v_beg_da 
= l_v_dat01.
    l_v_end_da 
= l_v_endda.
    CALL FUNCTION 
'HR_SGPBS_YRS_MTHS_DAYS'
      EXPORTING
        BEG_DA        
= l_v_beg_da
        END_DA        
= l_v_end_da
      IMPORTING
        NO_DAY        
= l_v_no_day
        NO_MONTH      
= l_v_no_month
        NO_YEAR       
= l_v_no_year
        NO_CAL_DAY    
= l_v_no_cal_day
      EXCEPTIONS
        DATEINT_ERROR 
= 1
        OTHERS        
= 2.
    IF l_v_no_month GE 
3 OR l_v_no_year GE 1.
      l_v_subrc 
= 0.
    ELSE.
      l_v_subrc 
= 1.
    ENDIF.
  ENDMETHOD.                    
"check_qualifications
0
0

查看评论
* 以上用户言论只代表其个人观点,不代表CSDN网站的观点或立场
    个人资料
    • 访问:31520次
    • 积分:454
    • 等级:
    • 排名:千里之外
    • 原创:12篇
    • 转载:5篇
    • 译文:0篇
    • 评论:3条
    文章分类
    最新评论