Skip to Content
0
Former Member
Feb 20, 2009 at 04:15 PM

Alternate Index not read with FOR ALL ENTRIES

43 Views

I have a select statement like:

SELECT d~dokar

d~doknr

d~dokvr

d~doktl

l~lifnr

l~stcd1

l~stcd2

APPENDING CORRESPONDING FIELDS OF TABLE t_dms

FROM lfa1 AS l JOIN drad AS d

ON llifnr = dobjky

FOR ALL ENTRIES IN t_infile

WHERE ( l~stcd2 = t_infile-taxcode2ssn

OR l~stcd2 = t_infile-taxcode2fed

OR l~stcd2 = t_infile-fedtaxid2 )

AND d~dokob = 'LFA1'

AND d~obzae = '0000'

AND d~doktl IN s_doktl.

I have defined an alternate index on LFA1 called ZX2 (MANDT, STCD2). T_INFILE is sorted by a field called FEDTAXID. This is a nine character field. TAXCODE2SSN is the same number but it is formatted 999-99-9999. TAXCODE2FED is the same number only formated 99-0000000. FEDTAXID2 is the same as FEDTAXID.

S_DOKTL is defined as sign = I, Option = BT, Low = 000, High = 000.

The problem is LFA1ZX2 is not being used. The file is being read sequentially. Any ideas what is causing the alternate index to be ignored? I wrote another select statement where I removed the FOR ALL ENTRIES and the "ddoktl IN s_doktl" and the alternate index is being used. Any thoughts?

Thanks,