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: 

How to disable the SELECT-OPTINS multiple selection screen's Ranges options

Former Member
0 Kudos

Hi this is sekhar,

I have used the Select-options: statement with 'No-Interval' option. Now I need to restrict the user not to enter the values in the Ranges column of multiple selection screen. How can I do it....

11 REPLIES 11

Former Member

,NO EXTENSIONS' CAN BE USED AT SELECT-OPTIONS.

SELECT-OPTIONS f_fldate FOR wa_flight-FLDATE DEFAULT '20140801' TO '20141031' NO-EXTENSION.

0 Kudos

The syntax given above SELECT-OPTIONS f_fldate FOR wa_flight-FLDATE DEFAULT '20140801' TO '20141031' NO-EXTENSION.

works for me. Thanks! It helped me a lot.

Former Member
0 Kudos

Hi,

This is SAP standard, you can use no-intervals at max but i dont think so you can disable RANGE option.

You can put a check in AT SELECTION-SCREEN.

IF select-option-high contains some value.

Then you can stop processing and show appropriate message.

*REWARD if this helps

anversha_s
Active Contributor
0 Kudos

Hi shekar,

welcome to SDN.

chkl this sample code.

REPORT Z_CONECT_A.

  • Include type pool SSCR

TYPE-POOLS sscr.

TABLES : marc.

  • defining the selection-screen

select-options :

s_matnr for marc-matnr,

s_werks for marc-werks.

  • Define the object to be passed to the RESTRICTION parameter

DATA restrict TYPE sscr_restrict.

  • Auxiliary objects for filling RESTRICT

DATA : optlist TYPE sscr_opt_list,

ass type sscr_ass.

INITIALIZATION.

  • Restricting the MATNR selection to only EQ and 'BT'.

optlist-name = 'OBJECTKEY1'.

optlist-options-eq = 'X'.

optlist-options-bt = 'X'.

APPEND optlist TO restrict-opt_list_tab.

ass-kind = 'S'.

ass-name = 'S_MATNR'.

ass-sg_main = 'I'.

ass-sg_addy = space.

ass-op_main = 'OBJECTKEY1'.

APPEND ass TO restrict-ass_tab.

  • Restricting the WERKS selection to CP, GE, LT, NE.

optlist-name = 'OBJECTKEY2'.

optlist-options-cp = 'X'.

optlist-options-ge = 'X'.

optlist-options-lt = 'X'.

optlist-options-ne = 'X'.

APPEND optlist TO restrict-opt_list_tab.

ass-kind = 'S'.

ass-name = 'S_WERKS'.

ass-sg_main = 'I'.

ass-sg_addy = space.

ass-op_main = 'OBJECTKEY2'.

APPEND ass TO restrict-ass_tab.

CALL FUNCTION 'SELECT_OPTIONS_RESTRICT'

EXPORTING

restriction = restrict

EXCEPTIONS

TOO_LATE = 1

REPEATED = 2

SELOPT_WITHOUT_OPTIONS = 3

SELOPT_WITHOUT_SIGNS = 4

INVALID_SIGN = 5

EMPTY_OPTION_LIST = 6

INVALID_KIND = 7

REPEATED_KIND_A = 8

OTHERS = 9

.

IF sy-subrc <> 0.

MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

rgds

anver

Message was edited by: Anversha s

Message was edited by: Anversha s

Former Member
0 Kudos

i don't know if it is possible restrict in map parameters

you can you a control with at selecion-screen on <Ranges>

where you check if are present datas in column of multiple selection screen.

Former Member
0 Kudos

you can do it in the following way :

FORM init_screen.

DATA: restrict TYPE sscr_restrict,

opt_list TYPE sscr_opt_list,

ass TYPE sscr_ass.

*...... restrict select options: only inclusive values allowed ........

CLEAR opt_list.

opt_list-name = 'OPT_LIST'.

opt_list-options-bt = 'X'.

opt_list-options-eq = 'X'.

APPEND opt_list TO restrict-opt_list_tab.

CLEAR ass.

ass-kind = 'B'.

ass-name = 'SET_SELECTION'.

ass-sg_main = 'I'.

ass-op_main = 'OPT_LIST'.

APPEND ass TO restrict-ass_tab.

CALL FUNCTION 'SELECT_OPTIONS_RESTRICT'

EXPORTING

restriction = restrict.

ENDFORM.

Former Member
0 Kudos

You can also refer this code as below : CHECK OUT SELECT OPTION sel_1_0.

&----


*& Report ZTESTREP

*&

&----


*&

*&

&----


REPORT ztestrep.

  • Include type pool SSCR

TYPE-POOLS sscr.

  • Define the object to be passed to the RESTRICTION parameter

DATA restrict TYPE sscr_restrict.

  • Auxiliary objects for filling RESTRICT

DATA opt_list TYPE sscr_opt_list.

DATA ass TYPE sscr_ass.

  • Define the selection screen objects

  • First block: 3 SELECT-OPTIONS

SELECTION-SCREEN BEGIN OF BLOCK block_0 WITH FRAME TITLE text-bl0.

SELECT-OPTIONS sel_0_0 FOR sy-tvar0.

SELECT-OPTIONS sel_0_1 FOR sy-tvar1.

SELECT-OPTIONS sel_0_2 FOR sy-tvar2.

SELECT-OPTIONS sel_0_3 FOR sy-tvar3.

SELECTION-SCREEN END OF BLOCK block_0.

  • Second block: 2 SELECT-OPTIONS

SELECTION-SCREEN BEGIN OF BLOCK block_1 WITH FRAME TITLE text-bl1.

SELECT-OPTIONS sel_1_0 FOR sy-subrc.

SELECT-OPTIONS sel_1_1 FOR sy-repid.

SELECTION-SCREEN END OF BLOCK block_1.

INITIALIZATION.

  • Define the option list

  • ALL: All options allowed

MOVE 'ALL' TO opt_list-name.

MOVE 'X' TO: opt_list-options-bt,

opt_list-options-cp,

opt_list-options-eq,

opt_list-options-ge,

opt_list-options-gt,

opt_list-options-le,

opt_list-options-lt,

opt_list-options-nb,

opt_list-options-ne,

opt_list-options-np.

APPEND opt_list TO restrict-opt_list_tab.

  • NOPATTERN: CP and NP not allowed

CLEAR opt_list.

MOVE 'NOPATTERN' TO opt_list-name.

MOVE 'X' TO: opt_list-options-bt,

opt_list-options-eq,

opt_list-options-ge,

opt_list-options-gt,

opt_list-options-le,

opt_list-options-lt,

opt_list-options-nb,

opt_list-options-ne.

APPEND opt_list TO restrict-opt_list_tab.

  • NOINTERVLS: BT and NB not allowed

CLEAR opt_list.

MOVE 'NOINTERVLS' TO opt_list-name.

MOVE 'X' TO: opt_list-options-cp,

opt_list-options-eq,

opt_list-options-ge,

opt_list-options-gt,

opt_list-options-le,

opt_list-options-lt,

opt_list-options-ne,

opt_list-options-np.

APPEND opt_list TO restrict-opt_list_tab.

  • EQ_AND_CP: only EQ and CP allowed

CLEAR opt_list.

MOVE 'EQ_AND_CP' TO opt_list-name.

MOVE 'X' TO: opt_list-options-cp,

opt_list-options-eq.

APPEND opt_list TO restrict-opt_list_tab.

  • JUST_EQ: Only EQ allowed

CLEAR opt_list.

MOVE 'JUST_EQ' TO opt_list-name.

MOVE 'X' TO opt_list-options-eq.

APPEND opt_list TO restrict-opt_list_tab.

  • Assign selection screen objects to option list and sign

  • KIND = 'A': applies to all SELECT-OPTIONS

MOVE: 'A' TO ass-kind,

'*' TO ass-sg_main,

'NOPATTERN' TO ass-op_main,

'NOINTERVLS' TO ass-op_addy.

APPEND ass TO restrict-ass_tab.

  • KIND = 'B': applies to all SELECT-OPTIONS in block BLOCK_0,

  • that is, SEL_0_0, SEL_0_1, SEL_0_2

CLEAR ass.

MOVE: 'B' TO ass-kind,

'BLOCK_0' TO ass-name,

'I' TO ass-sg_main,

'*' TO ass-sg_addy,

'NOINTERVLS' TO ass-op_main.

APPEND ass TO restrict-ass_tab.

  • KIND = 'S': applies to SELECT-OPTION SEL-0-2

CLEAR ass.

MOVE: 'S' TO ass-kind,

'SEL_0_2' TO ass-name,

'I' TO ass-sg_main,

'*' TO ass-sg_addy,

'EQ_AND_CP' TO ass-op_main,

'ALL' TO ass-op_addy.

APPEND ass TO restrict-ass_tab.

  • KIND = 'S': Applies to SELECT-OPTION SEL_0_3

CLEAR ass.

MOVE: 'S' TO ass-kind,

'SEL_0_3' TO ass-name,

'I' TO ass-sg_main,

'N' TO ass-sg_addy,

'JUST_EQ' TO ass-op_main.

APPEND ass TO restrict-ass_tab.

  • Call function module

CALL FUNCTION 'SELECT_OPTIONS_RESTRICT'

EXPORTING

restriction = restrict

  • DB = ' '

EXCEPTIONS

too_late = 1

repeated = 2

not_during_submit = 3

db_call_after_report_call = 4

selopt_without_options = 5

selopt_without_signs = 6

invalid_sign = 7

report_call_after_db_error = 8

empty_option_list = 9

invalid_kind = 10

repeated_kind_a = 11

OTHERS = 12.

Former Member
0 Kudos

hi sekhar ,

just execute this code ..

welcome to sdn.

regards,

Vijay.

<b>give the input as 1 and 20 in the range..</b>

-


REPORT ZEX4 .

tables mara.

select-options: so_matnr for mara-matnr.

at selection-screen.

if so_matnr-high ne ' '.

clear so_matnr-high.

message e999(zp) with 'cant enter values'.

endif.

Message was edited by: Vijay

Former Member
0 Kudos

Use directly the FM 'COMPLEX_SELECTIONS_DIALOG'. There you have many possibilities concerning restrictions of select options.

Regards,

Thomas

Former Member
0 Kudos

Hi sekhar,

1. You only want to allow SINGLE VALUES

(and not ranges)

2. just copy paste to get a taste of it.

3. (Its a little tricky to understand)

4.

REPORT abc NO STANDARD PAGE HEADING.

TYPE-POOLS : sscr.

*----


Data

TABLES : t001.

*----


IMPORTANT VARIABLES

DATA : res TYPE sscr_restrict.

DATA : opt_list TYPE sscr_opt_list.

DATA : ass TYPE sscr_ass.

*----


Sel Screen.

SELECT-OPTIONS : bukrs FOR t001-bukrs.

*----


INITIALIZATION.

*----


IMPORTANT CODE

opt_list-name = 'A'.

opt_list-options-eq = 'X'.

APPEND opt_list TO res-opt_list_tab.

ass-kind = 'A'.

ass-name = 'BUKRS'.

ass-op_main = 'A'.

ass-sg_main = '*'.

APPEND ass TO res-ass_tab.

CALL FUNCTION 'SELECT_OPTIONS_RESTRICT'

EXPORTING

  • PROGRAM =

restriction = res

  • DB = ' '

EXCEPTIONS

too_late = 1

repeated = 2

selopt_without_options = 3

selopt_without_signs = 4

invalid_sign = 5

empty_option_list = 6

invalid_kind = 7

repeated_kind_a = 8

OTHERS = 9

.

BREAK-POINT.

regards,

amit m.