03-23-2009 10:52 AM
Hi,
I got a problem in performance tuning using below tables?
how to write SELECT statement using tables EKKO,EKPO and EKET and in conditon ( WHERE clause) use only fields
ekko~ebeln IN ebeln
ekko~loekz EQ ' '
ekko~lifnr IN lifnr
ekko~ekorg IN ekorg
ekko~ekgrp IN ekgrp
ekpo~werks IN werks
ekpo~pstyp EQ '3'
ekpo~loekz EQ space
ekpo~elikz EQ space
ekpo~menge NE 0
eket~rsnum NE space.
Thanks in Advance.
bye.
03-23-2009 10:56 AM
Use the JOIN addition of the SELECT statement. Study the primary keys of these tables and you will find a way to link them. There is plenty of examples in these forums.
Thomas
03-23-2009 10:58 AM
Hi,
ekko~ebeln IN ebeln
ekko~loekz EQ ' '
ekko~lifnr IN lifnr
ekko~ekorg IN ekorg
ekko~ekgrp IN ekgrp
ekpo~werks IN werks
ekpo~pstyp EQ '3'
ekpo~loekz EQ space
ekpo~elikz EQ space
ekpo~menge NE 0 " Remove this from where clause
eket~rsnum NE space. " Remove this from where clause
' instead delete the entries after fetching into the table
DELETE it_itab WHERE menge EQ '0' AND rsnum EQ ' '.
Regards
Bala Krishna
03-23-2009 10:59 AM
SELECT *
from ekko as a inner join ekpo as b
on aEBELN = b EBELN
into corresponding fields of table g_t_ekko
where
ekko~ebeln IN ebeln
ekko~loekz EQ ' '
ekko~lifnr IN lifnr
ekko~ekorg IN ekorg
ekko~ekgrp IN ekgrp
ekpo~werks IN werks
ekpo~pstyp EQ '3'
ekpo~loekz EQ space
ekpo~elikz EQ space
ekpo~menge NE 0.
if sy-subrc eq 0.
select *
from eket
into coresponding fields of table g_t_eket
for all entries in itab1
where ebeln = g_t_ekko-ebeln and
eket~rsnum NE space.
endif.
03-23-2009 11:03 AM
Hi
Instead of joins, try by using nested select statements.
select....in itab1.
if not itab1[] is initial.
select in itab2.
if not itab2[] is initial.
............
endif.
endif.
Regards.
03-23-2009 11:07 AM
Hi,
use this function module u r performance will be solved.
Don't us e select if u have standard FM's.USing standard FM's will give better performance to u r progem..
Try this.
ME_PURCHASE_DOCUMENT_DATA_READ
Thanks
03-23-2009 11:37 AM
Fetch the records form two tables with inner join and take this records into internal table.
Now delete all those records where the particular field is initia.
Now fetch the records from eket by using,' for all entries' statement or process the records of internal table by using select upto 1 row from eket statement (if you are doing some other processing on the records).