2013 Oct 01 8:33 AM
Hello Guys,
Please suggest if there is any function module which can find whether a date that i want to check lies between the two dates of select option
Regards,
Deepak
2013 Oct 01 8:36 AM
Dear Deepak,
No need for FM. Just use normal ABAP keyword 'IN'
IF lv_date_to_be_checked IN s_date_range.
* Write your logic here
ENDIF.
Cheers
Mahesh
2013 Oct 01 8:38 AM
Hi.
I think that you only need an IF, you don't need a function module.
Best Regards,
Joana
2013 Oct 01 8:46 AM
2013 Oct 01 8:47 AM
Hi Mahesh,
Thanks for ur code........its working.
Regards,
Deepak kansal.
2013 Oct 01 9:10 AM
Hi deepak,
we can manually validate the date range entered in the select options,
Here is the code for that
at selection screen.
IF s_date[] IS INITIAL.
MESSAGE 'PLease Enter the Date' TYPE 'S' DISPLAY LIKE 'E'.
ENDIF.
IF NOT s_date[] IS INITIAL. "for weekly date validation
fdate = s_date-low. "fdate----->first date
fdate = fdate + 6.
ldate = s_date-high. "ldate------->last date
IF ldate <> fdate.
MESSAGE 'Enter the valid range of date' TYPE 'E'.
ENDIF.
ENDIF.
To validate the date range given in month format, here is the FM for month date validation.
IF NOT s_tdate[] IS INITIAL.
CALL FUNCTION 'OIL_MONTH_GET_FIRST_LAST'
EXPORTING
* I_MONTH =
* I_YEAR =
i_date = s_tdate-low
IMPORTING
e_first_day = fdate "first date of month
e_last_day = ldate "last date of month
EXCEPTIONS
wrong_date = 1
OTHERS = 2.
IF sy-subrc <> 0.
* Implement suitable error handling here
MESSAGE 'Enterd date is not valid' TYPE 'S' DISPLAY LIKE 'E'.
ENDIF.
"To display the message to the user if lower value is wrong
IF s_tdate-low <> fdate.
MESSAGE 'Enter The valid first date' TYPE 'S' DISPLAY LIKE 'E'.
ENDIF.
" To display the message to the user if the higher value is wrong
IF s_tdate-high <> ldate.
MESSAGE 'Enter the valid Last date' TYPE 'S' DISPLAY LIKE 'E'.
ENDIF.
ENDIF.
ENDIF.
just try with this and hope u will get want u wanna acheive.
regards
Syed
2013 Oct 01 9:47 AM
Hi Deepak,
If your question is answered, award necessary points and mark this thread as answered.
Cheers
Mahesh
2013 Oct 01 8:55 AM
Hi deepak kansal,
Use the below logic
IF v_date GE so_option-low AND v_date LE so_option-high.
*Implement your code here.
ENDIF.
Cheers,
Riju Thomas.