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 in a Month

Former Member
0 Kudos
874

Hi Experts,

Is there any function module to find by number of days in a month by passing month name or value.

Thanks in Advance,

Best Regards,

IFF

1 ACCEPTED SOLUTION

former_member223537
Active Contributor
0 Kudos
258

Hi,

FM "NUMBER_OF_DAYS_PER_MONTH_GET".

Best regards,

Prashant

5 REPLIES 5

former_member223537
Active Contributor
0 Kudos
259

Hi,

FM "NUMBER_OF_DAYS_PER_MONTH_GET".

Best regards,

Prashant

ferry_lianto
Active Contributor
0 Kudos
258

Hi,

You can use this FM LAST_DAY_OF_MONTHS.


data: last_day type sy-datum.
data: num type i.
 
call function 'LAST_DAY_OF_MONTHS'
     exporting
          day_in            = sy-datum
     importing
          last_day_of_month = last_day.
 
num = last_day+6(2).
 
write:/ num.

Regards,

Ferry Lianto

former_member1345686
Active Participant
0 Kudos
258

Hi IFF,

The codes below are the sample codes to get number of days .

If you're about to count the working days, consider to subtract number of public holidays from table THOC .

  • GET NUMBER OF DAYS IN SPECIFIED MONTH

parameters :

P_MONTH(2),

P_YEAR(4) .

tables T009B.

data :

DAYS like T009B-BUTAG,

MONTH like T009B-BUMON,

YEARS like T009B-BDATJ.

start-of-selection.

  • Get number of days

MONTH = P_MONTH.

YEARS = P_YEAR.

call function 'NUMBER_OF_DAYS_PER_MONTH_GET'

exporting

PAR_MONTH = MONTH

PAR_YEAR = YEARS

importing

PAR_DAYS = DAYS.

.

write : /1(10) 'Month : ', (10) MONTH .

write : /1(10) 'Year : ', (10) YEARS .

write : /1(10) 'Days : ', (10) DAYS .

  • ----- END OF PROGRAM

Rgds,

TSW

raymond_giuseppi
Active Contributor
0 Kudos
258

You can try yo use Function Module K_ABC_WORKDAYS_FOR_PERIODS_GET and then count the records returned.

Regards

Former Member
0 Kudos
258

hi,

try: RP_LAST_DAY_OF_MONTHS

plz reward if helpful..