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 ..which one is better

Former Member
0 Likes
901

SELECT * " bukrs lifnr gjahr belnr blart

FROM bsak

appending table gt_bsak

  • INTO CORRESPONDING FIELDS OF TABLE gt_bsak

WHERE cpudt in r_cpudt

AND blart in r_blart

AND bukrs in s_bukrs

AND belnr in s_belnr

AND gjahr in s_gjahr

.

In the above stmt which one gives bstter performance.Is it appending table gt_bsak or

INTO CORRESPONDING FIELDS OF TABLE gt_bsak

SELECT * " bukrs lifnr gjahr belnr blart

FROM bsak

appending table gt_bsak

  • INTO CORRESPONDING FIELDS OF TABLE gt_bsak

WHERE cpudt in r_cpudt

AND blart in r_blart

AND bukrs in s_bukrs

AND belnr in s_belnr

AND gjahr in s_gjahr

.

In the above stmt which one gives bstter performance.Is it appending table gt_bsak or

INTO CORRESPONDING FIELDS OF TABLE gt_bsak

7 REPLIES 7
Read only

Former Member
0 Likes
869

Hi Sam,

Use only INTO TABLE.

SELECT * " bukrs lifnr gjahr belnr blart
FROM bsak
<b>INTO TABLE gt_bsak</b>
WHERE cpudt in r_cpudt
AND blart in r_blart
AND bukrs in s_bukrs
AND belnr in s_belnr
AND gjahr in s_gjahr

INTO TABLE is faster then using appending and into corresponding fields.

Cheers

VJ

Read only

Former Member
0 Likes
869

Hi Sam,

If you are using :

select *

then use into corresponding field of table but

if you are using :

select fld1 fld2 fld3

then appending table would be better provided your internal table has 3 fields (fld1,fld2,fld3) only.

Cheers,

Vikram

Pls reward for helpful replies!!

Read only

Former Member
0 Likes
869

It doesn't matter, because performance will be degraded because of the WHERE clause. See my answer to your other question. You have to take care of the big problems first. You'll find that the small ones may not matter.

Rob

Read only

0 Likes
869

The most important problem here is that the select statement doesn't use an index. All of the other suggestions will help, but you still need to go to BSEG (and BKPF for BLART) to significantly improve performance.

Rob

Read only

anversha_s
Active Contributor
0 Likes
869

hi sam,

I simulated ur code in my system.

the best performance is this.

data : begin of gt_bsak occurs 0,

bukrs like bsak-bukrs,

lifnr like bsak-lifnr,

belnr like bsak-belnr,

blart like bsak-blart,

end of gt_bsak.

SELECT bukrs lifnr gjahr belnr blart

FROM bsak

INTO table gt_bsak

WHERE cpudt in r_cpudt

AND blart in r_blart

AND bukrs in s_bukrs

AND belnr in s_belnr

AND gjahr in s_gjahr.

here the prfmance is optimum.

rgds

anver.

if hlped rwrd points

Read only

Former Member
0 Likes
869

hi Sam,

SELECT<b> bukrs lifnr gjahr belnr blart</b>FROM bsak

<b>INTO TABLE gt_bsak</b>

WHERE cpudt in r_cpudt

AND blart in r_blart

AND bukrs in s_bukrs

AND belnr in s_belnr

AND gjahr in s_gjahr.

avoid using * select only the fields that you require ... in this way you can improve the performance a bit ..

Regards,

Santosh

Read only

abdul_hakim
Active Contributor
0 Likes
869

hi,

use the below code..

data: begin of wa,

bukrs like bsak-bukrs,

lifnr like bsak-gjahr,

belnr like bsak-belnr,

blart like bsak-blart,

end of wa,

itab like table of wa.

select bukrs

lifnr

belnr

blart

from bsak into table itab

where cpudt in r_cpudt

AND blart in r_blart

AND bukrs in s_bukrs

AND belnr in s_belnr

AND gjahr in s_gjahr.

<b>Performance Tips:</b>

1.INTO CORRESPONDING will cause performance problem if the no of records are very less as

the runtime required to compare the field names will take longtime.

2.APPENDING will cause performance problem so always use INTO TABLE.Use APPENDING only if

itz necessary/ no other options..

Cheers,

Abdul Hakim