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

Select options -restricting the operator value options.

Former Member
0 Likes
1,805

Hi,

In selection screen for the select options or parameter declarations I need to restrict the operator options , like when they click for any select options it will give options to select = , #, <, <= , > , >=

all these options right.

I would like to restrict the user to select only > and >= while passing values.

Can anyone give me idea how I can approach this?

Thanks in advance.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,283

Hi,

You can use the function module SELECT_OPTIONS_RESTRICT in the INITIALIZATION event..

Search in SDN with this function module you will get a sample code..Or put a where used list of this function module...you will get to know how to populate the parameters..

THanks

Naren

Hi,

In selection screen for the select options or parameter declarations I need to restrict the operator options , like when they click for any select options it will give options to select = , #, <, <= , > , >=

all these options right.

I would like to restrict the user to select only > and >= while passing values.

Can anyone give me idea how I can approach this?

Thanks in advance.

7 REPLIES 7
Read only

Former Member
0 Likes
1,284

Hi,

You can use the function module SELECT_OPTIONS_RESTRICT in the INITIALIZATION event..

Search in SDN with this function module you will get a sample code..Or put a where used list of this function module...you will get to know how to populate the parameters..

THanks

Naren

Read only

0 Likes
1,283

Hi,

Check this Code..

report zs_list_select_option.

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.

Read only

Former Member
0 Likes
1,283

Hi,

In INTIALIZATION event, try to set the of select-option

initialization.

s_matnr-sign = 'I'.

s_matnr-option = 'GT',

s_matnr-option = '100'.

s_matnr-option = '300'.

append s_matnr.

The function module SELECT_OPTIONS_RESTRICT allows you to restrict the set of selection options available for a SELECT-OPTION (for example, only single values and patterns, i.e. 'EQ' and 'CP' are allowed). You can also forbid the leading sign 'E' (= 'Exclude from selection'). This means that you can considerably restrict the selections which can be entered on the selection screen.

Edited by: abhishek prakash on Feb 18, 2009 3:24 AM

Read only

Former Member
0 Likes
1,283

Hi,

use this FM...

SELECT_OPTIONS_RESTRICT can be use to supress options available with a SELECT-OPTIONS on a selection screen.

jusy copy the code and execute it....It will give the exact output what u want.....

TYPE-POOLS sscr.

TABLES : marc.

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

*Defining the selection-screen

SELECT-OPTIONS : s_matnr FOR marc-matnr,

s_werks FOR marc-werks.

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

Kiran

Read only

Former Member
0 Likes
1,283

Hi,

Did u try that one..

I tried in my system..it is working...

Regards

Kiran

Read only

Former Member
0 Likes
1,283

Hi

For select-optionsn you can restrict the values by using SELECT_OPTIONS_RESTRICT function module.

Regards,

Rajani

Read only

0 Likes
1,283

Hi,

Thanks for all..

I solved the problem.