2019 Nov 18 11:50 AM
in select-option i want to select any month's 1st date and last date, then it will ok, and if I give other date rather than 1st and last date then it will not take. so basically in raise exception that should be written that rather than 1st and last date of the selected month will not take.
2019 Nov 18 12:11 PM
Define l_first and l_last as date. You can try:
Regards,
Igor
2019 Nov 18 12:16 PM
could you please explain more ? i mean i just want to show incorrect as a output if i input wrong date in starting and end date range. and If I put 1st day of the month and last day of the month in the range then it will show correct as a output .
2019 Nov 18 12:14 PM
Why a function module for so special need? Can't you just use the basic ABAP operations on date types? Example:
DATA date TYPE d.
SELECT-OPTIONS s_date FOR date.
AT SELECTION-SCREEN.
IF s_date-low+6(2) <> '01'. MESSAGE 'low date must be 1st month day' TYPE 'E'. ENDIF.
DATA(high_date_plus_1_day) = CONV d( s_date-high + 1 ).
IF high_date_plus_1_day+6(2) <> '01'. MESSAGE 'high date must be end of month' TYPE 'E'. ENDIF.
DATA(low_date_plus_1_month) = CONV d( s_date-low + 31 ).
IF low_date_plus_1_month(6) <> high_date_plus_1_day(6).
MESSAGE 'low date and high date must belong to same month' TYPE 'E'.
ENDIF.
Note: +6(2) is to get the day out of a date (01 or 31 for instance), while (6) is to get the year and month concatenated.
2019 Nov 18 12:26 PM
2019 Nov 18 12:26 PM
2019 Nov 18 12:56 PM
You must loop at screen and check the values in selection screen.
Check these 2 options:
You will find a lot of examples for checking the selection screen. You have to pass through the selection screen, check your date value and give the corresponding message.
Regards,
Igor
2019 Nov 18 2:22 PM
Hi,
Dumb question: why even put such a select option when the user can only input first and last day of month.. Why don't you rather put month on the selection screen ?
Regards,
Dev.
2019 Nov 18 9:14 PM
If you are always expecting the first and last day of the month then why not simply make month/year the parameter instead of the date range? You can use FM POPUP_TO_SELECT_MONTH as F4 help for it.
Then in the code, convert the month into the date range, if necessary.
As a user, I wouldn't be very happy if I had to remember every time what's the last date in every month is.