Quantcast
Channel: SCN: Message List
Viewing all articles
Browse latest Browse all 8712

Re: GetNewObjectKey() returning empty

$
0
0

Hi Leandro,

I cant reproduce your issue in SBO 9.0 PL 11 .Which version are you using ?

 

The code I used :

 

SBO_Company.StartTransaction();
for (int i = 1; i < 4; i++)
{    SAPbobsCOM.Documents oDoc = SBO_Company.GetBusinessObject(BoObjectTypes.oQuotations);    oDoc.CardCode = "C50000";    oDoc.DocDueDate = DateTime.Today;    oDoc.Lines.ItemCode = "A00004";    oDoc.Lines.Quantity = i;    if (oDoc.Add() == 0)    {        SBO_Application.MessageBox("Run no. "+i+" - NewObjectKey: " + SBO_Company.GetNewObjectKey()); // correct new object keys    }    else    {        SBO_Application.MessageBox("Error in run no. "+i+": " + SBO_Company.GetLastErrorDescription());    }
}
if (SBO_Company.InTransaction)    SBO_Company.EndTransaction(BoWfTransOpt.wf_Commit);
SBO_Application.MessageBox("After commit : " + SBO_Company.GetNewObjectKey());

Can it be that your second dcoument can't be added, instead of return false; print GetLastErrorDescription().

 

regards,

Maik


Viewing all articles
Browse latest Browse all 8712

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>