‎2007 Nov 23 6:14 AM
hi,
i want the code to calculate
firstdate of next month
last date of current month
last date of next month
plzzz can any one help
<b><removed_by_moderator></b>
plz help me as early as possible.....
‎2007 Nov 23 6:16 AM
hi,
try this code....
data today type d value '24000228'.
data w_date type d.
data x type i.
w_date = today.
write: 'given date is', w_date.
do.
w_date = w_date + 1.
x = w_date+6(2).
if x = 1.
write: / 'first date next month', w_date.
w_date = w_date - 1.
write: /' last date of current month', w_date.
w_date = w_date + 1.
exit.
endif.
enddo.
do.
w_date = w_date + 1.
x = w_date+6(2).
if x = 1.
w_date = w_date - 1.
write: /' last date of next month', w_date.
exit.
endif.
enddo.
‎2007 Nov 23 6:16 AM
hi,
try this code....
data today type d value '24000228'.
data w_date type d.
data x type i.
w_date = today.
write: 'given date is', w_date.
do.
w_date = w_date + 1.
x = w_date+6(2).
if x = 1.
write: / 'first date next month', w_date.
w_date = w_date - 1.
write: /' last date of current month', w_date.
w_date = w_date + 1.
exit.
endif.
enddo.
do.
w_date = w_date + 1.
x = w_date+6(2).
if x = 1.
w_date = w_date - 1.
write: /' last date of next month', w_date.
exit.
endif.
enddo.
‎2007 Nov 24 12:59 PM
data w_date type sy-datum.
w_date = '20070215'. "sample date, you can change it or take input from user instead.
w_date+6(2) = '01'. "make current date to be 1st.
w_date = w_date + 62. "increment it, few days like morethan the current month.
w_date+6(2) = '01'. "date to 1st again.
w_date = w_date - 1. "decrement one day. it will give u the last date of next month.
write w_date.
<b><removed_by_moderator></b>
Message was edited by:
manjari kotta (and subsequently by moderator)
‎2007 Nov 23 6:16 AM
firstdate of next monthCALL FUNCTION 'RP_LAST_DAY_OF_MONTHS'
EXPORTING
day_in = date
IMPORTING
LAST_DAY_OF_MONTH = date1
EXCEPTIONS
DAY_IN_NO_DATE = 1
OTHERS = 2
.
CALL FUNCTION 'FIRST_AND_LAST_DAY_IN_YEAR_GET'
EXPORTING
I_GJAHR = YEAR
I_PERIV = FISC_VAR
IMPORTING
E_FIRST_DAY = BEG_DATE
E_LAST_DAY = END_DATE
EXCEPTIONS
INPUT_FALSE = 1
T009_NOTFOUND = 2
T009B_NOTFOUND = 3.
try this function module
‎2007 Nov 23 6:17 AM
Hi,
Look at this FM
CALL FUNCTION 'CCM_GO_BACK_MONTHS'
EXPORTING
currdate = wg_toddate
backmonths = 1
IMPORTING
newdate = wg_lastmondt.