Showing results for 
Search instead for 
Did you mean: 

Adding a purchase order document in 2005

Former Member
0 Kudos


I am trying to add a purchase order via DIAPI in version 2005 and I've paste the code I had in version 2004. The purchase order is added correctly but there is a problem in the lines...

The data I introduce in the line is the same as when doing it manually, this is, ItemCode, quantity and price, but the problem is that it doesn't calculate the linetotal and neither the doctotal.

Why is this?

My code for the line data is the next :

Private Sub AddLine(ByVal ItemCode As String, ByVal Quantity As String, ByRef oPedidoLineas As Document_Lines, ByVal oCompany As SAPbobsCOM.Company, Optional ByVal Price As Double = -1)
       oPedidoLineas.ItemCode = ItemCode
        oPedidoLineas.Quantity = Quantity
        If Price = -1 Then
            oPedidoLineas.Price = SearchPrice(ItemCode, oCompany)
            oPedidoLineas.Price = Price
        End If
    End Sub



Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Vane,

What happens if you try to post a normal purchase order without any sub procedures and straight forward two line purchase order? You should try this to establish that the error is not in your code.

Hope it helps,


Answers (0)