‎2008 Feb 12 5:07 AM
in My selection screen, select-option for date
I want validation on date range . It should not be more than one month.
like 01.01.2008 to 01.02.2008. it should work.
if more than one month i.e 01.01.2008 to 01.03.2008. then msg will be there "not more than one month."
point is assured
‎2008 Feb 12 5:12 AM
Hi jim kelly,
Try this code :
data: date type sy-datum,
days type i.
select-options s_date for date.
at selection-screen.
days = s_date-high - s_date-low.
if days > 30.
message i000(sabapdocu) with 'Not more than 30 days'.
endif.
loop at s_date.
endloop.
Plzz reward if it is useful,
Mahi.
‎2008 Feb 12 5:12 AM
Use the DAYS_BETWEEN_TWO_DATES to get the no of days between two days and then do validetion.
REPORT ztest.
SELECTION-SCREEN BEGIN OF BLOCK b1.
SELECT-OPTIONS: s_date FOR sy-datum.
SELECTION-SCREEN END OF BLOCK b1.
AT SELECTION-SCREEN ON s_date.
DATA: lv_day TYPE i.
READ TABLE s_date INDEX 1.
IF sy-subrc EQ 0.
CALL FUNCTION 'DAYS_BETWEEN_TWO_DATES'
EXPORTING
i_datum_bis = s_date-high
i_datum_von = s_date-low
IMPORTING
e_tage = lv_day
EXCEPTIONS
days_method_not_defined = 1
OTHERS = 2.
IF sy-subrc EQ 0.
IF lv_day > '30'.
MESSAGE e000(001) WITH 'Date range more than one month'.
ENDIF.
ENDIF.
ENDIF.
‎2008 Feb 12 5:12 AM
Hi jim kelly,
Try this code :
data: date type sy-datum,
days type i.
select-options s_date for date.
at selection-screen.
days = s_date-high - s_date-low.
if days > 30.
message i000(sabapdocu) with 'Not more than 30 days'.
endif.
loop at s_date.
endloop.
Plzz reward if it is useful,
Mahi.
‎2008 Feb 12 5:15 AM
Use these FMs to get ur desire result.
'SLS_MISC_GET_LAST_DAY_OF_MONTH'
HR_99S_INTERVAL_BETWEEN_DATES
regards
‎2008 Feb 12 5:27 AM
Hi,
Try this i think it will help u.. think in this way and try to solve it...
Data : date1 type sy-datum,
date2 type sy-datum.
Date2 = Date10(4)-HIGH - Date10(4)-LOW
At selection-screen on field date.
if Date2 > 1.
Message E00(z001) // Not more than one month.
endif.
Regards
‎2008 Feb 12 5:41 AM
Hi Jim,,
There are two way of doing the things.
1. by taking the date difference by standard function module.
2. Just Simple take the difference of the two date in another work area.
regard
Swati
‎2008 Feb 12 5:52 AM
Hi Jim,
check out this..
REPORT ztest1.
DATA: date TYPE d.
DATA: l_month type I.
SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
SELECT-OPTIONS: s_date FOR sy-datum.
SELECTION-SCREEN END OF BLOCK b1.
AT SELECTION-SCREEN on s_date.
CALL FUNCTION 'HR_99S_INTERVAL_BETWEEN_DATES'
EXPORTING
BEGDA = s_date-low
endda = s_date-high
IMPORTING
C_MONTHS = l_month.
IF l_month > 1.
MESSAGE s000(ztest) WITH 'Not more than 1 month'.
ENDIF.
‎2008 Feb 12 7:22 AM