Skip to Content
0
Former Member
Jun 06, 2008 at 12:03 AM

Problems with EndTransaction

294 Views

Hello,

I am seeing two issues with transactional upload using DIAPI-

Issue 1 -

I am running 2007 DIAPI and get an exception on EndTransaction method call. Please refer to the sample code below.

Issue 2 -

I am trying to create BP's using DIAPI. I have started the transaction but any record that succeeds after a failure gets added. If all records succeed then nothing is uploaded but if say one record fails then any success after gets uploaded (committed).

No upload should happen if StartTransaction is called.

Please find the sample code below.

Has any one seen these problems? Am I missing anything?

Sample Code in C# -

string[] CardCodes = new string[] { "Moon", "Test103", "1002" };

conn.StartTransaction();

foreach (string cardCode in CardCodes) {

SAPbobsCOM.BusinessPartners bp = (SAPbobsCOM.BusinessPartners)conn.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oBusinessPartners);

bp.CardCode = cardCode;

bp.CardType = SAPbobsCOM.BoCardTypes.cCustomer;

int errCode;

string errMsg;

int returnval = bp.Add();

if (0 != returnval) {

conn.GetLastError(out errCode, out errMsg);

Console.WriteLine(errMsg);

}

}

conn.EndTransaction(SAPbobsCOM.BoWfTransOpt.wf_RollBack);

Thanks and Regards,

Sheetal