【发布时间】:2017-12-21 10:07:20
【问题描述】:
我需要从 C# 应用程序中搜索 SAP 系统中的客户。 我正在使用 C# .NET 连接器。 我尝试调用 BAPI“BAPI_CUSTOMER_FIND”来获取名称以“C”字符开头的所有客户,这是我的代码:
SAPConnectionConfigurator cfg = new SAPConnectionConfigurator();
RfcDestinationManager.RegisterDestinationConfiguration(cfg);
RfcDestination dest = RfcDestinationManager.GetDestination("mySAPdestination");
RfcRepository repo = dest.Repository;
IRfcFunction customerList = repo.CreateFunction("BAPI_CUSTOMER_FIND");
customerList.SetValue("MAX_CNT", "100");
IRfcTable searchFields = customerList.GetTable("SELOPT_TAB");
searchFields.Insert();
searchFields.CurrentRow.SetValue("COMP_CODE", "");
searchFields.CurrentRow.SetValue("TABNAME", "KNA1");
searchFields.CurrentRow.SetValue("FIELDNAME", "NAME1");
searchFields.CurrentRow.SetValue("FIELDVALUE", "C*");
customerList.Invoke(dest);
IRfcTable results = customerList.GetTable("RESULT_TAB");
调用正常,但我不知道如何读取结果。我需要一个客户列表,但 RESULT_TAB 表有这种奇怪的结构:
https://www.sapdatasheet.org/abap/tabl/bapikna111.html
如何获取客户列表?我是否调用了错误的 BAPI?
【问题讨论】:
标签: c# sap sap-dotnet-connector