Skip to Content
0
Former Member
Apr 11, 2008 at 03:26 PM

Adding Additional Expenses to a delivery/invoice document

17 Views

Hi,

I want to add additional expenses to delivery document.

After I add the additional expenses , when I try to add the delivery document (objDLDoc.Add ), I get "Internal Error".

(If I don't update the additional expenses , I could successfully add the document.)

Please help me with this.

I'll appreciate your help.

Thanks in advance.

Regards,

Geetha

This is the function that I use to update the additional expenses of the delivery document :

Private Function AddFreight(ByRef objDLDoc As SAPbobsCOM.Documents, ByVal objHeaderInfo As stDLHeaderInfo, ByVal ArrAddlExpenses() As stAdditionalExpenses) As Boolean

Try

Dim objEnumerator As stAdditionalExpenses

Dim nCnt As Integer

If objDLDoc.Expenses.Count = 0 Then objDLDoc.Expenses.Add()

nCnt = objDLDoc.Expenses.Count

For Each objEnumerator In ArrAddlExpenses

Select Case objEnumerator.enuCreateOption

Case stAdditionalExpenses.ExpenseCreateOption.Freight

Dim intLineNum As Integer

Dim bFound As Boolean = False

For intLineNum = 0 To nCnt - 1

objDLDoc.Expenses.SetCurrentLine(intLineNum)

If objDLDoc.Expenses.ExpenseCode = objEnumerator.strCode Then

objDLDoc.Expenses.LineTotal = objEnumerator.dblTotal

bFound = True

End If

Next

If Not bFound Then

objDLDoc.Expenses.ExpenseCode = objEnumerator.strCode

objDLDoc.Expenses.LineTotal = objEnumerator.dblTotal

If objDLDoc.Expenses.Count < ArrAddlExpenses.GetLength(0) Then

objDLDoc.Expenses.Add()

End If

End If

End Select

Next

return true

Catch ex As Exception

Call objSBOAPI.DisplayWarningMessage(ex.Message)

End Try