Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

about select-option

Former Member
0 Likes
714

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

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
697
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.
7 REPLIES 7
Read only

Former Member
0 Likes
697

hi,

U can use BETWEEN.

Read only

Former Member
0 Likes
697

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

Read only

0 Likes
697

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

Read only

Former Member
0 Likes
698
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.
Read only

0 Likes
697

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

Read only

Former Member
0 Likes
697

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.

Read only

mohammed_moqeeth
Active Participant
0 Likes
697

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.