04-18-2006 12:03 PM
Hi,
How to find the last date of the next month.
Thanks in advance
Sunitha
04-18-2006 12:23 PM
REPORT ychatest.
DATA : date1 LIKE sy-datum,
month(2).
date1 = sy-datum.
month = date1+4(2).
month = month + 1.
date1+4(2) = month.
CALL FUNCTION 'SG_PS_GET_LAST_DAY_OF_MONTH'
EXPORTING
day_in = date1
IMPORTING
last_day_of_month = date1
EXCEPTIONS
day_in_not_valid = 1.
WRITE : date1+6(2).
.
04-18-2006 12:05 PM
Hi,
Use this FM : HR_JP_MONTH_BEGIN_END_DATE
or LAST_DAY_OF_MONTHS
Regards,
GSR.
04-18-2006 12:06 PM
Use the below mentioned FM
call function 'LAST_DAY_IN_PERIOD_GET'
exporting
i_gjahr = p_finyear
i_periv = 'X1'
i_poper = lv_popere
importing
e_date = p_edate
exceptions
input_false = 1
t009_notfound = 2
t009b_notfound = 3
others = 4.
if sy-subrc <> 0.
endif.
Supply the proper parameters, u will get the last date in the next month.
04-18-2006 12:07 PM
Use this FM LAST_DAY_OF_MONTHS
get the next month from
v_next_month = sy-datum+4(2) + 1.
and pass v_next_month to the FM.
REgards,
Ravi
04-18-2006 12:13 PM
Just add 1 to the month in sy-datum and pass this value to the fucntion module LAST_DAY_OF_MONTHS.This will provide you the date that you are looking for.
Cheers
Nishanth
04-18-2006 12:17 PM
04-18-2006 12:23 PM
REPORT ychatest.
DATA : date1 LIKE sy-datum,
month(2).
date1 = sy-datum.
month = date1+4(2).
month = month + 1.
date1+4(2) = month.
CALL FUNCTION 'SG_PS_GET_LAST_DAY_OF_MONTH'
EXPORTING
day_in = date1
IMPORTING
last_day_of_month = date1
EXCEPTIONS
day_in_not_valid = 1.
WRITE : date1+6(2).
.
04-18-2006 12:38 PM
try:
DATA date LIKE sy-datum .
DATA year LIKE bkpf-gjahr.
DATA month LIKE bkpf-monat.
IF sy-datum+4(2) > 10.
year = sy-datum(4) + 1.
month = sy-datum+4(2) + 2 - 12.
ELSE.
year = sy-datum(4).
month = sy-datum+4(2) + 2.
ENDIF.
CONCATENATE year month '01' INTO date.
date = date - 1.
WRITE date.
Andreas
04-18-2006 7:21 PM
I don't think this works for December. Instead of sy-datum, try it with '20061215'.
Rob
04-18-2006 12:36 PM
Hello Sunitha,
Use FM RS_VARI_V_1_NEXT_MONTH to get the next month. U don't have to pass anything to the FM. Get the output from P_datum and pass it to the FM LAST_DAY_OF_MONTHS.
04-18-2006 8:01 PM
REPORT ZTESTJRG .
parameters: pdate type sydatum default sy-datum.
data: ldate type sydatum.
ldate = pdate.
* Set to the next month
ldate+4(2) = pdate+4(2) + 1.
if ldate+4(2) = '13'.
ldate+4(2) = '01'.
ldate+0(4) = ldate+0(4) + 1. "Add a year
endif.
* Set to the month after the next month
ldate+4(2) = ldate+4(2) + 1.
* Set to the first day of the month
ldate+6(2) = '01'.
* Set to one day less than the first day of two months from pdate
ldate = ldate - 1.
write: /1 'Current date:', 25 pdate,
/1 'Last day of next month:', 25 ldate.