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-options

Former Member
0 Likes
2,026

for select-options whether we have to give table names in TABLES statement.

if i dont give table names it is showing error

7 REPLIES 7
Read only

Former Member
0 Likes
1,242

Hi,

For some fields you need to declare tables.

Example

tables: t247.

select-options: s_month for t247-mnr.

Edited by: Velangini Showry Maria Kumar Bandanadham on Apr 23, 2008 11:18 AM

Read only

Former Member
0 Likes
1,242

The FOR statement requires a reference. You will need to specify a table.

Or you could do something like.

DATA: w_matnr type matnr.

select-options s_matnr for w_matnr.

Read only

Former Member
0 Likes
1,242

You use the statement SELECT-OPTIONS <seltab> for <f> to declare a selection table in the program that is linked to the <f> column of a database table, or to an internal <f> field in the program*. A selection table is an internal table object of the standard table type that has a standard key and a header line. Selection tables are used to store complex selections using a standardized procedure. They can be used in several ways. Their main purpose is to directly translate the selection criteria into database selections using the WHERE addition in Open SQL statements.

The basic form of the SELECT-OPTIONS statement is as follows:

SELECT-OPTIONS <seltab> FOR <f>.

It declares a selection criterion <seltab> that is linked to a field <f> that has already been declared locally in the program. The names of selection criteria are currently restricted to eight characters. Valid data types of <f> include all elementary ABAP types except data type F. You cannot use data type F, references and aggregate types. If you want to use the selection criterion to restrict database selections, it is a good idea to declare <f> with reference to a column of the corresponding database table. It then inherits all of the attributes of the data type already defined in the ABAP Dictionary. In particular, the field help (F1) and the possible entries help (F4) defined for these fields in the Dictionary are available to the user on the selection screen.

For more details have a look at below link.

[Selection Criteria|http://help.sap.com/saphelp_nw04/helpdata/en/9f/dba74635c111d1829f0000e829fbfe/frameset.htm]

I hope it helps.

Thanks,

Vibha

Please mark all the useful answers

Read only

Former Member
0 Likes
1,242

hi,

for select-options must give tables statement, other wise it showing error.

if u use tables it creats default work area so it is performance issue.

so, u do like this

declare a variable of that data type, and use in that select-option declaration.

ex

data v_matnr type matnr.

select-option material for v_matnr.

reward if useful.

regards,

chandu.

Read only

Former Member
0 Likes
1,242

tables: ekko.

select-options:

s_ebeln for ekko-ebeln.

or

data:ebeln like ekko-ebeln.

select-options:

s_ebeln for ebeln.

Read only

Former Member
0 Likes
1,242

it should have either

tables:mara.

select-options:matnr for mara-matnr.

or

DATA spfli_wa TYPE spfli.

SELECT-OPTIONS s_carrid FOR spfli_wa-carrid.

SELECT *

FROM spfli

INTO spfli_wa

WHERE carrid IN s_carrid.

ENDSELECT.

reward if useful

Read only

Former Member
0 Likes
1,242

Hi,

If you are using a field name in select-options,then it has no independent existance hence we need to declare it with respect to a table( hence we do tablename-field and so we declare with keyword "tables"..)

If you are using a domain,data element of the field then you will not require the declaration "tables"

Regards

Byju