Tuesday, January 5, 2010

ABAP Date Calculations

 Class CL_HRPAD_DATE_COMPUTATIONS has static methods for most of the date operations you need.

ADD_WEEKS_TO_DATE    Adfd No. of Weeks to Date
ADD_MONTHS_TO_DATE    Adds No. of Months to Date
ADD_YEARS_TO_DATE    Adds No. of Years to Date
SUBTRACT_WEEKS_FROM_DATE    Subtracts No. of Weeks from Date
SUBTRACT_MONTHS_FROM_DATE    Subtracts No. of Months from Date
SUBTRACT_YEARS_FROM_DATE    Subtracts No. of Years from Date
GET_WEEKDAY_NUMBER    Determines Number of Weekday
GET_WEEKDAY_NUMBER_SHIFTED    Determines Number of Weekday (Shifted)
GET_FIRST_DAY_CALENDAR_WEEK    Determines First Day of Calendar Week for Particular Year
GET_LAST_WEEKDAY_NUMBER    Determines Number of Last Weekday
GET_FIRST_DAY_IN_WEEK    Determines First Day of a Week
GET_FIRST_DAY_IN_SHIFTED_WEEK    Determines First Day of Week (Shifted)
GET_FIRST_DAY_PREVIOUS_MONTH    Determines First Day in Previous Month
GET_WEEK    Determines Week in Which Date Lies (Shifted)
GET_SHIFTED_WEEK    Determines Week in Which Date Lies (Shifted)
GET_LAST_DAY_IN_MONTH    Calculates Last Day of Current Month
GET_LAST_DAY_PREVIOUS_MONTH    Determines Last Day of Previous Month
GET_DAYS_PER_YEAR    Determines No. of Days per Year

*** Example

     call method cl_hrpad_date_computations=>get_last_day_in_month
      exporting
        date_in  = lv_begda
      receiving
        date_out = lv_endda.

No comments:

Post a Comment