Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Number of day in a quarter

Former Member
0 Kudos

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?

1 ACCEPTED SOLUTION

Former Member
0 Kudos

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

3 REPLIES 3

Former Member
0 Kudos

Hi,

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

Quarter = dias / 4 .

<b>Reward if helpful.</b>

former_member194669
Active Contributor
0 Kudos

Hi,

Try with fm HR_SGPBS_YRS_MTHS_DAYS

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

aRs

Former Member
0 Kudos

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