Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

how to write SELECT statement using tables ekko,ekpo and eket?

Former Member
0 Kudos

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.

6 REPLIES 6

ThomasZloch
Active Contributor
0 Kudos

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

former_member585060
Active Contributor
0 Kudos

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

Former Member
0 Kudos

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.

Former Member
0 Kudos

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.

tarangini_katta
Active Contributor
0 Kudos

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

Former Member
0 Kudos

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).