Registration

Dear SAP Community Member,
In order to fully benefit from what the SAP Community has to offer, please register at:
http://scn.sap.com
Thank you,
The SAP Community team.
Skip to end of metadata
Go to start of metadata

1. GET_WEEK_INFO_BASED_ON_DATE. (Used for getting week number of the year and date of previous Monday and next Sunday)

This FM gives you the week number of the year and date of previous Monday and next Sunday.

DATA: prev_mon TYPE sy-datum,
      next_sun TYPE sy-datum,
      week_no TYPE scal-week.
CALL FUNCTION 'GET_WEEK_INFO_BASED_ON_DATE'
  EXPORTING
    date   = sy-datum
  IMPORTING
    week   = week_no
    monday = prev_mon
    sunday = next_sun.
WRITE:/ 'This week number is', week_no.
WRITE:/ 'Last Monday was on', prev_mon.
WRITE:/ 'Next Sunday will be on', next_sun.





2. CACS_DATE_GET_YEAR_MONTH. (Used for getting month and year of provided date)

This FM gives you the month and year of provided date.(Use this FM only when month and year both are required)

Data: Curr_month type i,
      Curr_year type i.
CALL FUNCTION 'CACS_DATE_GET_YEAR_MONTH'
 EXPORTING
   I_DATE        = SY-DATUM
 IMPORTING
   E_MONTH       = Curr_month
   E_YEAR        = Curr_year.
Write: Curr_month, Curr_year.





3. HR_99S_INTERVAL_BETWEEN_DATES. (Used for getting no. of days,weekes, months and years between two dates)

This FM is used to get no. of days,weekes, months and years between two dates.

DATA: beg_date TYPE d VALUE '20080410',
      end_date TYPE d VALUE '20090411'.
DATA: no_of_days TYPE i,
      comp_weeks type i,
      comp_months type i,
      comp_years type i.
     CALL FUNCTION 'HR_99S_INTERVAL_BETWEEN_DATES'
  EXPORTING
   begda           = beg_date
   endda           = end_date
 IMPORTING
   days            = no_of_days
   C_WEEKS         = comp_weeks
   C_MONTHS        = comp_months
   C_YEARS         = comp_years.WRITE: no_of_days, comp_weeks, comp_months, comp_years.





4.  HR_99S_MONTHS_BETWEEN_DATES (Used for getting no. of months between two dates)

This FM  gives only no of months between two dates.

DATA: beg_date TYPE d VALUE '20080410',
      end_date TYPE d VALUE '20090411'.
DATA: no_of_months TYPE i.
CALL FUNCTION 'HR_99S_MONTHS_BETWEEN_DATES'
  EXPORTING
    p_begda  = beg_date
    p_endda  = end_date
  IMPORTING
    p_months = no_of_months.
WRITE no_of_months.


5. HR_E_NUM_OF_DAYS_OF_MONTH (Used for getting no. of days in provided month)

DATA: beg_date TYPE d VALUE '20080410',
      no_of_days TYPE p.
CALL FUNCTION 'HR_E_NUM_OF_DAYS_OF_MONTH'
  EXPORTING
    p_fecha        = beg_date
  IMPORTING
    number_of_days = no_of_days.
Write: 'Number of days in given month are', no_of_days.



6. HR_CALC_YEAR_MONTH_DAY (Used gor getting year, month and days between two dates)


DATA: beg_date TYPE begda VALUE '20080410',
      end_date TYPE endda VALUE '20091023',
      no_of_days TYPE p0000_af-noyrs,
      no_of_months TYPE p0000_af-nomns,
      no_of_years TYPE p0000_af-noyrs.
CALL FUNCTION 'HR_CALC_YEAR_MONTH_DAY'
  EXPORTING
    begda      = beg_date
    endda      = end_date
  IMPORTING
    days_out   = no_of_days
    months_out = no_of_months
    years_out  = no_of_years.
WRITE: no_of_years, no_of_months, no_of_days.

7.  BWSO_DATE_GET_FIRST_WEEKDAY (Used for getting date of first day of the week)


DATA: in_date TYPE dats VALUE '20090421',
      out_date TYPE dats.
CALL FUNCTION 'BWSO_DATE_GET_FIRST_WEEKDAY'
  EXPORTING
    date_in  = in_date
  IMPORTING
    date_out = out_date.
WRITE out_date.
  • No labels