一、利用内表缓冲减少数据库访问次数
REPORT zmmi003.
data: it_vbap type table of vbap,
wa_vbap type vbap,
it_makt type table of makt,
wa_makt type makt.
perform process.
perform process_using_cursor.
*&---------------------------------------------------------------------*
*& Form process
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
FORM process .
DATA: t1 TYPE i,
t2 TYPE i,
tmin TYPE i.
get run time field t1.
select * into wa_vbap
up to 10000 rows
from vbap .
select single * into wa_makt
from makt
where matnr = wa_vbap-matnr.
* write:/ wa_makt-MAKTX.
endselect.
get run time field t2.
tmin = t2 - t1.
write:/ '----------------------

这篇博客介绍了两种提高ABAP代码效率的方法:一是利用内表缓冲减少数据库访问次数,通过对比使用UP TO和单一READ TABLE操作的执行时间来说明;二是利用单条READ TABLE指令提升LOOP访问速度,通过比较排序后内表遍历与索引查找的性能差异。
最低0.47元/天 解锁文章
1142

被折叠的 条评论
为什么被折叠?



