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: 

Get last date of month based on input date

Former Member
0 Kudos

Hi Every body,

i stuck up with one problem,i.e i fetch date from one file ex : 20071002.

for every record i need end date of that month.Is there any function module to get last date of the month...?can any body help me

10 REPLIES 10

Former Member
0 Kudos

RP_LAST_DAY_OF_MONTHS

0 Kudos

Thanks buddy,i got the solution.

Cheers

0 Kudos

Follow the forum rules and award points to the helpful answers before closing the thread.

Former Member
0 Kudos

call function 'OIUREP_MONTH_FIRST_LAST'

exporting

i_month = l_month

i_year = l_year

i_date = l_date

importing

e_first_day = pe_fdate

e_last_day = pe_tdate

exceptions

wrong_date = 1

others = 2.

0 Kudos

Hi, I couldn't find the FM in the system, it said that FM doesn't exist.

'OIUREP_MONTH_FIRST_LAST'

Do you have any idea why is it?

GauthamV
Active Contributor
0 Kudos

Use this FM.

'RP_LAST_DAY_OF_MONTHS'

Former Member
0 Kudos

Hi,

use the FM FIMA_END_OF_MONTH_DETERMINE to get the last day of the month.

Thanks & Regards

Ashu Singh

Former Member
0 Kudos

You can also use: SG_PS_GET_LAST_DAY_OF_MONTH

Former Member
0 Kudos

LAST_DAY_OF_MONTHS

Former Member
0 Kudos

Hi,

Here is the small piece of code u can do some changes according to ur need i hope u will get some help....

data:l_month type am_monat,

l_year type gjahr,

f_date type sy-datum,

l_date type sy-datum.

l_month = 04.

l_year = 2008.

data: fdate type sy-datum.

data:ldate type sy-datum.

CALL FUNCTION 'OIUREP_MONTH_FIRST_LAST'

EXPORTING

I_MONTH = l_month

I_YEAR = l_year

  • I_DATE =

IMPORTING

E_FIRST_DAY = f_date

E_LAST_DAY = l_date

  • EXCEPTIONS

  • WRONG_DATE = 1

  • OTHERS = 2

.

IF SY-SUBRC <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

write:/ f_date.

write:/ l_date.

fdate = f_date.

ldate = l_date .

write:/ fdate dd/mm/yyyy.

write:/ ldate dd/mm/yyyy.

Thanks & Regards

Ashu Singh