I wrote a Delphi program to load all open invoices from a legacy system into SAP BO. I get the account number using the following code:
vBob := Company1.GetBusinessObject(BOBridge) as ISBOBob;
aRecordSet:= vBob.GetObjectKeyBySingleValue(oChartOfAccounts, 'FormatCode','40000000495',bqc_equal);
AcctCode := aRecordSet.Fields.Items(0).Value;
I checked AcctCode and its value is '_SYS00000000292', this value is passed as AccountCode. I verified that key on table OACT and it corresponds to account '4000000495'. When I try to post the invoice with the Add method I get error 2028:
Error adding invoice [OACT], No matching record found.
I even tried to pass the key value as a constant. The Data Transfer Workbench gives me the same error.