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

How to Exclude values from selection options

Former Member
0 Likes
10,507

Hey ya'll ,

I have selection screen with selection option for equipments I use select statement for all entries in that range to get the rest data , my Q is how can I exclude the ones in defined the ‘Exclude Ranges ’ tab and ‘Exclude Single Value ‘ tab  in smart way .

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
4,098

Hi Nora,

You can use the function module SELECT_OPTIONS_RESTRICT.

This function module simplifies the handling of SELECT-OPTIONS on the selection screen by restricting possible selection options and signs.

By calling this function module, you can restrict the number of select-options available for the chosen selection field. You can also disable the function allowing users to enter values to be excluded from the selection (SIGN = 'E'). The set of options (and signs) listed here can be extended for the 'multiple selection' screen.

CALL FUNCTION 'SELECT_OPTIONS_RESTRICT' "Make use of SELECT-OPTIONS easier on the selection screen

  EXPORTING

*   program =                   " sy-repid      Program name (default SY-CPROG or SY-LDBPG)

    restriction =               " sscr_restrict  Description of restrictions

*   db = SPACE                  " rsscr-db      X: Call using logical database

  EXCEPTIONS

    TOO_LATE = 1                "               Call is too late

    REPEATED = 2                "               Multiple call using LDB or report

    SELOPT_WITHOUT_OPTIONS = 3  "               One of the select-options contains no valid options

    SELOPT_WITHOUT_SIGNS = 4    "               One of the select-options does not have a valid sign

    INVALID_SIGN = 5            "               Invalid sign

    EMPTY_OPTION_LIST = 6       "               One of the options lists is empty

    INVALID_KIND = 7            "               One line has a KIND value unequal to A, B, or S

    REPEATED_KIND_A = 8         "               More than one line has KIND = 'A'

    .  "  SELECT_OPTIONS_RESTRICT

I hope it will be helpful for you.

Regards,

Gourav

Hey ya'll ,

I have selection screen with selection option for equipments I use select statement for all entries in that range to get the rest data , my Q is how can I exclude the ones in defined the ‘Exclude Ranges ’ tab and ‘Exclude Single Value ‘ tab  in smart way .

4 REPLIES 4
Read only

RaymondGiuseppi
Active Contributor
0 Likes
4,098

Use the IN RANGE option in the select statement.

Did you use the FOR ALL ENTRIES (for I EQ records only) because there were too much values for SQL execution, if yes try to extract the Exclude records in another range ?

Regards,

Raymond

Read only

custodio_deoliveira
Active Contributor
0 Likes
4,098

You should not use for all entries for a range/select options. Simply use IN:

Select field1 field2 from tab1 into table itab where field1 IN select_options_xx.

It will handle all values (including or excluding) in your range/select options

Read only

vinoth_aruldass
Contributor
0 Likes
4,098

hi,

Before processing your for all entries you should populate your selection option internal table with the range you need ..

then process for for all entries as a normal way..

hope it helps,

Vinoth

Read only

Former Member
0 Likes
4,099

Hi Nora,

You can use the function module SELECT_OPTIONS_RESTRICT.

This function module simplifies the handling of SELECT-OPTIONS on the selection screen by restricting possible selection options and signs.

By calling this function module, you can restrict the number of select-options available for the chosen selection field. You can also disable the function allowing users to enter values to be excluded from the selection (SIGN = 'E'). The set of options (and signs) listed here can be extended for the 'multiple selection' screen.

CALL FUNCTION 'SELECT_OPTIONS_RESTRICT' "Make use of SELECT-OPTIONS easier on the selection screen

  EXPORTING

*   program =                   " sy-repid      Program name (default SY-CPROG or SY-LDBPG)

    restriction =               " sscr_restrict  Description of restrictions

*   db = SPACE                  " rsscr-db      X: Call using logical database

  EXCEPTIONS

    TOO_LATE = 1                "               Call is too late

    REPEATED = 2                "               Multiple call using LDB or report

    SELOPT_WITHOUT_OPTIONS = 3  "               One of the select-options contains no valid options

    SELOPT_WITHOUT_SIGNS = 4    "               One of the select-options does not have a valid sign

    INVALID_SIGN = 5            "               Invalid sign

    EMPTY_OPTION_LIST = 6       "               One of the options lists is empty

    INVALID_KIND = 7            "               One line has a KIND value unequal to A, B, or S

    REPEATED_KIND_A = 8         "               More than one line has KIND = 'A'

    .  "  SELECT_OPTIONS_RESTRICT

I hope it will be helpful for you.

Regards,

Gourav