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 issue ?

0 Likes
993

I have a question sequence of field in select statement is impact with performance or not ? Please see the two select statement as below.

DATA: l_bukrs TYPE bkpf-bukrs,

l_belnr TYPE bkpf-belnr,

l_gjahr TYPE bkpf-gjahr,

l_blart TYPE bkpf-blart.

PARAMETERS: p_bukrs TYPE bkpf-bukrs,

p_belnr TYPE bkpf-belnr,

p_gjahr TYPE bkpf-gjahr.

SELECT bukrs belnr gjahr blart

INTO (l_bukrs,l_belnr,l_gjahr,l_blart)

FROM bkpf

WHERE bukrs = p_bukrs

AND belnr = p_belnr

AND gjahr = p_gjahr.

ENDSELECT.

  • This select statement is low performance if comparing with above select statement

SELECT blart gjahr belnr bukrs

INTO (l_blart,l_gjahr,l_belnr,l_bukrs)

FROM bkpf

WHERE bukrs = p_bukrs

AND belnr = p_belnr

AND gjahr = p_gjahr.

ENDSELECT.

7 REPLIES 7
Read only

Former Member
0 Likes
959

Hi veeraphol theamthong-on,

First of all as You Would know Using SELECT and ENDSELECT is not a good practise (Its similar to We are fetching data from BKPF in a loop).

We should Fetch data from BKPF in to a Internal Table and then process with our logic.

SELECT bukrs belnr gjahr blart
INTO (l_bukrs,l_belnr,l_gjahr,l_blart)
FROM bkpf
WHERE bukrs = p_bukrs
AND belnr = p_belnr
AND gjahr = p_gjahr.
ENDSELECT.

* This select statement is low performance if comparing with above select statement
" Yes because missing in the sequence of Key Fields. 
SELECT blart gjahr belnr bukrs
INTO (l_blart,l_gjahr,l_belnr,l_bukrs)
FROM bkpf
WHERE bukrs = p_bukrs
AND belnr = p_belnr
AND gjahr = p_gjahr.
ENDSELECT.

Regards,

Suneel G

Read only

Former Member
0 Likes
959

Hi Veeraphol,

You Should use the fields of a table in the Select statement in a sequence order to have a better Performance.

Depeding upon the requirement we can use the Select & Endselect Loop...

Thanks & regards,

Dileep .C

Read only

0 Likes
959

Which T-Code for trace this performance ?

Read only

0 Likes
959

Try T-codes: ST05 (SQL Trace)

SE30

Read only

0 Likes
959

Hi,

You should not use Select and end select.. And for better performance you should select in the same sequence as in the database... To check the performance of your program goto transaction SE30->Give your program name and click on execute. Then execute your program completely once. Go back and then click on the 'Analyze' Button. You will be able to see the performance of your program.

Thanks,

Sneha.

Read only

0 Likes
959

Hi Veeraphol,

You can check the Performance trace at ST05 or in SE30 Tcodes...

Also look for the documentation in SE30 for a good performance usage Guides,,,

Thanks & regards,

Dileep .C

Read only

Former Member
0 Likes
959

You must not use the select - endselect phrase for a system performence.

If you use the phrase, the system contects DB item by item.

It means the number of the commuting between application layer and dblayer is the same as the number of selected items.

Insted of doing this, you'd like to use select phrase with where phrase.

then you can minimize the commuting number. and it makes your system performance better.

regards,

Jonghwan

Edited by: JONG HWAN PARK on Jun 10, 2009 4:55 AM