12-01-2009 10:45 AM
how can we limit our selection option value to some definite period.
on some particular condition i want month should be in only in range of 12 months
12-01-2009 10:50 AM
Hi
I don't know what you mean by limiting month selection to 12 months.
However you could do some coding to check if the user has entered wrong data in the INITIALIZATION event.
Pushpraj
12-01-2009 10:55 AM
12-01-2009 11:07 AM
thanks for the reply.
i can enter date in MM/YYYY Format in my select option between any range.
but when a below checkbox is ticked then it range should not exceed 12 months.
eg 10.2008 to 11.2009 is wrong , greater than 12 months
10.2008 to 8.2009 is right , lesser than 12 months
12-01-2009 11:31 AM
I think you are searching for this function module.. see if this helps....
SELECT-OPTIONS: s_date FOR sy-datum.
..
data: no_months type i.
..
AT SELECTION-SCREEN ON s_date.
CALL FUNCTION 'MONTHS_BETWEEN_TWO_DATES'
EXPORTING
i_datum_bis = s_date-high
i_datum_von = s_date-low
* I_KZ_INCL_BIS = ' '
IMPORTING
E_MONATE = no_months.
IF no_months > 12.
MESSAGE
ENDIF.
12-01-2009 11:31 AM
Hi,
Try FM BKK_ADD_MONTH_TO_DATE.
The date in this FM is in the SAP internal format. So you can format the From and To date by putting '01' in the 'DD' field.
So if the user enters 10.2008 on the selection screen, then your from date will be 01.10.2008. Then use this FM with importing parameter month as '12'. It will give you the To date. Then check that the selection screen date is less than this date otherwise display error.
*/..Check that the analysis period is not greater than 3 months
lv_fdate = s_spmon-low.
lv_fdate+6(2) = '01'.
lv_tdate = s_spmon-high.
lv_tdate+6(2) = '01'.
*/..Check Valid to date is within 12 months of the Valid from date
CALL FUNCTION 'BKK_ADD_MONTH_TO_DATE'
EXPORTING
months = '12'
olddate = lv_fdate
IMPORTING
NEWDATE = lv_ndate.
IF lv_tdate > lv_ndate.
****Display error
ENDIF.
12-01-2009 11:40 AM
12-01-2009 10:52 AM
AT SELECTION-SCREEN ON object.
Check help about that event. There you can add code checking the content of the "object". There you can check if the user is trying to put more than 12 months, for example.
Good luck.
12-01-2009 11:06 AM
thanks for the reply.
i can enter date in MM.YYYY Format in my select option between any range.
but when a below checkbox is ticked then it range don't exceed 12 months.
eg 10.2008 to 11.2009 is wrong , greater than 12 months
10.2008 to 9.2009 is right , lesser than 12 months
12-01-2009 11:02 AM
Hi..
if you want to restrict to only for definit period.
you can use no-extension after the selection-options declaration.
see this
-
select-options: s_year for bseg-gjahr
no-extension.
All the best..
GSANA