2006 Sep 16 1:36 AM
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
2006 Sep 16 1:40 AM
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
2006 Sep 16 1:41 AM
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!!
2006 Sep 16 4:10 AM
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
2006 Sep 16 4:24 PM
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
2006 Sep 16 5:33 AM
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
2006 Sep 16 6:45 AM
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
2006 Sep 16 6:58 AM
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
| User | Count |
|---|---|
| 3 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |