Skip to Content
author's profile photo Former Member
Former Member

SAP 9 PL09 Inventory Posting

According to the release notes, the inventory counting object already released. When i upgrade the DI to PL09. It seems that the new object is not ready to use. Any idea?

Getting invalid cast object type error.

Dim oDocument As SAPbobsCOM.InventoryCounting = oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oInventoryGenEntry)

Add a comment
10|10000 characters needed characters exceeded

Related questions

1 Answer

  • Best Answer
    Posted on Feb 17, 2014 at 07:49 AM

    Hi Yuyu,

    Use these codes to add the inventory posting :

    Public Shared Sub CreateInvPosting()
    Try
    Dim oCS As SAPbobsCOM.CompanyService = oCompany.GetCompanyService()
    Dim oIPS As SAPbobsCOM.InventoryPostingsService = oCS.GetBusinessService(ServiceTypes.InventoryPostingsService)
    Dim oIP As SAPbobsCOM.InventoryPosting = TryCast(oIPS.GetDataInterface(InventoryPostingsServiceDataInterfaces.ipsInventoryPosting), SAPbobsCOM.InventoryPosting)
    
    oIP.CountDate = DateTime.Now
    
    Dim oIPLS As SAPbobsCOM.InventoryPostingLines = oIP.InventoryPostingLines
    Dim oIPL As SAPbobsCOM.InventoryPostingLine = oIPLS.Add()
    
    'Manually add items
    oIPL.ItemCode = "00111520102Y"
    oIPL.CountedQuantity = 4
    oIPL.WarehouseCode = "1"
    
    'based on Inventory Counting object
    oIPL = oIPLS.Add()
    oIPL.BaseType = 1470000065
    oIPL.BaseEntry = 1
    oIPL.BaseLine = 1
    
    
    Dim oIPP As SAPbobsCOM.InventoryPostingParams = oIPS.Add(oIP)
    Dim iDocEntry As Integer = oIPP.DocumentEntry
    Catch Ex As Exception
    MessageBox.Show(Ex.Message)
    End Try
    End Sub
    

    Regards

    Edy

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.