Skip to Content
0
Former Member
Apr 28, 2011 at 11:11 AM

How to add journal entry from one db to other db

37 Views

Dear Experts,

Am using this code for connecting the currrent db to other db, and i put entry in journal entry after add the document, it will be added to other db. Finally i got retcode=0 and Message displayed as "Successfully Adding" , but the data are not added to other db.

vcmp.Server = "192.168.160.24"

vcmp.LicenseServer = "192.168.160.24:30000"

vcmp.UseTrusted = False

vcmp.CompanyDB = "test"

vcmp.UserName = "manager"

vcmp.Password = "1234"

vcmp.DbUserName = "sa"

vcmp.DbPassword = "1234"

vcmp.DbServerType = SAPbobsCOM.BoDataServerTypes.dst_MSSQL2008

lRetCode = vcmp.Connect()

If vcmp.Connected Then

MsgBox("sucess")

Else

MsgBox(vcmp.GetLastErrorDescription)

End If

Dim oJnl As SAPbobsCOM.JournalEntries

Dim Amt As Decimal = 0

oJnl = objAddOn.objCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oJournalEntries)

oJnl.ReferenceDate = now

oJnl.DueDate = now

oJnl.TaxDate = now

oJnl.Reference = 1

oJnl.Memo = "OG Purchase"

oJnl.Reference2 = "This is for Training Purpose"

oJnl.Lines.AccountCode = "143030"

Amt=100

oJnl.Lines.Debit = CDbl(Math.Round(Amt, 0))

oJnl.Lines.Add()

oJnl.Lines.AccountCode = "143030"

oJnl.Lines.Credit = CDbl(Math.Round(Amt, 0))

lRetCode = oJnl.Add

If lRetCode <> 0 Then

objAddOn.objApplication.MessageBox(objAddOn.objCompany.GetLastErrorDescription)

Else

'objAddOn.objApplication.MessageBox("Successfully Adding")

End If