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: 

Performance issue

Former Member
0 Kudos

Hi Friends,

I am facing performance issue in this select statement.

Can you suggest me alternate code to increase the performance of the below statement.

*SELECT bukrs belnr gjahr projk buzei*

*bschl shkzg mwskz dmbtr*

*mwsts lifnr menge*

*FROM bseg*

*INTO TABLE i_bseg_a*

*WHERE belnr LIKE '24%'*

*OR belnr LIKE '004%'*

*AND bukrs EQ x_bukrs-bukrs*

*AND gjahr EQ w_yr_low.*

Regards

Mahesh KUmar

6 REPLIES 6

0 Kudos

Instead of like statement try to use >= = '24000000' <= '239999999' etc..

Former Member
0 Kudos

Hi,

Also in addition to the above suggestion, the order in which you have specified the fields in the where clause is wrong.

Give BUKRS, BELNR and then GJAHR. Also add some more criteria's from the BKPF table like document creation date, posting date etc. Otherwise you will end up selecting all the documents present in the BSEG table startiing with 24.

regards,

Advait

0 Kudos

The order of the WHERE makes no difference.

But in this case, missing parenthesis is the problem. You are picking up all documents that start with '24'.

Rob

Edited by: Rob Burbank on Dec 12, 2008 9:13 AM

Former Member
0 Kudos

Hi,

Give this a try:


DATA: r_belnr  TYPE TABLE OF selopt.

FIELD-SYMBOLS: <fs_belnr> TYPE selopt.

APPEND INITIAL LINE TO r_belnr ASSIGNING <fs_belnr>.
<fs_belnr>-sign = 'I'.
<fs_belnr>-option = 'CP'.
<fs_belnr>-low    = '24*'.

APPEND INITIAL LINE TO r_belnr ASSIGNING <fs_belnr>.
<fs_belnr>-sign = 'I'.
<fs_belnr>-option = 'CP'.
<fs_belnr>-low    = '004*'.

SELECT bukrs belnr gjahr buzei projk buzei
       bschl shkzg mwskz dmbtr 
       mwsts lifnr menge
  FROM bseg
  INTO TABLE i_bseg_a
 WHERE bukrs = x_bukrs-bukrs 
   AND belnr IN r_belnr
   AND gjahr = w_yr_low.
IF sy-subrc <> 0.
  "Error handling
ENDIF.

Regards,

Jamie

Edited by: James Gaddis on Dec 11, 2008 3:33 PM

Former Member
0 Kudos

Hi,

make ranges fro beln...

Use always, key fields,

Thanks,

Krishna..

dev_parbutteea
Active Contributor
0 Kudos

Hi,

the fields you are retrieving exists also in tables : BSIS, BSID, BSIK.

please try to use other table like BSIS instead of BSEG which is a cluster table.

This will improve performance.

Thanks and regards,

Dev.