Skip to Content
0
Former Member
Mar 02, 2009 at 06:32 AM

Reconcile stock

43 Views

I want to update the stock of inventory.For this I am using the following code-

Public Function Stock()
        Dim objStock As SAPbobsCOM.StockTaking
        Dim objItem As SAPbobsCOM.Items
        Dim boolFlag As Boolean

        Try
            objStock = objCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oStockTakings)
            objStock.ItemCode = "ZM3970104"

            objItem = objCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oItems)
            objItem.ItemCode = "ZM3970104"
            boolFlag = objItem.GetByKey("ZM3970104")
            If boolFlag = True Then
                boolFlag = objStock.GetByKey("ZM3970104", "RMLO")
                If boolFlag = True Then
                    objStock.Counted = objItem.QuantityOnStock - 20
                    If objStock.Add() = 0 Then
                        SBO_Application.MessageBox("Stock  taken")
                    End If
                End If
            End If
        Catch ex As Exception
            SBO_Application.MessageBox(ex.Message)
        End Try
    End Function

When the above function executes I can find a entry in Stock posting i.e Inventory ->Inventory Transactions -> Initial Quantities,Inventory Tracking and Stock Posting.

I have to reconcile to update the stock of the item.I want to avoid this step.I want to reconcile the item throuch coding.