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

restric selection screen

Former Member
0 Likes
525

hi,

if i want to restric selection screen with select-option and i should not use < or > options ,what is the technique plz explian me?

4 REPLIES 4
Read only

Former Member
0 Likes
490

SELECT-OPTIONS : s_enterp FOR v_enterpr NO INTERVALS ,

1)If you want your SELECT -OPTIONS to behave like parameters. USe the option.

SELECT-OPTIONS ..... NO INTERVALS NO-EXTENSION

Read only

Former Member
0 Likes
490

or you can use FM 'SELECT_OPTIONS_RESTRICT' to restrict select-options in your "initialization" event... it may be useful if you need to have different restricitons for different users for example.

Read only

Former Member
0 Likes
490

Hi,

Check this example..for material..IT will allow only EQ option.

TYPE-POOLS: sscr.

TABLES: mara.

SELECT-OPTIONS: so_matnr FOR mara-matnr.

INITIALIZATION.

DATA: gt_restrict TYPE sscr_restrict.

DATA: lwa_optlist TYPE sscr_opt_list,

lwa_ass TYPE sscr_ass.

  • Restricting the selection to only EQ.

lwa_optlist-name = 'OBJECTKEY1'.

lwa_optlist-options-eq = 'X'.

APPEND lwa_optlist TO gt_restrict-opt_list_tab.

  • Assign the kind and the name.

lwa_ass-kind = 'S'.

lwa_ass-name = 'SO_MATNR'.

lwa_ass-sg_main = 'I'.

lwa_ass-sg_addy = space.

lwa_ass-op_main = 'OBJECTKEY1'.

APPEND lwa_ass TO gt_restrict-ass_tab.

  • Call the function module to restrict the select-options

CALL FUNCTION 'SELECT_OPTIONS_RESTRICT'

EXPORTING

restriction = gt_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.

Thanks,

Naren

Read only

Former Member
0 Likes
490

Hi,

Have a look at this code

REPORT selectoptionsrestrict.

* Author   :  Lakshmi Sunitha
* Date     :  February 19, 2003 

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

Regards

Sudheer