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: 

Could any body suggest hoe to tune this SELECT stmt?

Former Member
0 Kudos
100

DATA : BEGIN OF it_bkpf OCCURS 100,

bukrs LIKE bkpf-bukrs,

belnr LIKE bkpf-belnr,

gjahr LIKE bkpf-gjahr,

blart LIKE bkpf-blart,

budat LIKE bkpf-budat,

usnam LIKE bkpf-usnam,

dbblg LIKE bkpf-dbblg,

stblg LIKE bkpf-stblg,

stjah LIKE bkpf-stjah,

bktxt LIKE bkpf-bktxt,

grpid LIKE bkpf-grpid,

awkey LIKE bkpf-awkey,

tcode LIKE bkpf-tcode,

END OF it_bkpf.

SELECT bukrs belnr gjahr blart budat usnam dbblg stblg stjah

bktxt grpid awkey tcode

INTO TABLE it_bkpf

FROM bkpf

WHERE bukrs IN s_bukrs AND

budat IN postdate AND

blart IN s_blart AND

  • blart in s_blart1 and

usnam IN s_usnam

%_HINTS ORACLE 'INDEX(BKPF BKPF______Z1)'.

Could you please suggest what is wrong or how to tune this SELECT stmt?

1 ACCEPTED SOLUTION

Former Member
0 Kudos
63

Take out the hint and add all BSTAT to the WHERE.

Rob

3 REPLIES 3

Former Member
0 Kudos
64

Take out the hint and add all BSTAT to the WHERE.

Rob

0 Kudos
63

This will be much faster:


SELECT bukrs belnr gjahr blart budat usnam dbblg stblg stjah
       bktxt grpid awkey tcode
  INTO TABLE it_bkpf
  FROM bkpf
  WHERE bukrs IN s_bukrs  AND
        bstat IN (' ', 'A', 'B', 'D', 'M', 'S', 'V', 'W', 'Z') AND
        budat IN postdate AND
        blart IN s_blart  AND
        usnam IN s_usnam.

Rob

Former Member
0 Kudos
63

hi,

for increasing perfomance of the select statement , check u r using the <b>Proper Index</b> of the table( table contains primary index and secondary index).

once u also check, u provide the low and high values to <b>s_bukrs</b> , <b>s_blart</b> , <b>s_usnam</b> all these fields( if u define using select-options statement) otherwise it will check from its low value to final value.

Keep the selected data amount be small.

for furthur refarence u follow these links.

http://www.sapbrain.com/ARTICLES/TECHNICAL/optimization/optimization.html

https://www.sdn.sap.com/irj/sdn/wiki?path=/display/abap/abapPerformanceand+Tuning&

http://www.sap-img.com/abap/performance-tuning-for-data-selection-statement.htm

regards,

AshokReddy.