Hi,
Use the below code.
parameters: p_date type sy-datum.
data: v_date type sy-datum.
CALL FUNCTION 'RP_CALC_DATE_IN_INTERVAL'
EXPORTING
DATE = sy-datum
DAYS = 0
MONTHS = '06'
SIGNUM = '-'
YEARS = 0
IMPORTING
CALC_DATE = v_date.
if p_date lt v_date.
write:/ 'Invalid date'.
else.
write:/ 'Valid date'.
endif.
Hi,
Now, in your case the current date = 02/21/2008 ( mm/dd/yyyy)
and Past date = 08/19/2007.
1. Use the FM ' HR_AUPBS_MONTH_DAY' to get the number of months b/w these two dates.
2. You will get the no. of months in the parameter NO_MONTH.
3. Take it into a variable V_MONTH and then check if V_MONTH GE '6'.
4. If so, give the error message otherwise sucessfully carry out the your rest processing.
Please reward points if useful.
If you have any query revert back to me.
thanks,
Asha
Hi,
Please refer the code below :
tables : bsis. data : month like VTBBEWE-ATAGE. parameters : sp_date like sy-datum. at selection-screen. CALL FUNCTION 'FIMA_DAYS_AND_MONTHS_AND_YEARS' EXPORTING i_date_from = sp_date * I_KEY_DAY_FROM = I_KEY_DAY_FROM i_date_to = sy-datum * I_KEY_DAY_TO = I_KEY_DAY_TO * I_FLG_SEPARATE = ' ' IMPORTING * E_DAYS = E_DAYS E_MONTHS = month * E_YEARS = E_YEARS . if month GT '6'. message 'Invalid date' type 'E'. endif.
OR
Try using FM MONTHS_BETWEEN_TWO_DATES.
Thanks,
Sriram Ponna.
Add a comment