Skip to Content
avatar image
Former Member

Are the any other option by GetNewObjetKey to retrieves the key of the last added record?

We have customer that use few AddOns and processes that add new documents via DI API. We found that sometimes 2 transactions (documents) added almost stimulatingly and we get the same object key for these both transactions. So we don't have the correct object for one of the documents.

Follow the example of code that we use (we run it for different objects on the same company connection):

SAPbobsCOM.Documents PurchaseOrder = Company.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oPurchaseOrders) as SAPbobsCOM.Documents;

PurchaseOrder.carcode= "123";

PurchaseOrder.DocRate = 3.5;

PurchaseOrder.DocDate =DateTime.Now;


PurchaseOrder.Lines.ItemCode= "345";

PurchaseOrder.Lines.UnitPrice = 200;

int r = PurchaseOrder.Add();

if (r==0) {int result=Company.GetNewObjetKey();}

Are the any other option to retrieves the key of the last added record, may be by object type? or as the output of the Add method?



Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

0 Answers