Application Development 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: 

default & mandatory for high value in select option

former_member671224
Participant
0 Kudos
212

Hi gurus,

How set the <b>high value</b> in select option as mandatory and assign current date as default value?

Thanks,

Amal

1 ACCEPTED SOLUTION

naimesh_patel
Active Contributor
0 Kudos
88

Try with this code:

REPORT  ZTEST_NP.

TABLES: BKPF.

SELECT-OPTIONS: S_DATE FOR BKPF-BUDAT.

INITIALIZATION.
  S_DATE-SIGN = 'I'.
  S_DATE-OPTION = 'BT'.
  S_dATE-HIGH = SY-DATUM.
  APPEND S_DATE.

AT SELECTION-SCREEN ON S_DATE.
  IF S_dATE-HIGH IS INITIAL.
    MESSAGE E398(00) WITH 'Please enter TO date'.
  ENDIF.

Regards,

Naimesh Patel

4 REPLIES 4

naimesh_patel
Active Contributor
0 Kudos
89

Try with this code:

REPORT  ZTEST_NP.

TABLES: BKPF.

SELECT-OPTIONS: S_DATE FOR BKPF-BUDAT.

INITIALIZATION.
  S_DATE-SIGN = 'I'.
  S_DATE-OPTION = 'BT'.
  S_dATE-HIGH = SY-DATUM.
  APPEND S_DATE.

AT SELECTION-SCREEN ON S_DATE.
  IF S_dATE-HIGH IS INITIAL.
    MESSAGE E398(00) WITH 'Please enter TO date'.
  ENDIF.

Regards,

Naimesh Patel

0 Kudos
88

Naimesh,

Thanks its working.

Now iam doing the validation that high value should not be greater than current date.After validation the cursor should be in high value not in low value if the date in high value is greater that curent date.How to set the cursor to high value ?

Thanks,

Amal

0 Kudos
88

Ok..

For that you can use the SET CURSOR.

Like:

AT SELECTION-SCREEN ON S_DATE.
  IF S_dATE-HIGH IS INITIAL.
   SET CURSOR FIeld 'S_DATE-HIGH' DISPLAY OFFSET 0.  " <<<
    MESSAGE E398(00) WITH 'Please enter TO date'.
  ENDIF.

Regards,

Naimesh Patel

0 Kudos
88

thanks naimesh