‎2006 Jul 22 5:06 AM
what is the purpose of select option?
what are the addition for select option?
For a Select-Option variable, what can be done to prevent the user from giving multiple ranges as input?
‎2006 Jul 22 5:16 AM
Hi,
Select-options are just like internal tables. they are used to give user a multi selection option.
select-option have.
LOW : lower range limit
HIGH : high range limit
SIGN : operator used like =, <> , <= , >=.
OPTION : I = inclulde, E = exclude.
following are the addition for it.
<b>SELECT-OPTIONS sel FOR f.
1. ... DEFAULT g
2. ... DEFAULT g ... OPTION xx ... SIGN s
3. ... DEFAULT g TO h
4. ... DEFAULT g TO h ... OPTION op ... SIGN s
5. ... MEMORY ID pid
6. ... MATCHCODE OBJECT mobj
7. MODIF ID key
8. ... NO-DISPLAY
9. ... LOWER CASE
10. ... OBLIGATORY
11. ... NO-EXTENSION
12. ... NO INTERVALS
13. ... NO DATABASE SELECTION
14. ... VALUE-REQUEST
15. ... VALUE-REQUEST FOR LOW/HIGH
16. ... HELP-REQUEST
17. ... HELP-REQUEST FOR LOW/HIGH
18. ... VISIBLE LENGTH vlen</b>
You can use NO-EXTENSION option to stop giving multple ranges.
Regards,
Wasim Ahmed
‎2006 Jul 22 5:22 AM
Hi,
U can use this..
tables: sflight.
select-options: carrid for sflight-CARRID
no-extension.
CHEERS,
SIMHA.
<b>Reward all the helpful answers..</b>
‎2006 Jul 22 7:07 AM
Hi,
<b>what is the purpose of select option?</b>
select option are mainly used in select query.
select * from abc
where field in <Select_option_name>.
select option automatically creates logical condition for select query
since select option contains many option like >= , <=
interval etc.
This simple query is broken in proper select query for data base; based on the option selected in the select option.
<i>eg ( simple query in abap )</i>
select * from abc
where field in <Select_option_name>.
\/
<i>Actual query may look like this</i>
select * from abc
where field <= [Value in select option] " for internal
and field >= [Value in select option] " for internal
and field in [value1 value2 value3 etc] " for single value.
U can alos use select-option in loop
than is
loop at itab where field in <Select option>
-
code
endloop.
<b>what are the addition for select option?</b>
1. ... DEFAULT g
2. ... DEFAULT g ... OPTION xx ... SIGN s
3. ... DEFAULT g TO h
4. ... DEFAULT g TO h ... OPTION op ... SIGN s
5. ... MEMORY ID pid
6. ... MATCHCODE OBJECT mobj
7. MODIF ID key
8. ... NO-DISPLAY
9. ... LOWER CASE
10. ... OBLIGATORY
11. ... NO-EXTENSION
12. ... NO INTERVALS
13. ... NO DATABASE SELECTION
14. ... VALUE-REQUEST
15. ... VALUE-REQUEST FOR LOW/HIGH
16. ... HELP-REQUEST
17. ... HELP-REQUEST FOR LOW/HIGH
18. ... VISIBLE LENGTH vlen
<b>For a Select-Option variable, what can be done to prevent the user from giving multiple ranges as input?</b>
Not possible. ( not directly )
but u loop the select option table and count the number of records <b>where SIGN = BT</b>
and if the count greater than 1 ..give error
‎2006 Jul 22 8:58 AM
hi,
try this simple program,
TABLES SFLIGHT.
DATA ITAB LIKE SFLIGHT OCCURS 0 WITH HEADER LINE.
SELECT-OPTIONS FLDATE FOR SFLIGHT-FLDATE.
SELECT * FROM SFLIGHT INTO TABLE ITAB WHERE FLDATE IN FLDATE.
LOOP AT ITAB.
WRITE:/...
ENDLOOP.
best of luck,
regards,
kcc
‎2006 Jul 22 9:09 AM
You can also explore on SELECTOPTIONRESTRICT FM which will be used for restricting only multiple ranges.
Mainly for controlling F4 of select-option.
Try with this example.
report sample.
tables: usr02.
type-pools: sscr.
select-options: usrbnam for usr02-bname no intervals,
creator for usr02-aname no intervals.
data: restrict type sscr_restrict,
opt_list type sscr_opt_list,
ass type sscr_ass.
initialization.
clear: opt_list.
opt_list-name = 'EQAL'.
opt_list-options-eq = 'X'.
append opt_list to restrict-opt_list_tab.
clear: ass.
ass-kind = 'S'.
ass-name = 'USRBNAM'.
ass-sg_main = 'I'.
ass-sg_addy = ' '.
ass-op_main = 'EQAL'.
ass-op_addy = 'EQAL'.
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.
start-of-selection.
select * from usr02 where bname in usrbnam
and aname in creator.
write: / usr02-bname, usr02-aname.
endselect.Regds
Manohar
Message was edited by: Manohar Reddy