I'm using two different BAPIs to get data from SAP ERP. When I use BAPI_SALESORDER_GETLIST
, it works perfectly. But when I use BAPI_BILLINGDOC_GETLIST
, I get no data. This is how I'm trying to call the 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;
As far as I can tell, it all looks right. I got with the SAP ERP team and they made sure the account I'm using has access to everything and we ran the BAPI in SAP ERP and it worked fine.
So SAP ERP seems fine. Any ideas on what I'm doing wrong here?