1

我在主窗体中有两个 DataGridView,第一个显示来自 SAP 的数据,另一个显示来自 Vertica DB 的数据,我使用的 FM 是 RFC_READ_TABLE,但是调用这个 FM 时出现异常,即如果有太多目标表中的列,SAP 连接器将返回 DATA_BUFFER_EXCEED 异常,是否有任何其他 FM 或方法可以无异常地从 SAP 检索数据?
我想出了一个解决方案,就是将字段拆分为几个数组,将每个部分数据存储到一个数据表中,然后合并数据表,但是如果行数太大,恐怕会花费很多时间。

程序截图

here comes my codes:
RfcDestination destination = RfcDestinationManager.GetDestination(cmbAsset.Text);
            readTable = destination.Repository.CreateFunction("RFC_READ_TABLE");
            /*
             * RFC_READ_TABLE will only extract data up to 512 chars per row. 
             * If you load more data, you will get an DATA_BUFFER_EXCEEDED exception.
             */
            readTable.SetValue("query_table", table);
            readTable.SetValue("delimiter", "~");//Assigns the given string value to the element specified by the given name after converting it appropriately. 
            if (tbRowCount.Text.Trim() != string.Empty) readTable.SetValue("rowcount", tbRowCount.Text);
            t = readTable.GetTable("DATA");
            t.Clear();//Removes all rows from this table. 
            t = readTable.GetTable("FIELDS");
            t.Clear();

            if (selectedCols.Trim() != "" )
            {
                string[] field_names = selectedCols.Split(",".ToCharArray());
                if (field_names.Length > 0)
                {
                    t.Append(field_names.Length);
                    int i = 0;
                    foreach (string n in field_names)
                    {
                        t.CurrentIndex = i++;
                        t.SetValue(0, n);
                    }
                } 
            }
            t = readTable.GetTable("OPTIONS");
            t.Clear();
            t.Append(1);//Adds the specified number of rows to this table. 
            t.CurrentIndex = 0;
            t.SetValue(0, filter);//Assigns the given string value to the element specified by the given index after converting it appropriately. 

            try
            {
                readTable.Invoke(destination);
            }
            catch (Exception e)
            {
            }
4

3 回答 3

2

首先,如果 BBP_READ_TABLE 在您的系统中可用,您应该使用它。这个更好有很多原因。但这不是你问题的重点。在 RFC_READ_TABLE 中有两个 Imports ROWCOUNT 和 ROWSKIPS。你必须使用它们。

我建议您使用 30.000 到 60.000 之间的行数。因此,您必须多次执行 RFC,并且每次增加 ROWSKIPS。第一个循环:ROWCOUNT=30000 AND ROWSKIPS = 0,第二个循环:ROWCOUNT=30000 AND ROWSKIPS=30000 等等...

使用旧的 RFC_READ_TABLE 时也要注意浮点字段。表 LIPS 中有一个。这个 RFC 对它们有问题。

于 2016-01-14T07:40:48.400 回答
0

使用事务

BAPI

按过滤器并设置为全部。在物流执行下,您将找到交货。详细信息屏幕显示函数名称。直接测试它们以找到适合的,然后调用该函数而不是 RFC_read_tab。
例子:

BAPI_LIKP_GET_LIST_MSG

于 2016-01-07T23:25:31.553 回答
0

另一种可能性是开发一个 ABAP RFC 函数来获取您的数据(优点是您可以在一次调用中获得结构化/多表响应,缺点是这不是标准函数/BAPI)

于 2016-01-12T09:04:13.653 回答