ABAP performance学习笔记
来源:互联网 发布:火锅店收银软件 编辑:程序博客网 时间:2024/06/06 03:57
一,尽量杜绝使用select...endselect的实用方法而使用internal table.
二,Loop里面不要嵌套select.可以首先使用for all entry in的方法将select的内容放置到internal table中,然后对该table进行排序,最后在loop里面使用read table ....with key ...binary search的方法。(此方法有一个例外,在外层loop数据量大的情况下,如果loop里面嵌套的select每次只读取出几条数据,而使用for all entry in的方法读取出来的数据量十分庞大的时候,在使用read table binary seach的方法可能会造成内存不足从而dump的情况。该结论未经证实。而是同事得出的结论:loop的内表中有100多万条数据,loop里面select时每次只读出了几条,而使用for all entry in的情况下则读出了好几百万条的数据,最后造成了内存不足的情况。我的意见:遇到该种情况可以实际动手对两种情况进行一些测试比较)
三,使用select读取表数据的时候尽量使用主键或者index.如何判断index是否有作用以后抽时间在讲。
四,避免Loop里面套Loop的方法或者是Loop里面嵌套delete table where ...。可以使用field symbols来解决该问题。这一招实际应用中非常有效果。具体如何实现请参考如下代码:
LOOP AT itab.
DELETE itab1 WHERE matnr = itab-matnr AND
vbeln = itab-vbeln AND
posnr = itab-posnr.
ENDLOOP.
Recommendation:
field-symbols <fs>like line of itab.
field-symbols <fs1> like line of itab1.
loop at itab assigning <fs>.
read table itab1 transportingno fields binary search with
key matnr = <fs>-matnr
vbeln = <fs>-vbeln
posnr = <fs>-posnr.
lf_from_index = sy-tabix.
if sy-subrc eq 0.
loop at itab1 assigning <fs1>from lf_from_index.
if not ( <fs1>-matnr = <fs>- matnr and <fs1>-vbeln = <fs>-vbelnand
<fs1>-posnr = <fs>-posnr ).
exit.
endif.
<delete>
endloop.
endif.
endloop.
五,使用for all entry in的时候切记两点:使用DELETE ADJACENT DUPLICATES FROM删除从表中的重复记录,以及使用if not interanl table is initial判断主表是否为空,只要在主表不为空的情况下才执行。
今天先记录如下,没有经过整理的,凭着记忆写的,以后再补充.
- ABAP performance学习笔记
- abap performance
- Hive & Performance 学习笔记
- ABAP学习笔记之一
- abap学习笔记2
- ABAP学习笔记之一
- ABAP 学习笔记一
- ABAP 学习笔记 二
- ABAP学习笔记
- ABAP学习笔记
- ABAP学习笔记
- WebLogic Performance Tuning学习笔记
- abap学习笔记-SAP abap简介
- ABAP Performance Examples
- ABAP Performance Examples
- ABAP Performance Examples (转)
- ABAP学习笔记--处理字符串
- abap学习笔记之GET_GLOBALS_FROM_SLVC_FULLSCR
- Android 动画分析
- 别站着编程:站着工作未必对你的健康有好处
- iOS开发- 隐藏键盘总结
- System tuning中经常用到的一些Tcode
- 推荐一个中国领先的.net论坛,http://bbs.netluntan.com
- ABAP performance学习笔记
- WrapPanel的使用和动画效果
- Python 摄像头截图
- string.Split方法来分割字符串的注意事项:
- 小三的狂躁
- maven hadoop2.2.0 java.io.IOException: Cannot initialize Cluster
- ios设备唯一标识获取策略
- Qt on Android: Qt Quick 简单教程
- swift笔记——环境搭建及Hello,Swift!