Application Development and Automation 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: 
Read only

ranges

Former Member
0 Likes
647

Hi,

am using ranges in below select..

is there any performance issue..can u suggest a beeter way other than ranges..

SELECT bukrs belnr budat blart awkey

INTO TABLE ibkpf

FROM bkpf

WHERE bukrs = p_bukrs

AND gjahr = gjahr

AND monat IN s_monat

AND blart IN r_blart

AND budat IN s_date.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
627

hi,

no there is no performance issue at all.

you are doing it rightly.

only remember place the fields in select query as they are in database table i.i first primary keys and then other if they are on selection screen.

4 REPLIES 4
Read only

Former Member
0 Likes
628

hi,

no there is no performance issue at all.

you are doing it rightly.

only remember place the fields in select query as they are in database table i.i first primary keys and then other if they are on selection screen.

Read only

0 Likes
627

Hi Tuborg,

Nice, But it is always better to warn / Inform the user when Empty date ranges are used Particularly with Date on Tables like BKPF, MKPF, CDHDR, .... tables. Better to Schedule the Program in Backgroud.

Volume of Data will be very large..

your program need not fail because of time out error.

Regards,

Sureshkumar.AL

Read only

Former Member
0 Likes
627

Hi,

No performance issues, however to avaoid empty date fields assed to the select query, make them atory in the selection screen.

Otherwise if date is not given it will fetch large number of data

Read only

Former Member
0 Likes
627

Yes there is. Your SELECT will try to use either index 2 or 3 depending on your database statistics, but won't be able to do it effectively because you are not using BSTAT in the WHERE clause. It may seem counter-intuitive, but simply adding all values of that field to the WHERE may speed it up considerably:

SELECT bukrs belnr budat blart awkey
  INTO TABLE ibkpf
  FROM bkpf
  WHERE bukrs = p_bukrs
    AND gjahr = gjahr
    AND bstat IN (' ', 'A', 'B', 'D', 'M', 'S', 'V', 'W', 'Z')    "<=======
    AND monat IN s_monat
    AND blart IN r_blart
    AND budat IN s_date.

As the others have suggested, make sure that either r_blart or s_date is not empty and does not contain any 'NE'

Rob