on 12-17-2004 12:43 PM
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Maybe you've solved it by this time...
If I read your code correctly, you're always adding a line to the purch.doc. You're even adding one right at the end and then you're doing nothing with that one.
I suspect that you're adding a final, empty line in nthe last iteration of your loop.
If I recall correctly, the first lines-object does not have to be added, but every next one does need to be added before entering values into it.
Hth,
Jacques
User | Count |
---|---|
108 | |
12 | |
11 | |
6 | |
5 | |
4 | |
3 | |
3 | |
3 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.