11-03-2007 8:27 AM
Hi,
I have one select option Inventory period(S_INVPRD) in my selection screen.
I want to restrict the date range to one year period. i.e the user should not be allowed to enter the date range which is more than one year.
Could you please help on this.
Regards,
Sankar
11-03-2007 8:56 AM
in event.
at-selection on S_INVPRD
use FM to find difference between S_INVPRD-high and S_INVPRD-low
if diff is greater than 365 days
give error messafe
tc
saji
11-03-2007 8:56 AM
in event.
at-selection on S_INVPRD
use FM to find difference between S_INVPRD-high and S_INVPRD-low
if diff is greater than 365 days
give error messafe
tc
saji
11-03-2007 9:10 AM
May i know the FM name, because i tried to use the FM /SDF/CMO_DATETIME_DIFFERENCE, but it is returning 0 value.
11-03-2007 9:13 AM
Hi,
Please you the code below :
data : days type i,
year type i.
select-OPTIONS : so_budat for bsis-budat.
at SELECTION-SCREEN.
CALL FUNCTION 'HR_SGPBS_YRS_MTHS_DAYS'
EXPORTING
beg_da = so_budat-low
end_da = so_budat-high
IMPORTING
NO_DAY = days
* NO_MONTH = month
NO_YEAR = year
* NO_CAL_DAY =
* EXCEPTIONS
* DATEINT_ERROR = 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.
IF YEAR > 1.
MESSAGE 'More than One Year' type 'E'.
endif.
if days > 0.
message 'More than one year' type 'E'.
endif.
Thanks,
Sriram Ponna.
11-03-2007 9:32 AM