2

我正在使用两种不同的 BAPI 从 SAP 获取数据。当我使用BAPI_SALESORDER_GETLIST时,它工作得很好。但是当我使用时BAPI_BILLINGDOC_GETLIST,我没有得到任何数据。这就是我尝试调用 BAPI 的方式:

DataTable table = null;

SapConfig cfg = new SapConfig();

if (RfcDestinationManager.TryGetDestination("SAP") == null)
    RfcDestinationManager.RegisterDestinationConfiguration(cfg);

RfcDestination dest = RfcDestinationManager.GetDestination("SAP");
RfcRepository repo = dest.Repository;

IRfcFunction fnc = repo.CreateFunction("BAPI_BILLINGDOC_GETLIST");
IRfcStructure param = fnc.GetStructure("REFDOCRANGE");
param.SetValue("SIGN", "I");
param.SetValue("OPTION", "EQ");
param.SetValue("REF_DOC_LOW", salesOrderNumber);
param.SetValue("REF_DOC_HIGH", "");

fnc.Invoke(dest);

table = fnc.GetTable("BILLINGDOCUMENTDETAIL").ToDataTable();

return table;

据我所知,一切看起来都不错。我与 SAP 团队合作,他们确保我使用的帐户可以访问所有内容,我们在 SAP 中运行 BAPI,它运行良好。

所以 SAP 似乎很好。关于我在这里做错了什么的任何想法?

4

1 回答 1

3

请检查参数值是否正确。有时 SAP 功能模块要求提交的文档编号带有前导零。您可以在事务中测试功能模块SE37以检查您的参数。

于 2016-03-08T19:32:58.107 回答