‎2007 May 10 3:15 AM
Hi Guys,
Need some suggestions to improve performance of following select query.
data:i_items LIKE yweb_po_view OCCURS 0 WITH HEADER LINE,
SELECT * FROM yweb_po_view INTO TABLE i_items
WHERE eindt BETWEEN vdatu_from and vdatu_to
and bukrs = company_code
and LOEKZ_EKPO = ''
AND pstyp IN r_pstyp
AND emlif = i_vendor-lifnr
AND lblkz = 'X'
AND elikz <> 'X'.
yweb_po_view is view with combination of four standard tables.
EKKO
EKPO
EKET
MARA
Thanks in Advance,
Harkamal
‎2007 May 10 3:18 AM
Try to write down internal table without header...
types : begin of ty_data ,
fld1,
fld2,
end of ty_data.
data i_data type standard table of ty_data.
data wa_data like line of i_data.
use where conditions properly,and select only few fiedls if possible.
Rewards points if it is helpful
Thanks
Seshu
‎2007 May 10 3:18 AM
Try to write down internal table without header...
types : begin of ty_data ,
fld1,
fld2,
end of ty_data.
data i_data type standard table of ty_data.
data wa_data like line of i_data.
use where conditions properly,and select only few fiedls if possible.
Rewards points if it is helpful
Thanks
Seshu
‎2007 May 10 3:25 AM
Do not use 'SELECT *' instead of that use SELECT the required fields from i_items.
Secondly please check the View. I am sure there must be some thing wrong out there when you want to make the view with four tables. Please look there once again.
Regards,
Subhasish
‎2007 May 10 4:11 AM
Hi harkamal,
Please avoid VIEW and put the data into the separate internal tables and then loop at EKKO and Read rest table
Select * into <IT_EKKO>
from EKKO
where <condition>Select rest other tables with condition.
Now Sort ALL Internal Table.
LOOP AT IT_EKKO.
READ TABLE IT_EKPO WITH KEY EBELN = IT_EKKO-EBELN BINARY SEARCH.
IF SY-SUBRC = 0.
<INSERT INTO FINAL INTERNAL TABLE.
ENDIF.
----- Put Read command to other internal table and put it into the final table <i_itmes>
APPEND I_ITEMS.
ENDLOOP.This would diffinately increase the perfomance.....