ABAP里For all entries FAE的用法

简介: Sent: Mittwoch, 30. Oktober 2013 12:54

by IBASE we have some places which are using Open Cursor … Fetch. For example in the method CL_IBCOMPTOCOMADV_IL->IF_IBASE_IL_SEARCH~SEARCH_DYNAMIC


OPEN CURSOR WITH HOLD lv_cursor FOR

SELECT DISTINCT

(lt_select_cond)

FROM  (lt_from_cond)

FOR ALL ENTRIES IN gt_type_maint

WHERE (lt_where_cond)

AND   (gv_type_maint_where_cond).

FETCH NEXT CURSOR lv_cursor

INTO CORRESPONDING FIELDS OF TABLE lt_select_parameters

PACKAGE SIZE gc_package_size.

The gc_package_size is set to 100.


I tested this coding in HANA and non-HANA system. In both system the SQL trace file shows that much more records than 100 were selected from DB. Is this the standard behavior?


And in HANA system the performance is much worse than non-HANA system.



image.png

image.png

# Answer the documentation says “The addition PACKAGE SIZE does not influence the size of the packages (configured in the profile parameters) used to transport data between the database server and the application server.” The package size influences the communication between the DBIF and the ABAP (you only get the number of records specified by the addition PACKAGE SIZE into the internal table), but not the communication of the DBIF with the DB. This is similar to the situation with SELECT … ENDSELECT and SELECT INTO TABLE … . The "Open Cursor" handling from within ABAP works on HANA like on AnyDB. The problem you described is related to the combination of cursor handling together with the FOR ALL ENTRIES addition. In that case, package processing on moderate sized tables looks to the end user like it works perfectly fine. On huge tables memory dumps occur like you reported. So why is that the case? It's simply the fact that the package processing happens in that special combination on the application server only! This means that all the data is loaded into SAP Memory at the first fetch statement and the package processing happens on this application server buffer only. Therefore the system memory dump on huge tables is easily understandable. Nevertheless this is not the system behaviour one would expect as OPEN cursor handling with packaging is typically the approach to be used when working with massive amount of data. How to resolve that? Just use a RANGE TABLE together with the IN operator. With that, packaging works like it should be - on database level. We plan to replace FOR ALL ENTRIES with RANGE TABLE in our programs. I tested it and it works as expected. please be aware that statements with ranges tables may have other problems. Esp. if the ranges table is huge, the statement size may overflow predefined limits. With FOR ALL ENTRIES this cannot happen because the DBIF in the ABAP WP splits the internal driver table into smaller chunks.



相关文章
|
SQL 关系型数据库 Unix
SAP ABAP FOR ALL ENTRIES 的用法
SAP ABAP FOR ALL ENTRIES 的用法
|
5月前
|
存储 测试技术
如何使用 ABAP Debug Script 在 ABAP 调试器里,快速显示一个 BOL Entity 的值
如何使用 ABAP Debug Script 在 ABAP 调试器里,快速显示一个 BOL Entity 的值
underscore 系列之防冲突与 Utility Functions
underscore 使用 _ 作为函数的挂载对象,如果页面中已经存在了 _ 对象,underscore 就会覆盖该对象,所以 underscore 提供了 noConflict 功能,可以放弃 underscore 的控制变量 _,返回 underscore 对象的引用。
138 0
underscore 系列之防冲突与 Utility Functions
ABAP里For all entries FAE的用法
Sent: Mittwoch, 30. Oktober 2013 12:54
136 0
ABAP里For all entries FAE的用法
SAP Hybris的类型系统更改和ABAP的LOAD_PROGRAM_TABLE_MISMATCH
SAP Hybris的类型系统更改和ABAP的LOAD_PROGRAM_TABLE_MISMATCH
176 0
SAP Hybris的类型系统更改和ABAP的LOAD_PROGRAM_TABLE_MISMATCH
ABAP 数据结构激活时的错误消息 - combination reference table field XXX does not exist
ABAP 数据结构激活时的错误消息 - combination reference table field XXX does not exist
ABAP 数据结构激活时的错误消息 - combination reference table field XXX does not exist
ABAP check table的工作原理
Created by Jerry Wang on Sep 29, 2016
145 0
ABAP check table的工作原理
SAP ABAP实用技巧介绍系列之Internal table compression and decompression
SAP ABAP实用技巧介绍系列之Internal table compression and decompression
143 0
SAP ABAP实用技巧介绍系列之Internal table compression and decompression
SAP ABAP实用技巧介绍系列之利用RTTC给DDIC structure动态添加新的field
SAP ABAP实用技巧介绍系列之利用RTTC给DDIC structure动态添加新的field
112 0
SAP ABAP实用技巧介绍系列之利用RTTC给DDIC structure动态添加新的field