Skip to Content
0
Former Member
Dec 27, 2007 at 12:58 PM

Query Tuning

16 Views

Hi,

We have implemeneted a user exit to ensure that duplicate PO's are not created. This duplicate check is based on company code, vendor and purchase organisation fields in EKKO and workorder no (EAN/UPC No), material no, plant and deletion indicator.

For this we have wrritten a query on EKKO

Select EBELN from ekko into i_ekko where lifnr = ls_lifnr

and bukrs = ls_bukrs

and ekorg = ls_ekorg

Now this query is taking very long to execute (in user exit and have tried SE11 also. ST05 explain plan gives a cost of 93) and is giving a time out dump. Also we have 9 indexes already on EKKO and 8 indexes on EKPO and none of them on the above mentioned fields. EKKO table has currently 3.4 million entries and EKPO has aoriund 12 million entries.

Would like to know how do I frame the logic so that the query does not take such a long time.

Thanks and Regards,

Peter