09-01-2006 6:52 AM
Hi,
I am writing a select query to fetch EBELN and EBELP from EKET table using the delivery date EINDT which is one of the secondary indexes for the table, just this one field. But then it takes too much of a time to fetch the information using this select query. While if I give the same information in the SE16 screen it seems to run faster!! Can anyone explain how can something like this happen??
Also the EBELN and EBELP from the EKET table has been passed to EKPO table to verify for the plant as in selection screen, which again takes a very long time inspite of passing both the key fields. Where as I tried only passing EBELN from EKET to EKPO which works much faster...how can this be possible? I am stuck with this tricky problem.
Can anyone please help me with this. Thanks in advance.
Regards,
Soms
09-01-2006 7:10 AM
Hi sowmya,
1. Ideally it should not happen.
2. One thing to try is to delete the index,
and create it again.
regards,
amit m.
09-01-2006 7:20 AM
sowmya,
Generically in SAP, secondary index(es) perform good if they have first field being MANDT.
SE16 does use the MANDT value while filtering the data.
If your index is a "Z" index, do modify it and try.
09-01-2006 7:32 AM
This is a standard index and has mandt along with EINDT as the index field. My concern is that the performance of my select query is bad when compared to the SE16 fetch using the same index!! Please help me out of this.
Thanks,
Sowmya
09-01-2006 7:43 AM
Then I feel something wrong the way date is passed in your program VS in SE16. Pl. send your code block.
09-01-2006 8:07 AM
Hi again,
1. is bad when compared to the SE16
In se16, it fetches only a fixed number of records,
(depending uponmaximum no of hits)
2. So it must be fast when we see it.
(try to give max no of hits,
and it will also get slow)
3. Our query will fetch ALL records,
and hence may take time.
regards,
amit m.
09-01-2006 7:57 AM
Hi Sarah,
Please find the code as written in the program.
SELECT ebeln
ebelp FROM eket
INTO TABLE t_eket
WHERE eindt >= v_eindt.
SORT t_ekpo.
DELETE ADJACENT DUPLICATES FROM t_eket COMPARING ebeln ebelp.
IF t_eket[] IS NOT INITIAL.
SELECT ebeln
ebelp FROM ekpo
INTO TABLE t_purch_docs
FOR ALL ENTRIES IN t_eket
WHERE ebeln = t_eket-ebeln
and ebelp = t_eket-ebelp
AND werks IN s_werks.
ENDIF.
Please let me know if there is anything I can do with this code.
Thanks,
Sowmya
09-01-2006 11:59 AM
Sowmya,
1. ensure data v_eindt is LIKE eindt or char(8).
2. eindt >= v_eindt is bad .. instead use this:
v_eindt_1 = v_eindt - 1.
..
WHERE eindt > v_eindt_1
...
3. FOR ALL ENTRIES IN t_eket will be bad if lines in t_eket are high (say over 10,000) in that case prefer loop-endloop.