‎2006 Dec 28 12:32 PM
Hi Experts,
I am having current date (26.12.2006). Based on current date i required next month first date (01.01.2007) and march month last date (31.03.2007).
Regards,
Rajneesh Gupta
‎2006 Dec 28 1:16 PM
Try any FM for getting the fiscal year dates (March end date)...
and for Next month first date...see..
<b>
HR_SGPBS_ADD_TIME_TO_DATE</b> Find the next date based on input date , addition / sub and month , year ,date
Refer this link for more on DATE FMs...
<a href="http://www.geocities.com/victorav15/sapr3/abapfun.html#date">Date FMs in SAP</a>
Regards,
Raj
Message was edited by:
Rajasekhar Dinavahi
‎2006 Dec 28 1:24 PM
HI,
You can easily capture the month of the current data.so use the offset and capture the month, if the month is 12 then use the next month first data as you writen in your question.
so normally, the starting date is is 1st, to know the last day of the month, use the fucntion module <b>RP_LAST_DAY_OF_MONTHS</b>
Regards
Sudheer
‎2006 Dec 28 1:28 PM
u can make the code work like this.
data: date like sy-datum,
date1 like sy-datum.
date = sy-datum.
CALL FUNCTION 'RP_LAST_DAY_OF_MONTHS'
EXPORTING
day_in = date
IMPORTING
LAST_DAY_OF_MONTH = date1
EXCEPTIONS
DAY_IN_NO_DATE = 1
OTHERS = 2
.
add 1 to date1.
write:/ 'next month start date:', date1.
*to fetch the march month last date.
date1+4(2) = 03.
CALL FUNCTION 'RP_LAST_DAY_OF_MONTHS'
EXPORTING
day_in = date1
IMPORTING
LAST_DAY_OF_MONTH = date1
EXCEPTIONS
DAY_IN_NO_DATE = 1
OTHERS = 2
.
write:/ 'last date of march:', date1.Please close your previous threads.
regards,
vijay
‎2006 Dec 29 4:47 AM
‎2006 Dec 29 5:35 AM
Glad that this is working perfectly.. infact it should ... )
regards,
vijay
‎2006 Dec 28 1:36 PM
Hi,
Hope the following code will helps to you.
lv_date = '20061226'.
* Next month first date.
lv_date+4(2) = lv_date+4(2) + 1.
lv_date+6(2) = '01'
* For getting march mont month last date (lv_emonth)
concatenate lv_date+0(1) '01' '01' into lv_date1.
CALL FUNCTION 'REAL_ESTATE_CALC_DATE_SLST'
EXPORTING
I_DATE = lv_date1
ID_MONTH_OFFSET = 1
IMPORTING
E_DATE_MONTH_END = lv_emonth
EXCEPTIONS
ERROR = 1
OTHERS = 2.
IF sy-subrc <> 0.
Message 'Error' type 'E'.
endif.Regards
Bhupal Reddy
‎2006 Dec 28 1:43 PM
data: date like sy-datum,
date1 like sy-datum.
date = sy-datum.
CALL FUNCTION 'RP_LAST_DAY_OF_MONTHS'
EXPORTING
day_in = date
IMPORTING
LAST_DAY_OF_MONTH = date1
EXCEPTIONS
DAY_IN_NO_DATE = 1
OTHERS = 2
add 1 to date1.
write:/ 'next month start date:', date1.
*to fetch the march month last date.
date1+4(2) = 03.
CALL FUNCTION 'RP_LAST_DAY_OF_MONTHS'
EXPORTING
day_in = date1
IMPORTING
LAST_DAY_OF_MONTH = date1
EXCEPTIONS
DAY_IN_NO_DATE = 1
OTHERS = 2
write:/ 'last date of march:', date1.
‎2006 Dec 28 2:01 PM
‎2006 Dec 28 3:39 PM
data:
w_v1 like sy-datum.
w_v1 = sy-datum.
w_v1 = w_v1 + 65.
w_v1+6(2) = 01.
write:/ w_v1.
w_v1 = w_v1 - 1.
w_v1+6(2) = 01.
w_v1 = w_v1 - 1.
w_v1+6(2) = 01.
write:/ w_v1.
not exactly the same you need but
use this concept w_v1 = w_v1 + 65. &w_v1+6(2) = 01.
you will get your requirement
Regards,
Phani
‎2006 Dec 29 4:47 AM