on 05-11-2011 1:37 PM
Hi kings
I'm posting journal entry one database to another database using Di API. Problem is when i have two record one record posting another one record posting time show the error "unbalance transaction".
Thanks & regards
B.lakshmi narayanan
Hi,
Your question is not very clear. What is the exact condition that Unbalance transaction pop up?
Thanks,
Gordon
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi thanks for your valuable reply.
I have two journal entry in test database . now i want push these two records in live database using DI API. First record Pushing without Problem. when Code push to second record that time its show the Error unbalance transaction
thanks & Regards
B.Lakshmi Narayanan
thanks For Your Reply
Dim oJournal As SAPbobsCOM.Recordset = oCompany1.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset)
Dim oDocentry As SAPbobsCOM.Recordset = oCompany1.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset)
Try
oJournalEntry = oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oJournalEntries)
StrSql1 = "SELECT distinct(T0.[TransId]) FROM OJDT T0 WHERE T0.[U_Upload]='N' and T0.[U_Process] ='N'"
oDocentry.DoQuery(StrSql1)
sqlCmdSelectFrmDB = New SqlCommand(StrSql1, sqlConn)
Dim sqlDA As New SqlDataAdapter(sqlCmdSelectFrmDB)
sqlConn.Open()
sqlDA.Fill(oDSBPDB)
sqlConn.Close()
If oDSBPDB.Tables(0).Rows.Count = 0 Then
End If
For j As Integer = 0 To oDSBPDB.Tables(0).Rows.Count - 1
strSQL = "SELECT * FROM OJDT T0 INNER JOIN JDT1 T1 ON T0.TransId = T1.TransId WHERE T0.[TransId] ='" & oDSBPDB.Tables(0).Rows(j).Item("TransId").ToString() & "' and T0.[U_Upload] ='N' and T0.[U_Process]='N' "
sqlCmdSelectFrmDB1 = New SqlCommand(strSQL, sqlConn)
Dim sqlDANew1 As New SqlDataAdapter(sqlCmdSelectFrmDB1)
oRowsDS.Clear()
sqlConn.Open()
sqlDANew1.Fill(oRowsDS)
sqlConn.Close()
For intI = 0 To oRowsDS.Tables(0).Rows.Count - 1
If oCompany.InTransaction = False Then oCompany.StartTransaction()
Dim ref As String = ""
ref = oRowsDS.Tables(0).Rows(intI).Item("Ref1").ToString()
oJournalEntry.Reference = "JE - " + ref
oJournalEntry.Reference2 = oRowsDS.Tables(0).Rows(intI).Item("Ref2").ToString()
oJournalEntry.Series = oRowsDS.Tables(0).Rows(intI).Item("Series").ToString()
oJournalEntry.Memo = oRowsDS.Tables(0).Rows(intI).Item("Memo").ToString()
oJournalEntry.ReferenceDate = oRowsDS.Tables(0).Rows(intI).Item("RefDate").ToString()
oJournalEntry.DueDate = oRowsDS.Tables(0).Rows(intI).Item("DueDate").ToString()
oJournalEntry.TransactionCode = oRowsDS.Tables(0).Rows(intI).Item("TransType").ToString()
oJournalEntry.TaxDate = oRowsDS.Tables(0).Rows(intI).Item("TaxDate").ToString()
If Not bolGIFirstRecord Then
oJournalEntry.Lines.Add()
End If
bolGIFirstRecord = False
oJournalEntry.Lines.AccountCode = oRowsDS.Tables(0).Rows(intI).Item("Account").ToString()
oJournalEntry.Lines.ContraAccount = oRowsDS.Tables(0).Rows(intI).Item("ShortName").ToString()
oJournalEntry.Lines.Debit = oRowsDS.Tables(0).Rows(intI).Item("Debit").ToString()
oJournalEntry.Lines.Credit = oRowsDS.Tables(0).Rows(intI).Item("Credit").ToString()
oJournalEntry.Lines.ShortName = oJournalEntry.Lines.ContraAccount
oJournalEntry.Lines.Reference1 = oRowsDS.Tables(0).Rows(intI).Item("Ref1").ToString()
oJournalEntry.Lines.Reference2 = oRowsDS.Tables(0).Rows(intI).Item("Ref2").ToString()
oJournalEntry.Lines.ProjectCode = oRowsDS.Tables(0).Rows(intI).Item("Project").ToString()
oJournalEntry.Lines.CostingCode2 = oRowsDS.Tables(0).Rows(intI).Item("OcrCode2").ToString()
oJournalEntry.Lines.CostingCode3 = oRowsDS.Tables(0).Rows(intI).Item("OcrCode3").ToString()
oJournalEntry.Lines.CostingCode = oRowsDS.Tables(0).Rows(intI).Item("ProfitCode").ToString()
Next
intErrorGI = oJournalEntry.Add()
oRowsDS.Tables(0).Clear()
bolGIFirstRecord = True
If intErrorGI <> 0 Then
If oCompany.InTransaction = True Then oCompany.EndTransaction(SAPbobsCOM.BoWfTransOpt.wf_RollBack)
Me.WriteToMainLogFile(oCompany.GetLastErrorCode & "----" & oCompany.GetLastErrorDescription, TransNumberForErrorHandling)
Dim UpdateRec2 As SAPbobsCOM.Recordset
sSql6 = "UPDATE OJDT SET U_Upload ='N',U_Process='Y' where (OJDT.TransId ='" & oDSBPDB.Tables(0).Rows(j).Item("TransId").ToString() & "')"
UpdateRec2 = oCompany1.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset)
UpdateRec2.DoQuery(sSql6)
Else
If oCompany.InTransaction = True Then oCompany.EndTransaction(SAPbobsCOM.BoWfTransOpt.wf_Commit)
Dim UpdateRec1 As SAPbobsCOM.Recordset
sSql5 = "UPDATE OJDT SET U_Upload ='Y',U_Process='Y' where (OJDT.TransId ='" & oDSBPDB.Tables(0).Rows(j).Item("TransId").ToString() & "')"
UpdateRec1 = oCompany1.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset)
UpdateRec1.DoQuery(sSql5)
End If
Next
User | Count |
---|---|
95 | |
11 | |
11 | |
6 | |
6 | |
4 | |
4 | |
3 | |
3 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.