04-29-2009 5:12 AM
Dear All,
I have one Performance issue , my problem is the query given below
Takes much more time than Expected were i retreive data from resb table only by passing EBELN and WERKS .I am using key fields also still my performance is not increased so tell me how to increase performance .
SELECT rsnum
rspos
rsart
werks
baugr
ebeln
matnr
bdmng
enmng
lifnr
ebelp
ebele
INTO CORRESPONDING FIELDS OF TABLE it_disp
FROM resb
WHERE rsnum NE 0
AND rspos NE ''
AND rsart = rsart
AND werks = p_werks
AND ebeln = p_ebeln .
Thanks And Regards .
Deepak Dhamat .
04-29-2009 5:29 AM
04-29-2009 5:53 AM
Hi Rimpa ,
Thanks For Reply .
If we will not use into corresponding fields of table then what to use as using select ENDselect is not good option or neither into table as situation is same still
and my final table fields are more and data in resb table is huge .
Thanks And Regards
Deepak
04-29-2009 5:56 AM
Declare the structure of the internal table with the same fields as that we select from resb table and avoid "Corresponding fields".
Also mention the key fields and required conditions in where clause of select query.
04-29-2009 5:59 AM
Try getting plant and ebeln(if its a Purchase order no. field) from EKPO into an internal table say it_ekpo.
Delete adjacent duplicates from it_ekpo.
Now use FOR ALL ENTRIES on ur IT_EKPO to fetch data from RESB table. It will increase the code lines but i think performance will b better. U can give it a try.
04-29-2009 6:06 AM
04-29-2009 6:06 AM
Hi,
Try like this, this improves ur select queary performace,
select rsnum rspos rsart matnr werks bdmng enmng baugr ebeln ebelp ebele lifnr
from resb into TABLE it_disp
WHERE rsnum NE 0
AND rspos NE ''
AND rsart = rsart
AND werks = p_werks
AND ebeln = p_ebeln .
Also create strcuture for this & field sequence shd be same as of select query.
for example,
begin of ty_disp,
rsnum type rsnum,
rspos type rspos,
rsart.....
end of ty_disp.
it_disp type table of ty_disp.
Thanks & Reagrds,
Anagha Deshmukh
04-29-2009 6:29 AM
Hi Anagha ,
I have created structure of fields which i am selecting in query i. e w_disp1 and created internal table it_dispt .
And The rest is below .
code is working fine but need to test on production server will test and Reply .
SELECT rsnum
rspos
rsart
werks
baugr
ebeln
matnr
bdmng
enmng
lifnr
ebelp
ebele
INTO TABLE it_dispt
FROM resb
WHERE rsnum NE 0
AND rspos NE ''
AND rsart = rsart
AND werks = p_werks
AND ebeln = p_ebeln .
LOOP AT it_dispt .
MOVE : it_dispt-rsnum TO it_disp-rsnum ,
it_dispt-rspos TO it_disp-rspos ,
it_dispt-rsart TO it_disp-rsart ,
it_dispt-werks TO it_disp-werks ,
it_dispt-baugr TO it_disp-baugr ,
it_dispt-ebeln TO it_disp-ebeln ,
it_dispt-matnr TO it_disp-matnr ,
it_dispt-bdmng TO it_disp-bdmng ,
it_dispt-enmng TO it_disp-enmng ,
it_dispt-lifnr TO it_disp-lifnr ,
it_dispt-ebelp TO it_disp-ebelp ,
it_dispt-ebele TO it_disp-ebele .
APPEND it_disp.
CLEAR it_dispt.
Thanks For Your Suggestion
ANd Also for others who have replied .
Deepak Dhamat .
04-29-2009 6:52 AM
04-29-2009 7:06 AM
Hi,
In where clause Don't use NE...
its better to get all records and delete the records which are not requried..
select *
from KNA!
into ITAB
where LAND1 NE 'IN'.. " This is not correct
select *
from KNA!
into ITAB.
delete ITAB where LAND1 EQ 'IN' " This is correct
Kiran