cancel
Showing results for 
Search instead for 
Did you mean: 

how to get item's cost price?

Former Member
0 Kudos

I want to get Item's cost price. I get a business boject 'item',g_oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oItems),There are two key to decide one cost price,one is 'itemcode',another is 'whscode',How to get one record by using 'GetByKey' method? Thanks.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Lu Xilin,

I suggest you use the recordset of SAP to query your way to the pricelist. Hope this helps.

former_member184566
Active Contributor
0 Kudos

Hi Lu Xilin

Which cost price are you refering to, do you want the one in item master? If so use a query like Gilbert Ngo suggested. But if you want a cost price for a specific item on a specific document/transaction at that time, then look at oinm.

Hope this helps

Former Member
0 Kudos

Hi Lu,

You can get the price in the warehouse as following if you don't want to use a recordset:

        Dim oItem As SAPbobsCOM.Items
        Dim dPrice As Double
        Dim i As Integer
        oItem = oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oItems)
        oItem.GetByKey("MyItem")
        For i = 0 To oItem.WhsInfo.Count - 1
            oItem.WhsInfo.SetCurrentLine(i)
            If oItem.WhsInfo.WarehouseCode = "TheWarehouseIWant" Then
                dPrice = oItem.WhsInfo.StandardAveragePrice
            End If
        Next

Hope it helps,

Adele

Former Member
0 Kudos

Hi,Adele

Thanks for your opinion,But it cann't get value. Have you test these codes?I have finished this function by using recordset.

Best Regards

lu

Former Member
0 Kudos

Hi Lu,

I have used that exact code and tested if I get a value back and it works perfect on my side.

Adele

Former Member
0 Kudos

Hi,Adele

I find a bug in my code after checking my source code.It is ok. Thanks very much.

Lu

Answers (0)