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_DAYS_PER_MONTH_GET

Former Member
0 Kudos
385

how can ı do this function

NUMBER_OF_DAYS_PER_MONTH_GET

4 REPLIES 4

Former Member
0 Kudos
90

hi

it will give u number of days int he month for that year

check the code

PARAMETER: p1_datum	TYPE sy-datum.

DATA:
w_month	LIKE	t009b-bumon,
w_year	       LIKE	t009b-bdatj,
w_DAYS	       LIKE	T009B-BUTAG.

w_month =  p1_datum+4(2).
w_year  =  p1_datum+0(4).

CALL FUNCTION 'NUMBER_OF_DAYS_PER_MONTH_GET'
  EXPORTING
    par_month = w_month
    par_year  = w_year
  IMPORTING
    par_days  = w_days.

    write:/ w_days.

Cheers

Snehi

naveen_inuganti2
Active Contributor
0 Kudos
90

Hi...

It will answer following questions...

1. How many days for month Feb' In the year 2008?

2. How many days for the month Feb' in the year 2007?

Analyze this program...

data: var3(2) type n.

PARAMETERS: var1(2) type n DEFAULT '2',
            var2(4) type n DEFAULT '2008'.

call function 'NUMBER_OF_DAYS_PER_MONTH_GET'
  exporting
    PAR_MONTH       = var1
    PAR_YEAR        = var2
 IMPORTING
   PAR_DAYS        = var3.

write:/ 'No. of days in the given month:', var3.

Thanks,

Naveen.I

Former Member
0 Kudos
90

Use

call function 'NUMBER_OF_DAYS_PER_MONTH_GET'

exporting

PAR_MONTH = gf_mon

PAR_YEAR = gf_year

IMPORTING

PAR_DAYS = gf_days.

now, say gf_mon = 8 and gf_year = 2008

so FM returns gf_days as 31.

Former Member
0 Kudos
90

There are 2 input parameters

PAR_MONTH and PAR_YEAR

For PAR_MONTH pass the month eg. "08" for August

For PAR_YEAR pass the year eg. 2008 whichever year you want

The output would be the no. of days for that month in PAR_DAYS (here 31).

Hope this helps