‎2007 Jul 06 7:37 AM
hi,
pls tell me in my select-option i have date field, the range b/w should be 2 months apart,
how to do that on at selection-screen.
pls help
‎2007 Jul 06 7:45 AM
REPORT ychatest.
SELECT-OPTIONS : s_date FOR sy-datum.
DATA : v_date LIKE sy-datum,
v_mon(2) TYPE n.
INITIALIZATION.
s_date-sign = 'I'.
s_date-high = 'BT'.
s_date-low = sy-datum.
v_mon = sy-datum+4(2) + 2.
CONCATENATE sy-datum+0(4) v_mon sy-datum+6(2) INTO v_date.
s_date-high = v_date.
APPEND s_date.
CLEAR s_date.
‎2007 Jul 06 7:39 AM
‎2007 Jul 06 7:41 AM
Hi
Do u want to restrict your select option to particularly only two months or do u want your statement BETWEEN should be displayed in the select options
Can u clear my doubt
Regards
Pavan
‎2007 Jul 06 7:46 AM
Hi,
I feel that ur requirement is to display the default values on Selection Screen in the date field.
For this what u can do is :
INITIALIZATION.
S_DATUM-LOW = SY-DATUM - 30.
S_DATUM-HIGH = SY-DATUM + 30.
This will fill the select-options with default values.
If u need to check that the entered date range should be at least 2 months.
then u can do like this :
DATA : a type i.
AT SELECTION-SCREEN.
i = S_DATE-HIGH - S_DATE-LOW.
if i < 60.
message e000(0k) with 'Date range should be at least 2 months'.
endif.
Regards,
Himanshu
‎2007 Jul 06 7:45 AM
REPORT ychatest.
SELECT-OPTIONS : s_date FOR sy-datum.
DATA : v_date LIKE sy-datum,
v_mon(2) TYPE n.
INITIALIZATION.
s_date-sign = 'I'.
s_date-high = 'BT'.
s_date-low = sy-datum.
v_mon = sy-datum+4(2) + 2.
CONCATENATE sy-datum+0(4) v_mon sy-datum+6(2) INTO v_date.
s_date-high = v_date.
APPEND s_date.
CLEAR s_date.
‎2007 Jul 06 7:48 AM
HI -
Once the date is defined in the select options, guess this would help.
U can add this piece of code in the INITIALIZATION.
S_DATE-SIGN = 'I'.
S_DATE-OPTION = 'BT'.
S_DATE-HIGH = SY-DATUM.
CALL FUNCTION 'RP_CALC_DATE_IN_INTERVAL'
EXPORTING
DATE = S_DATE-HIGH
DAYS = '00'
MONTHS = '01'
SIGNUM = '-'
YEARS = '00'
IMPORTING
CALC_DATE = S_DATE-LOW.
APPEND S_DATE.
CLEAR S_DATE.
Thanks,
Maheshwari V
‎2007 Jul 06 7:45 AM
Double click on any one of the SELECT-OPTION on the selection screen.
You'll get a pop-up window which contains different options like EQ, BT, NB, NE, etc....
Click on that to set your requirement.
Regards,
Pavan P.
‎2007 Jul 06 7:55 AM
Hi Jamshad,
<b><u>You can write the code as below:</u></b>
SELECT-OPTIONS: s_date FOR sy-datum.
AT SELECTION-SCREEN ON s_date.
DATA date_diff TYPE i.
date_diff = s_date-high - s_date-low.
IF date_diff GT 60.
MESSAGE e000(0) WITH 'Please enter date not more that two months'.
ENDIF.
Reward Points... for useful answers..
Cheers !
Moqeeth.