2009 Feb 17 8:16 PM
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.
2009 Feb 17 8:20 PM
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.
2009 Feb 17 8:20 PM
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
2009 Feb 17 10:46 PM
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.
2009 Feb 18 2:09 AM
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
2009 Feb 18 3:50 AM
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
2009 Feb 18 4:50 AM
Hi,
Did u try that one..
I tried in my system..it is working...
Regards
Kiran
2009 Feb 18 5:10 AM
Hi
For select-optionsn you can restrict the values by using SELECT_OPTIONS_RESTRICT function module.
Regards,
Rajani
2009 Feb 19 2:58 AM
| User | Count |
|---|---|
| 4 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |