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: 

Restricting Select-options from range 1 to 16

rahul_1996
Participant

Hi All,

I have a Requirement in which i have to restrict the value in select-option range from 1 to 16. User can't input more than 16 values in select-option range.

Can anyone help me regarding this?

1 ACCEPTED SOLUTION

bm_naidu
Explorer

Use AT SELECTION SCREEN ON FIELD for validation regarding number of entries in select option table and give error message for more that 16 entries.

10 REPLIES 10

bm_naidu
Explorer

Use AT SELECTION SCREEN ON FIELD for validation regarding number of entries in select option table and give error message for more that 16 entries.

0 Kudos

Hi Can You Explain By giving Some Example.

0 Kudos
AT SELECTION-SCREEN ON S_RPMAX.
 IF S_RPMAX[] IS NOT INITIAL.
 IF S_RPMAX-HIGH > 16.
 MESSAGE 'Please enter range of value between 1 to 16 in selecion option' TYPE 'E'.
 ENDIF.
ENDIF.

0 Kudos

Thanks i done like this it is working

matt
Active Contributor
rahul_1996 You code is wrong. It doesn't check that the low value is greater than zero. It also doesn't allow for multiple lines within the select option internal table. It doesn't allow for excluding a range.

For ranges, where you want one entry between two specific values, use two parameters on the same line - one for the high, one for the low, as detailed in this blog concerning dates: https://blogs.sap.com/2014/02/07/dates-and-select-options/

0 Kudos

Thanks Matthew, for the answer actually I am new to Abap So i am learning.

Sandra_Rossi
Active Contributor
0 Kudos

I guess that you want to use a very limited version of the powerful "select-options".

So, instead, as Matthew said, you should define 2 fields, one "from" and one "to".

For instance, two fields in the same line:

SELECTION-SCREEN BEGIN OF LINE.
  SELECTION-SCREEN COMMENT (30) text-s01. " and define the text of text symbol S01
  SELECTION-SCREEN POSITION 32.
  PARAMETERS p_from TYPE i.
  PARAMETERS p_to   TYPE i.
SELECTION-SCREEN END OF LINE.

See all the explanations in the ABAP documentation.

Thanks Sandra for the answer As always Helping me.

0 Kudos

Helping you, and anyone in the community, no favorites 😉