четверг, 22 марта 2012 г.

ABAP Date Functions


http://sapforum.biz/index.php?topic=14.0

CALCULATE_DATE  : Calculates the future date based on the input .

DATE_TO_DAY : Returns the Day for the entered date.

DATE_COMPUTE_DAY  : Returns weekday for a date

DATE_GET_WEEK  : Returns week for a date

RP_CALC_DATE_IN_INTERVAL : Add days / months to a date

DAY_ATTRIBUTES_GET  : Returns attributes for a range of dates specified

MONTHS_BETWEEN_TWO_DATES  : To get the number of months between the two dates.

END_OF_MONTH_DETERMINE_2  : Determines the End of a Month.

HR_HK_DIFF_BT_2_DATES  : Find the difference between two dates in years, months and days.

FIMA_DAYS_AND_MONTHS_AND_YEARS  : Find the difference between two dates in years, months and days.

MONTH_NAMES_GET  : Get the names of the month

WEEK_GET_FIRST_DAY  : Get the first day of the week

HRGPBS_HESA_DATE_FORMAT  : Format the date in dd/mm/yyyy format

SD_CALC_DURATION_FROM_DATETIME  : Find the difference between two date/time and report the difference in hours

L_MC_TIME_DIFFERENCE  : Find the time difference between two date/time

HR_99S_INTERVAL_BETWEEN_DATES  : Difference between two dates in days, weeks, months

LAST_DAY_OF_MONTHS  : Returns the last day of the month

DATE_CHECK_PLAUSIBILITY :Check for the invalid date.

DATE_2D_TO_4D_CONVERSION :Year entry: 2-character to  4-character.

DAY_IN_WEEK :Input date and will give the name of the day 1-monday,2-Tuesday....

SD_DATETIME_DIFFERENCE : Give the difference in Days and Time for 2 dates

Example of FIMA_DAYS_AND_MONTHS_AND_YEARS :


DATA: EDAYS   LIKE VTBBEWE-ATAGE,
      EMONTHS LIKE VTBBEWE-ATAGE,
      EYEARS  LIKE VTBBEWE-ATAGE.

PARAMETERS: FROMDATE LIKE VTBBEWE-DBERVON,
            TODATE   LIKE VTBBEWE-DBERBIS DEFAULT SY-DATUM.

call function 'FIMA_DAYS_AND_MONTHS_AND_YEARS'
  exporting
    i_date_from          = FROMDATE
    i_date_to            = TODATE
  •   I_FLG_SEPARATE       = ' '
  IMPORTING
    E_DAYS               = EDAYS
    E_MONTHS             = EMONTHS
    E_YEARS              = EYEARS.

WRITE:/ 'Difference in Days   ', EDAYS.
WRITE:/ 'Difference in Months ', EMONTHS.
WRITE:/ 'Difference in Years  ', EYEARS.

INITIALIZATION.
FROMDATE = SY-DATUM - 60.

Комментариев нет:

Отправить комментарий