c# - 在 C# 中使用 SAP 中的 BAPI 读取 RFCTable 数据
问题描述
我想在 c# 中从 RFCtable 读取表数据,我能够获取表结构,但我没有获取表中的数据。
下面是代码
RfcDestinationManager.RegisterDestinationConfiguration(config__);
RfcDestination prdData = RfcDestinationManager.GetDestination("Vim Analytics");
RfcRepository repos = prdData.Repository;
IRfcFunction InvoiceVIMAny = repos.CreateFunction("BAPI NAME");
InvoiceVIMAny.SetValue("I_INVOICE_NO", InvoiceNumber);
InvoiceVIMAny.SetValue("I_VENDOR_ID", VendorID);
InvoiceVIMAny.Invoke(prdData);
if (InvoiceVIMAny.ElementCount > 0 && InvoiceVIMAny.ElementCount != null)
{
IRfcTable rfcTable = InvoiceVIMAny.GetTable(0);
foreach (IRfcStructure dataRow in rfcTable)
{
invstatusResp.E_STATUS = dataRow.GetValue("E_STATUS").ToString();
invstatusResp.E_DOC_ID = dataRow.GetValue("E_DOC_ID").ToString();
invstatusResp.E_PO_NUMBER = dataRow.GetValue("E_PO_NUMBER").ToString();
invstatusResp.E_INVOICE = dataRow.GetValue("E_INVOICE").ToString();
invstatusResp.E_REASON = dataRow.GetValue("E_REASON").ToString();
invstatusResp.E_DOC_DATE = dataRow.GetValue("E_DOC_DATE").ToString();
invstatusResp.E_POSTING_DATE = dataRow.GetValue("E_POSTING_DATE").ToString();
invstatusResp.E_ENTRY_DATE = dataRow.GetValue("E_ENTRY_DATE").ToString();
invstatusResp.E_DUE_DATE = dataRow.GetValue("E_DUE_DATE").ToString();
invstatusResp.E_GROSS_AMT = dataRow.GetValue("E_GROSS_AMT").ToString();
invstatusResp.E_COMMENTS = dataRow.GetValue("E_COMMENTS").ToString();
invstatusResp.E_CUR_ROLE = dataRow.GetValue("E_CUR_ROLE").ToString();
listinvstatusResp.Add(invstatusResp);
}
}
RfcDestinationManager.UnregisterDestinationConfiguration(config__);
解决方案
推荐阅读
- javascript - 返回没有给出预期的答案
- javascript - 如何使用 javascript web audio api 修复同时播放的多个振荡器的声音
- java - 删除最近在 pie 设备中以编程方式获取 android 的短信
- java - org.openqa.selenium.ElementNotVisibleException:元素不可交互
- r - 如何在 ggplot2 的 geom_text() 中解析 LaTeX 数学公式
- javascript - 为什么 Array.length 返回一个大于实际最高数组索引的数字?javascript不是从0开始计数吗?
- python - 优化python代码以获得更快的响应
- c# - UserControl 不显示数据
- php - 使用 PHP 对自定义 shortode 进行正则表达式匹配
- javascript - react.js 中数组更新状态的这种解构语法如何