2007 Jul 27 4:02 PM
I have an old program that only allows to "include" a certain range of values on the selection-screen. I need to be able to choose "excluded" values. I cannot remember the syntax. The code is below.
Thank-You.
SELECT-OPTIONS: cusobj FOR objs-objectname OBLIGATORY,
stype FOR objs-objecttype NO-DISPLAY.
2007 Jul 27 4:19 PM
Hi,
Comment NO-DISPLAY
SELECT-OPTIONS: cusobj FOR objs-objectname OBLIGATORY,
* MEMORY ID dvi,
stype FOR objs-objecttype. " NO-DISPLAY.
aRs
That that is the mechisum that is restricting the select-options to only allow you to enter "include" range. You must modify this coding to allow your "Excule" range as well. Can you post all surrounding code associated with this function module call.
Regards
Rich Heilman
2007 Jul 27 4:06 PM
2007 Jul 27 4:13 PM
It is using that Function Module.
CALL FUNCTION 'SELECT_OPTIONS_RESTRICT'
EXPORTING
PROGRAM =
restriction = restriction
DB = ' '
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.
Message was edited by:
Tom M.
2007 Jul 27 4:22 PM
2007 Jul 27 4:12 PM
Syntax would be some what like this .
select-options smatnr for mara-matnr DEFAULT 0 TO 'ZZZZZZZZ' sign E.
reward points if usefull.
Thanks ,
Veerendrnath maddula.
2007 Jul 27 4:13 PM
Tom,
You can write the code under initialization section of the program to include or exclude some values.
Here is the sample code
Initialization.
s_vbeln-opt = 'I'.
s_vbeln-sign = 'BT'.
s_vbeln-low = 100.
s_vbeln-high = 800.
append s_vbeln.
s_vbeln-opt = 'E'.
s_vbeln-sign = 'BT'.
s_vbeln-low = 120.
s_vbeln-high = 150.
append s_vbeln.
Thanks
mahesh
2007 Jul 27 4:19 PM
Hi,
Comment NO-DISPLAY
SELECT-OPTIONS: cusobj FOR objs-objectname OBLIGATORY,
* MEMORY ID dvi,
stype FOR objs-objecttype. " NO-DISPLAY.
aRs
2007 Jul 27 4:24 PM
*&----
*
*& Form SELOPT_NO_INTERV
*&----
*
Selektionsoption wird auf Eingabe von Einzelwerten beschränkt
UF25081999
*----
*
-->P_SELOPT Name der Selektionsoption
*----
*
FORM selopt_no_interv USING value(p_selopt) TYPE blockname.
DATA: restriction TYPE sscr_restrict,
w_opt_list TYPE sscr_opt_list,
w_ass_tab TYPE sscr_ass.
w_opt_list-name = 'NO_EXCL'.
w_opt_list-options-eq = 'X'.
w_opt_list-options-bt = 'X'.
APPEND w_opt_list TO restriction-opt_list_tab.
w_ass_tab-kind = 'S'.
w_ass_tab-name = p_selopt.
w_ass_tab-sg_main = 'I'.
w_ass_tab-sg_addy = ' '.
w_ass_tab-op_main = 'NO_EXCL'.
w_ass_tab-op_addy = 'NO_EXCL'.
APPEND w_ass_tab TO restriction-ass_tab.
CALL FUNCTION 'SELECT_OPTIONS_RESTRICT'
EXPORTING
PROGRAM =
restriction = restriction
DB = ' '
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.
ENDFORM. " SELOPT_NO_INTERV
2007 Jul 27 4:34 PM
Small Correction:
Below code need to change
w_opt_list-name = 'NO_EXCL'.
w_opt_list-options-eq = 'X'. "comment out
w_opt_list-options-bt = 'X'. "comment out
w_opt_list-options-nb = 'X'. "insert - SELECT-OPTIONS: Exclude range active
w_opt_list-options-ne = 'X'. "insert - SELECT-OPTIONS: Exclude single value
active
w_opt_list-options-np = 'X'. "insert - SELECT-OPTIONS: Exclude pattern active
Just check RSOPTIONS structure which is used for the reference w_opt_list.
2007 Jul 27 4:36 PM
2007 Jul 27 4:39 PM
Hi,
Check this sample code, may this will help you in changing the program according your needs
report zz_selection_screen_test .
* Include type pool SSCR
type-pools sscr.
* Define the object to be passed to the RESTRICTION parameter
data restrict type sscr_restrict.
* Auxiliary objects for filling RESTRICT
data opt_list type sscr_opt_list.
data ass type sscr_ass.
* Define the selection screen objects
* First block: 3 SELECT-OPTIONS
selection-screen begin of block block_0 with frame title text-bl0.
select-options sel_0_0 for sy-tvar0.
select-options sel_0_1 for sy-tvar1.
select-options sel_0_2 for sy-tvar2.
select-options sel_0_3 for sy-tvar3.
selection-screen end of block block_0.
* Second block: 2 SELECT-OPTIONS
selection-screen begin of block block_1 with frame title text-bl1.
select-options sel_1_0 for sy-subrc.
select-options sel_1_1 for sy-repid.
selection-screen end of block block_1.
initialization.
* Define the option list
* ALL: All options allowed
move 'ALL' to opt_list-name.
move 'X' to: opt_list-options-bt,
opt_list-options-cp,
opt_list-options-eq,
opt_list-options-ge,
opt_list-options-gt,
opt_list-options-le,
opt_list-options-lt,
opt_list-options-nb,
opt_list-options-ne,
opt_list-options-np.
append opt_list to restrict-opt_list_tab.
* NOPATTERN: CP and NP not allowed
clear opt_list.
move 'NOPATTERN' to opt_list-name.
move 'X' to: opt_list-options-bt,
opt_list-options-eq,
opt_list-options-ge,
opt_list-options-gt,
opt_list-options-le,
opt_list-options-lt,
opt_list-options-nb,
opt_list-options-ne.
append opt_list to restrict-opt_list_tab.
* NOINTERVLS: BT and NB not allowed
clear opt_list.
move 'NOINTERVLS' to opt_list-name.
move 'X' to: opt_list-options-cp,
opt_list-options-eq,
opt_list-options-ge,
opt_list-options-gt,
opt_list-options-le,
opt_list-options-lt,
opt_list-options-ne,
opt_list-options-np.
append opt_list to restrict-opt_list_tab.
* EQ_AND_CP: only EQ and CP allowed
clear opt_list.
move 'EQ_AND_CP' to opt_list-name.
move 'X' to: opt_list-options-cp,
opt_list-options-eq.
append opt_list to restrict-opt_list_tab.
* JUST_EQ: Only EQ allowed
clear opt_list.
move 'JUST_EQ' to opt_list-name.
move 'X' to opt_list-options-eq.
append opt_list to restrict-opt_list_tab.
* Assign selection screen objects to option list and sign
* KIND = 'A': applies to all SELECT-OPTIONS
move: 'A' to ass-kind,
'*' to ass-sg_main,
'NOPATTERN' to ass-op_main,
'NOINTERVLS' to ass-op_addy.
append ass to restrict-ass_tab.
* KIND = 'B': applies to all SELECT-OPTIONS in block BLOCK_0,
* that is, SEL_0_0, SEL_0_1, SEL_0_2
clear ass.
move: 'B' to ass-kind,
'BLOCK_0' to ass-name,
'I' to ass-sg_main,
'*' to ass-sg_addy,
'NOINTERVLS' to ass-op_main.
append ass to restrict-ass_tab.
* KIND = 'S': applies to SELECT-OPTION SEL-0-2
clear ass.
move: 'S' to ass-kind,
'SEL_0_2' to ass-name,
'I' to ass-sg_main,
'*' to ass-sg_addy,
'EQ_AND_CP' to ass-op_main,
'ALL' to ass-op_addy.
append ass to restrict-ass_tab.
* KIND = 'S': Applies to SELECT-OPTION SEL_0_3
clear ass.
move: 'S' to ass-kind,
'SEL_0_3' to ass-name,
'I' to ass-sg_main,
'N' to ass-sg_addy,
'JUST_EQ' to ass-op_main.
append ass to restrict-ass_tab.
* Call function module
call function 'SELECT_OPTIONS_RESTRICT'
exporting
restriction = restrict
* DB = ' '
exceptions
too_late = 1
repeated = 2
not_during_submit = 3
db_call_after_report_call = 4
selopt_without_options = 5
selopt_without_signs = 6
invalid_sign = 7
report_call_after_db_error = 8
empty_option_list = 9
invalid_kind = 10
repeated_kind_a = 11
others = 12.
* Exception handling
if sy-subrc ne 0.
* ...
endif.
* ...
start-of-selection.
aRs
| User | Count |
|---|---|
| 6 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |