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 option

Former Member
0 Likes
512

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?

5 REPLIES 5
Read only

dani_mn
Active Contributor
0 Likes
486

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

Read only

Simha_
Product and Topic Expert
Product and Topic Expert
0 Likes
486

Hi,

U can use this..

tables: sflight.

select-options: carrid for sflight-CARRID

no-extension.

CHEERS,

SIMHA.

<b>Reward all the helpful answers..</b>

Read only

Former Member
0 Likes
486

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

Read only

Former Member
0 Likes
486

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

Read only

Manohar2u
Active Contributor
0 Likes
486

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