cancel
Showing results for 
Search instead for 
Did you mean: 

Some information about Start Transaction

Former Member
0 Kudos

                hi.

               i am  adding bp masters

               i am using  start transaction and end trasaction.

               Normally i had used this type of method in sales order and goods issue that time it is working

               first sales order i posted  after goods issue i am posting if any error will comes i cancel the both transacitons using roll back

               below i had used same method but not working may i know why . Roll back will not work for  master data .

              Can any body explain.

              In below for loop  i have  20  masters  i am adding  3 master s just for checking purposes  at  4th row  i roll back it

            but previous masters it wont cancel  my i know why..


                          ocompany.StartTransaction()

                        Dim vBP As SAPbobsCOM.BusinessPartners

                        vBP = oOtherCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oBusinessPartners)

                        For i = 0 To dt.Tables(0).Rows.Count - 1

                            If (i = 3) Then

                                ocompany.EndTransaction(SAPbobsCOM.BoWfTransOpt.wf_RollBack)

                                Exit Sub

                            End If

                            Dim cc, cn, tx, cc1 As String

                            cc = dt.Tables(0).Rows(i).Item(0)

                            cn = dt.Tables(0).Rows(i).Item(1)

                            tx = dt.Tables(0).Rows(i).Item(2)

                            cc1 = cc & 89

                            vBP.CardCode = cc1

                            vBP.CardName = cn

                            vBP.FiscalTaxID.TaxId0 = tx

                            vBP.FiscalTaxID.Add()

                            'If (vBP.GetByKey(cc1) = True) Then

                            'Else

                            If (0 <> vBP.Add()) Then

                                'MsgBox("Failed to add an business partner")

                            Else

                                Dim objCode As String

                                'MsgBox("Succeeded add a business parnter, new objcode=" + vBP.CardCode)

                                SBO_Application.SetStatusBarMessage("Succeeded add a business parnter, new objcode=" + vBP.CardCode, SAPbouiCOM.BoMessageTime.bmt_Medium, False)

                                ' vBP.SaveXML("c:\temp\BP" + vBP.CardCode + ".xml")

                            End If

                            'Check Error

                            Call oOtherCompany.GetLastError(nErr, errMsg)

                            If (0 <> nErr) Then

                                ocompany.EndTransaction(SAPbobsCOM.BoWfTransOpt.wf_RollBack)

                                SBO_Application.SetStatusBarMessage("Found error:" + Str(nErr) + "," + errMsg, SAPbouiCOM.BoMessageTime.bmt_Long, True)

                                MsgBox("Found error:" + Str(nErr) + "," + errMsg)

                            End If

                        Next

                    End If

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

I see you have to references to Company object: oCompany and oOtherCompany.

You start the transaction for one company, but actually perform the BP adding in the other company...

You should obviously handle the transaction in the same company you perform DB changes...

Beni.

Former Member
0 Kudos

HI Beni

Thanks  For your reply..

Keep posting.

Answers (0)