Skip to Content
0
Former Member
Nov 08, 2007 at 02:22 PM

Adequate index for select

16 Views

Hello,

I have this code :

...........................................

SELECT emkey FROM okk00

INTO TABLE gt_ods_okk

WHERE eloekz = 'X'.

IF sy-subrc EQ 0.

  • loop on the resulting internal table

LOOP AT gt_ods_okk ASSIGNING <wa_ods_okk>.

  • OKP processing

CLEAR gt_ods_okp[] .

  • for each order -> select not deleted positions (REASON_REJ EQ '' )

SELECT * FROM okp00

INTO TABLE gt_ods_okp

WHERE emkey = <wa_ods_okk>-emkey

AND reason_rej = ' '.

...................................................................................................

The problem is that if I select records from a table and have in the where clause a field which is not part of the index of the table (eloekz in my case ) , I will read all the records of the table (sequential access). So I have to be sure that there is an adequate index for my select.

I have to leave the where condition, because I need the records with eloekz = 'X'.

How can I do this ?

Suggestion ? (I can't use cursor..so other option, please ).

Many thanks.