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

Performance

Former Member
0 Likes
1,056

Hi experts

I am supposed to use the following query, but it affects the performance badly, whats the way to solve this problem, pls help me on the same.

Thanks in advance

Regards

Rajaram

SELECT * FROM bseg

WHERE belnr = p_vblnr

AND gjahr = p_gjahr

AND koart = 'K'

AND bukrs = p_bukrs

AND bschl = '25'.

AND bschl IN ('25','38')

AND augbl NE p_vblnr.

SELECT * FROM bseg "24.09

WHERE belnr = p_vblnr

AND gjahr = p_gjahr

AND koart = 'K'

AND bukrs = p_bukrs

AND bschl = '29'.

10 REPLIES 10
Read only

Former Member
0 Likes
1,024

avoid nested selects use selecrt for all entries.....

Read only

Former Member
0 Likes
1,024

Declare an internal tabel with the fields u actually and add " into table it_table" in your query instead of loading the table with buffered data. this will reduce the load

Read only

Former Member
0 Likes
1,024

BUKRS

BELNR

GJAHR

BUZEI

BUZID

AUGDT


SELECT * FROM bseg 
WHERE bukrs = p_bukrs 
and belnr = p_vblnr 
AND gjahr = p_gjahr 
AND augbl NE p_vblnr
AND bschl IN ('25','38') 
AND koart = 'K' . 

SELECT * FROM bseg "24.09 
WHERE AND bukrs = p_bukrs 
and belnr = p_vblnr 
AND gjahr = p_gjahr 
AND bschl = '29'
AND koart = 'K' . 

Read only

0 Likes
1,024

still the performance not improved, how can we solve this yar.

Regards

Rajaram

Read only

Former Member
0 Likes
1,024

Hi Raja,

1. specify the field names instead of *

2. remove NE comparision in where clause, to avoid those entries do as below

SELECT <f1> <f2> ... FROM bseg into table itab

WHERE belnr = p_vblnr

AND gjahr = p_gjahr

AND koart = 'K'

AND bukrs = p_bukrs

AND bschl = '25'.

AND bschl IN ('25','38').

delete itab where augbl eq p_vblnr.

3. Use secondary indexes.

4. Maintain the fields in the where clause same as the order in database table.

<b>Reward for helpful answers</b>

Satish

Read only

Former Member
0 Likes
1,024

Hi,

I would recommend only a single query & later on filter data .


SELECT * FROM bseg 
WHERE bukrs = p_bukrs 
and belnr = p_vblnr 
AND gjahr = p_gjahr 
AND bschl IN ('25', '29' , '38') 
AND koart = 'K' . 


Read only

0 Likes
1,024

no yar these two queries needs to be done two different conditions, so i can't do as you given.

Read only

0 Likes
1,024

Hi Raja,

Have you amended the chages as i suggested?

Satish

Read only

JozsefSzikszai
Active Contributor
0 Likes
1,024

form the <i>bschl</i> I see that yoe need vendor items. In this case select from BSIK and BSAK and not from BSEG.

Read only

0 Likes
1,024

nebtr is not in the bsik or bsak tables.

Regards

Rajaram