11

我的 java/groovy 程序从用户输入接收表名和表字段,它查询 SAP 中的表并返回其内容。

用户输入可能涉及表格CDPOSCDHDR. 在阅读 SAP 文档和谷歌搜索后,我发现这些是存储更改文档日志的表。但是我没有找到任何可以在java中使用的远程调用函数来执行这种查询。

然后我使用了已弃用的 RFC 功能模块RFC_READ_TABLE,并尝试仅根据此 RFC 构建自定义查询。但是,我发现如果我传递给此 RFC 的所需字段数超过 2,DATA_BUFFER_EXCEEDED即使我限制了最大行数,我总是会收到错误消息。

我没有授权成为SAP系统中的ABAP开发人员,也无法在现有系统中添加任何FM,所以我只能在JAVA中编写代码来完成这个需求。

难道我做错了什么?你能给我一些关于这个问题的提示吗?

4

3 回答 3

17

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.

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.

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 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.

于 2010-11-12T19:05:46.600 回答
1

改用 BBP_RFC_READ_TABLE

于 2019-12-17T19:46:58.923 回答
0

有一种方法可以解决 DATA_BUFFER_EXCEED 错误。尽管根据 SAP OSS 说明 382318,此函数未发布供客户使用,但您可以通过更改将参数传递给此函数的方式来解决此问题。它不是导致您的错误的单个字段,但如果数据行超过 512 个字节,则会引发此错误。CDPOS肯定会有这个问题!

如果您知道如何使用 Jco 调用函数并传递表参数,则解决方法是指定您想要返回的确切字段。然后,您可以将返回的结果保持在 512 字节的限制之下。

使用您的 CDPOS 表示例,指定类似这样的内容,您应该一切顺利......(小心,CDPOS 可能会变得庞大!您应该指定并传递 where 子句!)

FIELDS = 'OBJECTCLAS'.... 字段 = 'OBJECTID'

在Java中它可以表示为..

listParams.setValue(this.getpObjectclas(), "OBJECTCLAS");

通过限制您返回的字段,您可以避免此错误。

于 2013-06-06T16:44:01.647 回答