‎2007 Apr 13 7:55 PM
hello experts,
here is the select statemenet can anyone modify this select statement in such a way that performance should be good....
SELECT-OPTIONS: s_ekgrp FOR ekko-ekgrp.
SELECT-OPTIONS: s_matkl FOR ekpo-matkl.
SELECT aebeln alifnr a~ernam
bebelp bmatnr btxz01 bwerks bmenge bmeins b~ktpnr
b~konnr
c~eindt
dnetpr dinfnr d~netpr
e~name1 into table T_EKKO from ekko as a
inner join eket as b on aebeln = bebeln
inner join eket as c on bebeln = cebeln and bebelp = cebelp
inner join eine as d on aekorg = dekorg
inner join lfa1 as e on alifnr = elifnr
where aekgrp in s_ekgrp and bmatkl in s_maktl.
so here my question is in the selection screen i am having only two field those r not key fileds in the corresponding tables where as in indexes those two are included as in ekko as ekko 1 as ekorg, and ekpo as ekpo 1 as matkl
how to include these indexes into the above select statement... plz its bit urgent...
‎2007 Apr 13 7:58 PM
‎2007 Apr 13 8:07 PM
Hi,
You can use the following statement in your select statement:
%_HINTS ORACLE 'INDEX("SPFLI" "SPFLI~001")'.
Example:
SELECT carrid connid cityfrom
FROM spfli INTO (xcarrid, xconnid, xcityfrom)
WHERE carrid = 'LH ' AND cityfrom = 'FRANKFURT'
%_HINTS ORACLE 'INDEX("SPFLI" "SPFLI~001")'.
Thanks,
Srinivasa
Message was edited by:
Srinivasa
‎2007 Apr 13 8:15 PM
I didn't understand srinivas
then how to optimise the performance of above select statement is there any other way
one more thing also there like...i have filter the po number by putting the below condition in the above select statement
if <b>ekpo~elikz = ' '</b> , that means when i put this condition then the po r open.. how to add this condition to the above select statement...
plz someone help me its bit urgent....
siri
‎2007 Apr 13 8:17 PM
So adding the additional filter to the WHERE clause would be like so.
SELECT a~ebeln a~lifnr a~ernam
b~ebelp b~matnr b~txz01 b~werks b~menge b~meins b~ktpnr
b~konnr
c~eindt
d~netpr d~infnr
e~name1
INTO TABLE t_ekko FROM ekko AS a
INNER JOIN ekpo AS b
ON a~ebeln = b~ebeln
INNER JOIN eket AS c
ON b~ebeln = c~ebeln
AND b~ebelp = c~ebelp
INNER JOIN eine AS d
ON b~INFNR = d~INFNR
INNER JOIN lfa1 AS e
ON a~lifnr = e~lifnr
WHERE a~ekgrp IN s_ekgrp
AND b~matkl IN s_matkl
and b~elikz = space. "<- Right HEre
Regards,
Rich Heilman
Message was edited by:
Rich Heilman
‎2007 Apr 13 9:26 PM
Rich
this select statement is taking much longer time in the production system
can you tell me any alternative way to do this
‎2007 Apr 13 9:36 PM
‎2007 Apr 13 9:50 PM
I checked in the production system rich... It is having lot of records...so it is taking so much of time may be
is there any alternate option to change this select statement so that i can optimise the performance in production system also
‎2007 Apr 13 10:07 PM
Hi,
Please check using secondary indexes and include the following statement
%_HINTS ORACLE 'INDEX("SPFLI" "SPFLI~001")' in your select query and try.
Thanks,
Srinivasa
‎2007 Apr 13 10:21 PM
srinivasa
in indexes 1 those fiels r not in the first position
those r in the 4th position in the both the tables so even though i add it, its not useful i think rite
‎2007 Apr 13 8:15 PM
Also, there seems to be mistakes in your SELECT, notice you are joining EKET twice, this is not right, and the join to EINE is not right either.
Here is some modified code.
REPORT zrich_0001.
TABLES: ekko, ekpo.
data: begin of t_ekko occurs 0,
ebeln type ekko-ebeln,
lifnr type ekko-lifnr,
ernam type ekko-ernam,
ebelp type ekpo-ebelp,
matnr type ekpo-matnr,
txz01 type ekpo-txz01,
werks type ekpo-werks,
menge type ekpo-menge,
meins type ekpo-meins,
ktpnr type ekpo-ktpnr,
konnr type ekpo-konnr,
eindt type eket-eindt,
netpr type eine-netpr,
infnr type eine-infnr,
name1 type lfa1-name1,
end of t_ekko.
SELECT-OPTIONS: s_ekgrp FOR ekko-ekgrp.
SELECT-OPTIONS: s_matkl FOR ekpo-matkl.
SELECT a~ebeln a~lifnr a~ernam
b~ebelp b~matnr b~txz01 b~werks b~menge b~meins b~ktpnr
b~konnr
c~eindt
d~netpr d~infnr
e~name1
INTO TABLE t_ekko FROM ekko AS a
INNER JOIN ekpo AS b
ON a~ebeln = b~ebeln
INNER JOIN eket AS c
ON b~ebeln = c~ebeln
AND b~ebelp = c~ebelp
INNER JOIN eine AS d
ON b~INFNR = d~INFNR
INNER JOIN lfa1 AS e
ON a~lifnr = e~lifnr
WHERE a~ekgrp IN s_ekgrp
AND b~matkl IN s_matkl.
check sy-subrc = 0.
This coding runs pretty fast in my system.
Regards,
Rich Heilman