Hi, Im using SAP B1 2007 A SP01 PL 07.
I have some code that is performing Incoming Payments via the DI API and checking the result.
If the result is OK, then I'm getting the new object key and using it further in the code. See code snippet below.
I'm finding that sometimes I get a DocEntry from GetNewObjectKey that cannot possibly be for the Incoming Payment that has just been created. It seems to be pointing to an incomiong Payment that was generated by another app that is running (POS).
QUESTION: Does the GetNewObjectKey method return the last key generated by the specific instance of the DI or does it return the key of the last object created across all instances of the DI ??
int res1 = payment.Add();
if (res1 < 0)
//Payment posting Failed - Get Reason
Success = false;
string ErrorReason = B1Connections.diCompany.GetLastErrorDescription();
LastSAPError = ErrorReason;
//INCOMING PAYMENT GENERATED OK
//CREATE LINE IN @BK_INC_PYMT
IncomingPaymentDocEntry = int.Parse(B1Connections.diCompany.GetNewObjectKey());
nonGrainIncPaymentsTableAdapter.AddPaymentLine(NextRunNo, pcp.Project, Convert.ToDouble(pcp.Movement), Convert.ToDouble(pcp.NewBalance), pcp.Ref, IncomingPaymentDocEntry);