cancel
Showing results for 
Search instead for 
Did you mean: 

Freight in A/R Invoice

Former Member
0 Kudos

I am entering A/R invoices through SDK.I am using the following code-


 Dim objDoc As SAPbobsCOM.Documents

 objDoc = objCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oInvoices)objDoc.DocObjectCode = SAPbobsCOM.BoObjectTypes.oInvoices
 objDoc.CardCode = objDTHeader.Rows(intI).Item("CardCode")
                    objDoc.HandWritten = SAPbobsCOM.BoYesNoEnum.tNO
                    objDoc.DocDate = objDTHeader.Rows(intI).Item("DocDate")
                    objDoc.DocDueDate = DateAdd(DateInterval.Day, 30, objDTHeader.Rows(intI).Item("DocDate"))
                    objDoc.DiscountPercent = objDTHeader.Rows(intI).Item("Discount_Percent")
                    objDoc.Series = 39
 objDoc.Lines.Add()
lngStatus = objDoc.Add

I am able to enter all details except freight.How do I enter freight ?

Accepted Solutions (1)

Accepted Solutions (1)

Nussi
Active Contributor
0 Kudos

Hi,

you access the freight in a document with

oDoc.Expenses.ExpenseCode (Mandatory)

look in the DIAPI documentation for all properties.

lg David

Former Member
0 Kudos

David,

Freight is saved in table INV3.The field name is LineTotal.So I tried u r code as,

objDoc.Expenses.LineTotal = objDTHeader.Rows(intI).Item("Freight")

But it gave error as ,

Internal error (-5002) occurred

Former Member
0 Kudos

Vasu,

I tried u r code as,

objDoc.Lines.SetCurrentLine(0)

objDoc.Lines.Expenses.LineTotal = objDTHeader.Rows(intI).Item("Freight")

But Freight was not set.It did not gave any error.

Former Member
0 Kudos

Hi,

As david said 1st u need to set the ExpnsCode, its as follows,

oInvoice.Lines.Expenses.ExpenseCode = intFreightCode
 oInvoice.Lines.Expenses.LineTotal = 100

Hope it helps,

Vasu Natari.

Former Member
0 Kudos

Vasu,

I have solved the problem.I have used the following code-

objDoc.Expenses.ExpenseCode = 2

objDoc.Expenses.TaxCode = "CST_00_M"

objDoc.Expenses.LineTotal = objDTHeader.Rows(intI).Item("Freight")

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi,

U need to use the Lines.Expenses to add the frieght charges, its as follows,

objDoc.Lines.Expenses.LineTotal = 100

Just set the correct line before adding the expenses.

Hope it helps,

Vasu Natari.