Hi All! "Item no. is missing [INV1.ItemCode][line: 2]"
I have function to Insert A/R Invoice as follows:
Private Function Add_Invoice(ByVal TransCode As Double) As Boolean
Dim strShop As String = "C570004"
Dim oInv As SAPbobsCOM.Documents
oInv = oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oInvoices)
oInv.CardCode = strShop
oInv.DocDate = Now.Date
oInv.DocDueDate = Now.Date
oInv.Comments = "From POS System - With Transaction Code " & TransCode
Dim disc As Double = 0
Dim WarehouseCode As String = "HCI001"
Dim VATGroup As String = "S10_CM"
For i_row As Integer = 0 To jsgxDetails.RowCount - 1
jsgxDetails.Row = i_row
oInv.Lines.SetCurrentLine(i_row)
oInv.Lines.ItemCode = jsgxDetails.GetValue("Item_Code")
oInv.Lines.ItemDescription = jsgxDetails.GetValue("Item_Name")
oInv.Lines.UnitPrice = jsgxDetails.GetValue("Item_Price")
oInv.Lines.Quantity = jsgxDetails.GetValue("Item_Quantity")
oInv.Lines.DiscountPercent = disc
oInv.Lines.WarehouseCode = WarehouseCode
oInv.Lines.VatGroup = VATGroup
oInv.Lines.Add()
Next
lRetCode = oInv.Add()
If lRetCode <> 0 Then
oCompany.GetLastError(lErrCode, sErrMsg)
MessageBox.Show(sErrMsg)
Return False
else
Return true
end if
end function
But when I Add 1 item, It Appears error "Item no. is missing [INV1.ItemCode][line: 2]". Add 2 items appears "Item no. is missing [INV1.ItemCode][line: 3]". I don't know this bug. Help me to solve this problem. Thanks.