Hi,
I tried to add Purchase order line items to POR1 table.
It shows "[POR1] , 'Error (-1004) encountered.'" This is my code below. Please help
Dim oPurchaseLine As SAPbobsCOM.Document_Lines
oPurchaseLine = pCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oPurchaseOrders)
For j = 1 To oMatrix1.VisualRowCount
oMatrix1.GetLineData(j)
If sCode = oForm.DataSources.UserDataSources.Item("us_col11").Value Then
oPurchaseLine.Lines.BaseEntry = nDocNum
oPurchaseLine.Lines.BaseLine = k
oPurchaseLine.Lines.BaseType = 22
oPurchaseLine.Lines.ItemCode = oForm.DataSources.UserDataSources.Item("us_col13").Value
sQuery = " select itemname from oitm where itemcode ='" & oForm.DataSources.UserDataSources.Item("us_col13").Value & "'"
rs.DoQuery(sQuery)
If Not rs.EoF Then
oPurchaseLine.Lines.ItemDescription = rs.Fields.Item("itemname").Value
End If
oPurchaseLine.Lines.Quantity = oForm.DataSources.UserDataSources.Item("us_col14").Value
oPurchaseLine.Lines.Price = oForm.DataSources.UserDataSources.Item("us_col14").Value
oPurchaseLine.Lines.Add()
k = k + 1
End If
Next
Hi,
A small correction in my code..
I tried to add Purchase order line items to POR1 table.
It shows "[POR1] , 'Error (-1004) encountered.'" This is my code below. Is it correct?
Please help
Dim oPurchaseLine As SAPbobsCOM.Document
oPurchaseLine = pCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oPurchaseOrders)
For j = 1 To oMatrix1.VisualRowCount
oMatrix1.GetLineData(j)
If sCode = oForm.DataSources.UserDataSources.Item("us_col11").Value Then
oPurchaseLine.Lines.BaseEntry = nDocNum
oPurchaseLine.Lines.BaseLine = k
oPurchaseLine.Lines.BaseType = 22
oPurchaseLine.Lines.ItemCode = oForm.DataSources.UserDataSources.Item("us_col13").Value
sQuery = " select itemname from oitm where itemcode ='" & oForm.DataSources.UserDataSources.Item("us_col13").Value & "'"
rs.DoQuery(sQuery)
If Not rs.EoF Then
oPurchaseLine.Lines.ItemDescription = rs.Fields.Item("itemname").Value
End If
oPurchaseLine.Lines.Quantity = oForm.DataSources.UserDataSources.Item("us_col14").Value
oPurchaseLine.Lines.Price = oForm.DataSources.UserDataSources.Item("us_col14").Value
oPurchaseLine.Lines.Add()
k = k + 1
End If
Next
Add a comment