Application Development 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: 

select-options multiple selection

Former Member
0 Kudos

hi

can u send code for

getting multiple selections in select-options

Thanks in advance

venkat

7 REPLIES 7

Former Member
0 Kudos

Hi Venkat,

Your query is not clear..can u give more details about ur query?

Regards

Jaker.

RichHeilman
Developer Advocate
Developer Advocate
0 Kudos

If you are referring to select-options defined in a selection screen. This mulitple selections functionality is handled automatically for you. For example, say you have a select-option for date and you have to select records from your database based on that select-option, you would use the IN operator in your select statement.

select-options: s_datum for sy-datum.

select * into table itab from ztable
           where datum in s_datum.

Regards,

Rich Heilman

Former Member
0 Kudos

hi venkat,

The select-options statement is used similarly to the parameters statement in that it creates a selection criteria for a database field. The main difference between the two is that the select-options statement creates two input fields containing both a FROM and a TO field, as opposed to just a single field input.

Syntax for select-options

The syntax for this statement is as follows:

select-options ex sele for table-field default 'VALUELOW' to 'VALUEHI'.

The select-options statement displays a line that usually has two fields for input data. This can be restricted to only one by using the no-intervals clause in the select-options syntax. For example, if your program does not require a TO field for entry in select-options statement line, but you still want to use the select-options statement, you would include this no-intervals clause. This clause, as well as the no-extension clause, will be further explored in the example at the end of this section. For now, however, we will turn to a discussion of the format of the select-options internal selection table.

This internal table is maintained with the following field format if the user clicks on the arrow to the right of the TO field of the select-options. Clicking on this arrow brings up a Multiple Selections input screen that fills the internal selection table. This table then holds the key attributes of the input data, including the SIGN, OPTION, LOW value, and HIGH value. These features of the select-options statement can have the following conditions:

SIGN-Can signify INCLUSIVE, which is the default, or EXCLUSIVE, which can be flagged in the Complex Selections window.

OPTION-Can hold values BT (between), CP (contains pattern), EQ (equal to), and GE (greater than or equal to).

LOW-Holds the value input in the FROM field.

HIGH-Holds the value input in the TO field.

regards,

keerthi

Former Member
0 Kudos

Venkatesh,

DATA : s_mara like mara occurs 0 with header line.

SELECT-OPTIONS: s_matnr FOR mara-matnr.

In selection statement.

select * from mara into i_mara

where matnr in s_matnr.

Here you can get all the values of mara which are enter in selection screen.

Pls. mark if useful

Former Member
0 Kudos

hi

good

go through this links which ll give you detail idea about the SELECT-OPTIONS

http://www.sts.tu-harburg.de/teaching/sap_r3/ABAP4/select_o.htmhttp://help.sap.com/saphelp_nw2004s/h...

thanks

mrutyun^

Former Member
0 Kudos

Hi,

In SELECTION Screen, if u have used SELECT-OPTIONS, then u can use this multiple selection.

IF u press teh side arrow near the text box, u will be able to give multiple values in the rows.

Also u can give muliple ranges.

Where as in screen if u enter u can enter only in from and to, if u choose this arrow button then u can enter lots f ranges.

But in the select query IN operator will take care of all the values.

If u dont want taht multiple selections u can restrict the same in

SELECT-OPTIONS: s_matnr FOR mara-matnr NO-EXTENSIONS.

This will remove teh arrow from the selection screen.

Hope u r clear.

Reward if u find helpful.

Former Member
0 Kudos

HI......

select-options:

s_carrid for spfli-carrid.

then u need to append records to it to get multiple selections, as

s_carrid-low = 'AA'

s_carrid-high = 'DA'

s_carrid-option = 'EQ'

s_carrid-sign = 'I'

APPEND S_CARRID.

like this append as many as u need ,

then combination of all these will be taken into consideration while retrieving the data from DB