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

Restricting the SELECT-OPTIONS

Former Member
0 Likes
3,184

Hi,

Thank you very much for reading this query.

My requirement is, for a SELECT-OPTIONS field , I need to provide only first 3 tabs which are

1) Select Single

2) Select Range

3) Exclude Single.

here I need to restrict only Exclude ranges.

can you please advise me how to use the FM "SELECT_OPTIONS_RESTRICT".

Thanks and Regards,

K.Krishna Chaitanya.

Hi,

Thank you very much for reading this query.

My requirement is, for a SELECT-OPTIONS field , I need to provide only first 3 tabs which are

1) Select Single

2) Select Range

3) Exclude Single.

here I need to restrict only Exclude ranges.

can you please advise me how to use the FM "SELECT_OPTIONS_RESTRICT".

Thanks and Regards,

K.Krishna Chaitanya.

7 REPLIES 7
Read only

Former Member
0 Likes
1,996

Use function module COMPLEX_SELECTIONS_DIALOG. Use importing parameter EXCLUDED_OPTIONS. This is a structure of type RSOPTIONS. In NB field put X. This will exclude Not Between from available options. But you need to program the screen by yourself.

Read only

Sandeep_Panghal
Product and Topic Expert
Product and Topic Expert
0 Likes
1,996

Check for where used list of FM : SELECT_OPTIONS_RESTRICT ,

e.g Include LWAK1E01

Read only

0 Likes
1,996

Hi,

The code which you are referring, is only for providing 'EQ' values.

But here I wanted to restrict Exclude ranges.So this code will not be help ful for me....

Read only

0 Likes
1,996

Hi,

I have put below code which is not working...

  • Restricting the S_ALIAS selection to only EQ.

gw_optlist-name = gc_op_main2.

gw_optlist-options-eq = 'X'.

gw_optlist-options-bt = 'X'.

gw_optlist-options-ne = 'X'.

APPEND gw_optlist TO gw_restrict1-opt_list_tab.

CLEAR gw_optlist.

gw_ass-kind = gc_kind.

gw_ass-name = gc_name2.

gw_ass-sg_main = gc_sg_main.

gw_ass-op_main = gc_op_main2.

APPEND gw_ass TO gw_restrict1-ass_tab.

CLEAR gw_ass.

*Function Module for restricting some of the

*features of Select-Options.

CALL FUNCTION 'SELECT_OPTIONS_RESTRICT'

EXPORTING

restriction = gw_restrict1

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 NE 0.

MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno

WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

ENDIF.

Can you please help me on this..

Read only

0 Likes
1,996

Check it

Read only

Former Member
0 Likes
1,996

Hi ,

I have done the same requiremnet once.

Below is code for your reference.


DATA : lit_restrict TYPE sscr_restrict,
         lwa_optlist TYPE sscr_opt_list,
         lwa_ass TYPE sscr_ass.
*---------------------------------------------------------------*
*       LOCAL CONSTANTS
*---------------------------------------------------------------*
  CONSTANTS : lc_obj_key(10) TYPE c VALUE 'B1',  "Block Name On Selection Screen
              lc_kind TYPE c VALUE 'S',    "Kind of Selection Screen S:Select Options
              lc_main TYPE c VALUE 'I',    "Sign of Selection Screen I:Only
              lc_reports(8) TYPE c VALUE 'S_REPORT',  "Screen Field Name on Selection Screen
              lc_set(1) VALUE 'X'.
*pass report name
  im_repid = sy-repid.
*Restricting SELECT-OPTIONS for 'EQ' 'CP' 'NE' 'NP'
  lwa_optlist-name = lc_obj_key.
  lwa_optlist-options-eq = lc_set.
  lwa_optlist-options-cp = lc_set.
  lwa_optlist-options-ne = lc_set.
  lwa_optlist-options-np = lc_set.
  APPEND lwa_optlist TO lit_restrict-opt_list_tab.

* One line of table associating selection screen object with opt. list
  lwa_ass-kind = lc_kind.
  lwa_ass-name = lc_reports.
  lwa_ass-sg_main = lc_main.
  lwa_ass-sg_addy = space.
  lwa_ass-op_main = lc_obj_key.
  APPEND lwa_ass TO lit_restrict-ass_tab.

*    Restrict Select Options
  CALL FUNCTION 'SELECT_OPTIONS_RESTRICT'
    EXPORTING
      program                = im_repid
      restriction            = lit_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.

Read only

faisalatsap
Active Contributor
0 Likes
1,996

Hi, KRISHNA

This Question has Asked and Answered many many times before do a [Little Search|http://forums.sdn.sap.com/search.jspa?threadID=&q=%22SELECT_OPTIONS_RESTRICT%22&objID=&dateRange=all&numResults=30&rankBy=10001] and even Pressing F1 on FM name SELECT_OPTIONS_RESTRICT can give you detailed Documentation.

Thanks and Regard,

Faisal