Skip to Content
avatar image
Former Member

Number of day in a quarter

Hi , i want to know how to get the number of day in a quarter

I use the following routine for the number of a day in a year

lv_month = mes - 1.

lv_noofdays = dia.

DO lv_month TIMES.

v_par_month = sy-index.

v_par_year = ano.

CALL FUNCTION 'NUMBER_OF_DAYS_PER_MONTH_GET'

EXPORTING

par_month = v_par_month

par_year = v_par_year

IMPORTING

par_days = v_par_days.

lv_noofdays = lv_noofdays + v_par_days.

ENDDO.

dias = lv_noofdays.

The variable "dias" give me the number of day in a year, but what can i do for the quarter?

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

3 Answers

  • Best Answer
    avatar image
    Former Member
    Aug 16, 2007 at 02:53 PM

    Try this... change the code according to your needs.

    DATA : par_month  LIKE  t009b-bumon,
           par_year   LIKE  t009b-bdatj,
           par_days   type  numc4,
           lv_days    LIKE  t009b-butag.
    
    par_month  = '01'.
    par_year   = '2007'.
    
    DO 12 TIMES.
    clear lv_days.
      CALL FUNCTION 'NUMBER_OF_DAYS_PER_MONTH_GET'
        EXPORTING
          par_month = par_month
          par_year  = par_year
        IMPORTING
          par_days  = lv_days.
      ADD 1 TO par_month.
      ADD lv_days TO par_days.
    ENDDO.
    
    WRITE:/ par_days.

    A

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Aug 16, 2007 at 02:39 PM

    Hi,

    Divide dias by 4 so that you will get the quarter of a year.

    Quarter = dias / 4 .

    <b>Reward if helpful.</b>

    Add comment
    10|10000 characters needed characters exceeded

  • Aug 16, 2007 at 02:40 PM

    Hi,

    Try with fm HR_SGPBS_YRS_MTHS_DAYS

    <b>Please read documentation before using the FM</b>

    aRs

    Add comment
    10|10000 characters needed characters exceeded