问题描述
我的java / groovy程序从用户输入中接收表名称和表字段,它在SAP中查询表并返回其内容。
My java/groovy program receives table names and table fields from the user input, it queries the tables in SAP and returns its contents.
用户输入可能涉及表 CDPOS
和 CDHDR
。阅读SAP文档并进行谷歌搜索后,我发现这些表存储了更改文档日志。但是我没有找到任何可以在Java中使用的远程调用函数来执行这种查询。
The user input may concern the tables CDPOS
and CDHDR
. After reading the SAP documentations and googling, I found these are tables storing change document logs. But I did not find any remote call functions that can be used in java to perform this kind of queries.
然后我使用了已弃用的RFC功能模块 RFC_READ_TABLE
,并尝试仅根据此RFC建立自定义查询。但是,我发现传递给此RFC的所需字段数是否大于2,即使我限制了最大行数,也总是出现 DATA_BUFFER_EXCEEDED
错误。
Then I used the deprecated RFC Function Module RFC_READ_TABLE
and tried to build up customized queries only depending on this RFC. However, I found if the number of desired fields I passed to this RFC are more than 2, I always got the DATA_BUFFER_EXCEEDED
error even if I limit the max rows.
我无权成为SAP系统中的ABAP开发人员,也无法向现有系统中添加任何FM,因此我只能编写代码以在JAVA中满足此要求。
I am not authorized to be an ABAP developer in the SAP system and can not add any FM to existing systems, so I can only write code to accomplish this requirement in JAVA.
我做错什么了吗?
推荐答案
DATA_BUFFER_EXCEEDED
如果您要读取的字段的总宽度超过 DATA
参数的 width ,则可能会发生这种情况,具体取决于SAP版本-512当前系统的字符。它与行的数量无关,而是与单个数据集的大小有关。
DATA_BUFFER_EXCEEDED
only happens if the total width of the fields you want to read exceeds the width of the DATA
parameter, which may vary depending on the SAP release - 512 characters for current systems. It has nothing to do with the number of rows, but the size of a single dataset.
所以问题是:内容是什么参数 FIELDS
的值?如果为空,则表示读取所有字段。 CDHDR
的宽度为192个字符,因此我认为问题是 CDPOS
的宽度为774个字符。主要问题是字段 VALUE_OLD
和 VALUE_NEW
,均为245个字符。
So the question is: What are the contents of the FIELDS
parameter? If it's empty, this means "read all fields." CDHDR
is 192 characters in width, so I'd assume that the problem is CDPOS
which is 774 characters wide. The main issue would be the fields VALUE_OLD
and VALUE_NEW
, both 245 Characters.
即使您没有获得开发人员访问权限,也应促使某人获得只读字典访问权限,以便能够详细检查结构。
Even if you don't get developer access, you should prod someone to get read-only dictionary access to be able to examine the structures in detail.
无耻的插件:包含 RFC_READ_TABLE $ c $的包装器类c>负责字段处理,并确保所选字段的总宽度低于功能模块所施加的限制。
Shameless plug: RCER contains a wrapper class for RFC_READ_TABLE
that takes care of field handling and ensures that the total width of the selected fields is below the limit imposed by the function module.
另外请注意,这些表可以在生产环境中变得巨大-想想数十亿个条目。通过对这些表执行过多的读取操作,您可以轻松地使数据库陷入停顿。
Also be aware that these tables can be HUGE in production environments - think billions of entries. You can easily bring your database to a grinding halt by performing excessive read operations on these tables.
PS: RFC_READ_TABLE
未根据SAP注释发行,供客户使用note 建议创建自己的功能模块,并提供一个模板,改进的逻辑。
PS: RFC_READ_TABLE
is not released for customer use as per SAP note 382318, and the note 758278 recommends to create your own function module and provides a template with an improved logic.
这篇关于调用RFC_READ_TABLE时出现DATA_BUFFER_EXCEEDED错误?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!