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: 

Limitation in SELECT-OPTIONS - how?

Former Member
0 Kudos

Hi,

I need to limit my select-options in a way - do not allow the user to enter any ranges, but to allow him/her to enter multiple single values. 'NO INTERVALS' addition doesn't help me here.

Further, I need to restrict him/her to use only 'EQ' option in the select-options and do not use wild cards.

How can I achieve this? Is the only way to loop at select_table and to check all the params, or there is another more elegant way?

Any hints are wellcome.

Many thanks in advance.

Ivaylo Mutafchiev

1 ACCEPTED SOLUTION

athavanraja
Active Contributor
0 Kudos

fm

SELECT_OPTIONS_RESTRICT

also check this forum post (search the forum, this has been discussed before).

Regards

Raja

3 REPLIES 3

athavanraja
Active Contributor
0 Kudos

fm

SELECT_OPTIONS_RESTRICT

also check this forum post (search the forum, this has been discussed before).

Regards

Raja

0 Kudos

Here is a quick sample program if you need further assistance.



report zrich_0001.

* Type pools
type-pools: slis, sscr.

* Selection Screen
select-options: s_date for sy-datum.

initialization.
  perform initilization.


************************************************************************
*  INITILIZATION
************************************************************************
form initilization.

* Restrict the select options for S_DATE
* to just a date range
  data: selopt   type sscr_ass,
        opt_list type sscr_opt_list,
        restrict type sscr_restrict.

  clear opt_list.
  opt_list-name          = 'EQ'.
  opt_list-options-eq    = 'X'.
  append opt_list to restrict-opt_list_tab.

  clear selopt.
  selopt-kind            = 'S'.
  selopt-name            = 'S_DATE'.
  selopt-sg_main         = 'I'.
  selopt-sg_addy         = ' '.
  selopt-op_main         = 'EQ'.
  selopt-op_addy         = 'EQ'.
  append selopt  to restrict-ass_tab.

  call function 'SELECT_OPTIONS_RESTRICT'
       exporting
            restriction            = restrict
       exceptions
            too_late               = 1
            repeated               = 2
            selopt_without_options = 5
            selopt_without_signs   = 6
            invalid_sign           = 7
            empty_option_list      = 9
            invalid_kind           = 10
            repeated_kind_a        = 11
            others                 = 12.


endform.

Regards,

Rich Heilman

Former Member
0 Kudos

Hi,

Check this program too

*.......................................................................

*: Report: ZRESTRICT_SELOPT :

*: :

*: Author: www.SAPdev.co.uk :

*: :

*: Date : 2004 :

*: :

*: Description: Demonstrates how to restrict select options to only :

*: allow specific restriction options: :

*: i.e.. EQ, NE, BT etc.. :

*:.....................................................................:

REPORT ZRESTRICT_SELOPT.

  • Include type pool SSCR

TYPE-POOLS sscr.

TABLES: EKPO.

  • Selection-screen

select-options : so_ebeln for ekpo-ebeln,

so_ebelp for ekpo-ebelp.

  • Variables for populating restriction data

DATA: gd_restrict TYPE sscr_restrict. "structure containing 2 tables

DATA: gd_optlist TYPE sscr_opt_list, "header line for table 1

gd_ass TYPE sscr_ass. "header line for table 2

************************************************************************

*INITIALIZATION.

INITIALIZATION.

  • Restrict SO_EBELN to only except EQ, BT and NE.

gd_optlist-name = 'KEY1'. "Can be anything

gd_optlist-options-eq = 'X'.

gd_optlist-options-bt = 'X'.

gd_optlist-options-ne = 'X'.

APPEND gd_optlist TO gd_restrict-opt_list_tab.

clear: gd_optlist.

gd_ass-kind = 'S'.

gd_ass-name = 'SO_EBELN'.

gd_ass-sg_main = 'I'.

gd_ass-sg_addy = SPACE.

gd_ass-op_main = 'KEY1'. "Must be same as above

APPEND gd_ass TO gd_restrict-ass_tab.

clear: gd_ass.

  • Restrict SO_EBELP to only except CP, GE, LT.

gd_optlist-name = 'KEY2'. "Can be anything

gd_optlist-options-cp = 'X'.

gd_optlist-options-ge = 'X'.

gd_optlist-options-lt = 'X'.

APPEND gd_optlist TO gd_restrict-opt_list_tab.

clear: gd_optlist.

gd_ass-kind = 'S'.

gd_ass-name = 'SO_EBELP'.

gd_ass-sg_main = 'I'.

gd_ass-sg_addy = SPACE.

gd_ass-op_main = 'KEY2'. "Must be same as above

APPEND gd_ass TO gd_restrict-ass_tab.

clear: gd_ass.

CALL FUNCTION 'SELECT_OPTIONS_RESTRICT'

EXPORTING

  • PROGRAM =

restriction = gd_restrict

  • 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.

IF sy-subrc <> 0.

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

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

ENDIF.

Got it from this link

http://www.sapdevelopment.co.uk/reporting/selscr/selscr_restrictso.htm

Thanks & Regards,

Judith.