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
910

Hi

I want to filter the data according to the inputs given by user in SELECT-OPTION.

in an select quires.

please help to know how to get the values enter by user in screen of Select-option ...is it in LOW and HIGH of SELECT-OPTION. ??

Thanks in advance

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
869

Hello Lokesh,

validate the field that u are selecting from the selection statements like this in where clause...

.....

WHERE MATNR <b>IN</b> S_MATNR.

Now select statement will fetch the records for only the values given in LOW and HIGH of S_MATNR.

<b><REMOVED BY MODERATOR></b>

Regards

--

Sasidhar Reddy Matli.

Message was edited by:

Alvaro Tejada Galindo

8 REPLIES 8
Read only

Former Member
0 Likes
869

Hi,

Refer to the following code:

SELECT vbeln

fkart

fkdat

FROM vbrk

INTO TABLE int_vbrk

WHERE vbeln IN s_vbeln.

Hope this helps.

<b><REMOVED BY MODERATOR></b>

Regards,

Sipra

Message was edited by:

Alvaro Tejada Galindo

Read only

former_member404244
Active Contributor
0 Likes
869

Hi,

u ahve to write the query like this irrespective of low or high.

data : s_matnr for mara-matnr.

select * from mara into table itab where matnr in s_matnr.

Regards,

Nagaraj

Read only

Former Member
0 Likes
869

if u have given SELECT-OPTIONS: A for MARA-MATNR..

then in select query u can write the code as following.

code no _ 1.

select * from mara

into table IT_MARA

where

matnr IN A.

Code No 2.

select * from mara

into table IT_MARA

where

matnr >= A-LOW or

matnr <= A-HIGH.

but i think the Code No 1 is the best option and used by the all ABAPers....

<b><REMOVED BY MODERATOR></b>

Message was edited by:

Alvaro Tejada Galindo

Read only

Former Member
0 Likes
869

Hi,

Here i am sending sample code for selecting the data by enetring selection screen values

SELECT-OPTIONS : S_MATNR FOR MARA-MATNR.

select matnr from mara into table itab where matnr = s_matnr.

<b><REMOVED BY MODERATOR></b>

praveen

Message was edited by:

Alvaro Tejada Galindo

Read only

Former Member
0 Likes
869

hi,

select options internally creates a internal table for u with four field

1. low

2. high

3. sign

4. option.

for ex:

select-options: s_vbeln like vbap-vbeln.

in select statement u can give as

select * from vbap into table itab where vbeln in s_vbeln.

means that all the values u gave in select options are considered here.

the screen which u get for select options will have again four options as

include -


single value or range of values

exclude -


single value or range of values.

<b><REMOVED BY MODERATOR></b>

with regards,

Suresh Aluri.

Message was edited by:

Alvaro Tejada Galindo

Read only

Former Member
0 Likes
870

Hello Lokesh,

validate the field that u are selecting from the selection statements like this in where clause...

.....

WHERE MATNR <b>IN</b> S_MATNR.

Now select statement will fetch the records for only the values given in LOW and HIGH of S_MATNR.

<b><REMOVED BY MODERATOR></b>

Regards

--

Sasidhar Reddy Matli.

Message was edited by:

Alvaro Tejada Galindo

Read only

varma_narayana
Active Contributor
0 Likes
869

Hi Lokesh..

This is the Sample code.

TABLES : EKKO.

SELECT-OPTIONS: S_EBELN FOR EKKO-EBELN.

START-OF-SELECTION.

SELECT * FROM EKKO INTO TABLE IT_EKKO

WHERE EBELN IN S_EBELN.

there is no need to Fill the LOW and HIGH explicitly. The user input is automatically store in SELECT-OPTION field.

<b><REMOVED BY MODERATOR></b>

Message was edited by:

Alvaro Tejada Galindo

Read only

Former Member
0 Likes
869

Hi Lokesh,

If you have s_matnr as your select options, all values entered on the selection screen will be considered.

Select * into itab from mara

where matnr in s_matnr.

As you may know, s_matnr is a table. As described by other replies, all your inputs will be in this table.

If you enter one value say '100' on your screen, your table has one entry

s_matnr-low = '100'

s_matnr-high= initial

s_matnr-sign= 'I'

s_matnr-option='EQ'

Best thing to do is run your program or any SAP program with input, and enter values in the From and To and also ranges if there is one. Enter a bunch of values and then debug and examine the s_matnr table and see how the program has populated the table. Note the -sign and -option values. Best way to learn this.

Hope this helps.

Filler