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

Report

Former Member
0 Likes
916

Hi,

I have developed a new report.When I check the code inspector it is showing 15 errors all for the same select statement.The error is 'No first field from table index in WHERE condition'

Why do we get this error.What can be done to remove this error.

7 REPLIES 7
Read only

Former Member
0 Likes
867

Hi

it would be good if u can put the select statmt that is giving the error...

Read only

0 Likes
867

Hi,

I am giving the select statement i used in the program.

SELECT ryear runit poper

rbukrs activ refdocnr refdocln

werks matnr lifnr bwart

INTO TABLE gt_glpca

FROM glpca

WHERE rbukrs = p_rbukrs

AND werks IN s_werks

AND lifnr IN s_lifnr

AND poper IN s_poper

AND ryear IN s_ryear

AND activ = c_rmwa

AND bwart = c_411.

In glpca table,key field is gl_sirid.but this is not having any value.So I can't use this in the where condition.Can u suggest some solution for this?

Read only

Former Member
0 Likes
867

This is because you have not used any key fields( primary or secondary indexes) in your WHERE condition of that SELECT statement.

If it is functionally viable to add any of the key fields, then you might not face this error.

regards,

madhu

Read only

Former Member
0 Likes
867

Hema,

Code Inspector
Analysis of the WHERE condition for SELECT

Table xyz: In the WHERE condition, there is no first field of a table index.

The current SELECT statement can probably not be processed using an index because the WHERE condition does not contain any first field of a table index (or index fields only with the addition NOT or the relational operators NE or '<>').

The whole database table therefore needs to be searched through, which can lead to long response times.
Check whether the WHERE condition can be reformulated to match a table index.
Check whether an additional table index can be created.

TIP: You can do this

The priority of the message depends on the size category of the table:
Size category       0, 1   => Warning
Size category       >= 2   => Error

The message can be suppressed using the pseudo comment "#EC CI_NOFIRST

Read only

Former Member
0 Likes
867

hi Hema,

When u are selecting from table check for the key for that <b> table </b>

in where condition more number of primary keys must be used to efficient data fetching,

in your case you might be <b> not using the primary key or index field of the that table </b>

amit

Read only

Former Member
0 Likes
867

The fields u have used in Where conditions are not primary keys..

thats y its giving such a error

Read only

Former Member
0 Likes
867

Check with SE16, the number of entries in the GLPCA in your system.

If large then you have a problem.

There is a number of indexes on this table. And you need index support for fast procesing.

An index can only be used if you use the fields from the beginning.

The code inspector check only simple things whether there is at least a first field of an index.

In fact you need selective fields.

Siegfried