cancel
Showing results for 
Search instead for 
Did you mean: 

5011:SAP Business One 2005B-SDK

Former Member
0 Kudos

I write JournalVoucher with SDK,error code:5011.(SAP Business One 2005B):How to solve it,thanks.

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

Closed.It is reason for data,but code is correct.Thanks everyboby.

Edited by: Cheng Li on Apr 15, 2010 4:06 AM

Former Member
0 Kudos

You may check these threads first:

Thanks,

Gordon

Former Member
0 Kudos

Hi,

Post the code so that we can take a look.... and did u use try catch block in ur code??

Vasu Natari.

Former Member
0 Kudos

Thanks,Everyone:

Code follows as:

______________________________________________________

try

CashTable = New DataTable

Dim JV As SAPbobsCOM.JournalVouchers

JV = vcompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oJournalVouchers)

JV.JournalEntries.Reference = DateTime.Parse(FromDate).ToShortDateString

JV.JournalEntries.Reference2 = DateTime.Parse(ToDate).ToShortDateString

JV.JournalEntries.Indicator = company

Dim i As Integer

Dim Bool As Boolean

For i = 0 To vTable.Rows.Count - 1

If vTable.Rows(i)(1) <> 0 Then

If i <> 0 Then

JV.JournalEntries.Lines.Add()

JV.JournalEntries.Lines.AccountCode = vTable.Rows(i)(0)

JV.JournalEntries.Lines.Debit = vTable.Rows(i)(1)

End If

If vTable.Rows(i)(2) <> 0 Then

JV.JournalEntries.Lines.Add()

JV.JournalEntries.Lines.AccountCode = vTable.Rows(i)(0) '+ company

JV.JournalEntries.Lines.Credit = vTable.Rows(i)(2)

End If

Next

iR = JV.Add()

Dim docnum As String

docnum = vcompany.GetNewObjectKey()

If iR <> 0 Then

vcompany.GetLastError(lErrCode, sErrMsg)

MessageBox.Show("错误描述:" + sErrMsg, "报表合并向导", MessageBoxButtons.OK)

Return sErrMsg

End If

Dim MsgCash As String

If AdjTran = "N" Then

MsgCash = AddCash(vTable, docnum)

Else

Call UpdateAdjTran(docnum)

End If

Return "数据导入成功," + MsgCash

Exit Function

Catch ex As Exception

Return "数据导入异常,异常描述:" + Err.Description

End Try

Former Member
0 Kudos

You are using too much != 0 as the condition checker. That should be the last thing to do to get the correct logic.