11-20-2007 9:09 AM
Hi,
Can anyone help me with a function module where i'll be importing the month number and year and the FM will return the last date of the month (not the last day).
Thanks,
Anindita
11-20-2007 9:11 AM
11-20-2007 9:13 AM
11-20-2007 9:12 AM
Hi,
USE FM
*--Call function module to Calcute the last day of month
CALL FUNCTION 'RP_LAST_DAY_OF_MONTHS'
EXPORTING
day_in = lv_date1
IMPORTING
last_day_of_month = lv_date2
EXCEPTIONS
day_in_no_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.
Reawrd Points
Regards,
Prashant
11-20-2007 9:13 AM
11-20-2007 9:15 AM
last date means the entire date, eg. for last date for November, it should be 30.11.2007 and not just 30.
11-20-2007 9:21 AM
Hi,
DATA : date1 LIKE sy-datum,
date2 LIKE sy-datum,
yr TYPE char4 VALUE '2007',
month TYPE char4 VALUE '10'.
CONCATENATE yr month '01' INTO date1.
CALL FUNCTION 'RP_LAST_DAY_OF_MONTHS'
EXPORTING
day_in = date1
IMPORTING
last_day_of_month = date2. "date2 is type SY-DATUM
WRITE 😕 date2.
Message was edited by:
Perez C
11-20-2007 9:21 AM
Use this FM. This will help you.
<b> JVA_LAST_DATE_OF_MONTH</b>
ex:
Import parameters Value
YEAR_MONTH 200703 ---> year month
Export parameters Value
LAST_DATE_OF_MONTH 31.03.2007
Gives the last date.
<b>Reward points.</b>
Regards,
Vimal
Message was edited by:
Vimal Kumar
11-20-2007 9:13 AM
HI
You can use FM RP_LAST_DAY_OF_MONTHS.
DATA: WA_DATE LIKE SY-DATUM,
WA_LDATE LIKE SY-DATUM.
WA_DATE = SY-DATUM - 30.
CALL FUNCTION 'RP_LAST_DAY_OF_MONTHS'
EXPORTING
DAY_IN = WA_DATE
IMPORTING
LAST_DAY_OF_MONTH = WA_LDATE
EXCEPTIONS
DAY_IN_NO_DATE = 1
OTHERS = 2.
WRITE: / WA_LDATE.
11-20-2007 9:24 AM
Hi
Please try LAST_DAY_IN_PERIOD_GET , however please remember to pass the correct period variant.
Best Regards
Arun
11-20-2007 10:04 AM
year = '2008'.
month = '11'.
pp = '02'.
CALL FUNCTION 'LAST_DAY_IN_PERIOD_GET'
EXPORTING
I_GJAHR = year
I_PERIV = 'K1'
I_POPER = month
IMPORTING
E_DATE = date1
EXCEPTIONS
INPUT_FALSE = 1
T009_NOTFOUND = 2
T009B_NOTFOUND = 3
OTHERS = 4
.
11-20-2007 10:08 AM
11-20-2007 10:12 AM
Hi,
You can use the below FM and code.
Assuming sp_gjahr is selection parameter and lv_poper is the period, and for i_periv you should use the fiscal year variant. And declare variable as sy-datum to hold date result.
CALL FUNCTION 'LAST_DAY_IN_PERIOD_GET'
EXPORTING
i_gjahr = sp_gjahr
i_periv = 'K4'
i_poper = lv_poper
IMPORTING
e_date = gv_lastday
EXCEPTIONS
input_false = 1
t009_notfound = 2
t009b_notfound = 3
OTHERS = 4.
Thanks,
Sriram Ponna.