Enterprise Resource Planning Blogs by Members
Gain new perspectives and knowledge about enterprise resource planning in blog posts from community members. Share your own comments and ERP insights today!
cancel
Showing results for 
Search instead for 
Did you mean: 
Former Member
0 Kudos
2,098

Hi Everybody!!

For those who need to deploy multiple counters in counting inventory documents using DI-API, here I leave a short code and implementation notes.

NOTE: Available for SBO 9.1 versión

        Dim oCS As SAPbobsCOM.CompanyService = oCompany.GetCompanyService()

        Dim oICS As SAPbobsCOM.InventoryCountingsService = oCS.GetBusinessService(SAPbobsCOM.ServiceTypes.InventoryCountingsService)

        Dim oICP As SAPbobsCOM.InventoryCountingParams = oICS.GetDataInterface(SAPbobsCOM.InventoryCountingsServiceDataInterfaces.icsInventoryCountingParams)

        '//Counting Document DocEntry

        oICP.DocumentEntry = Convert.ToInt64(txtDoc.Text.ToString)

        '//Get the Counting Document

        Dim oIC As SAPbobsCOM.InventoryCounting = oICS.Get(oICP)

        '//If Document is Multiple Counters Type

        If oIC.CountingType = SAPbobsCOM.CountingTypeEnum.ctMultipleCounters = True Then

            Dim oICLS As SAPbobsCOM.InventoryCountingLines = oIC.InventoryCountingLines

            Dim oICL As SAPbobsCOM.InventoryCountingLine

            Dim iLine As Integer = 0

            Dim iCurrentCounter As Integer

            '//Set the Counter User

            '//oICL.CounterID = 1 for manager // (OUSR.USERID) or oCompany.UserSignature for DI loged user

            iCurrentCounter = oCompany.UserSignature

            '*****************************************************

            'NOTE: When Document is Multiple Counters Type

            '      oICLS.Count = (Count of Lines * Users Counters)

            '*****************************************************

            For i As Integer = 0 To oICLS.Count - 1

                '//Set the Line of Counting

                oICL = oICLS.Item(i)

                '//Evaluate the Counter User for not repeat user line

                If oICL.CounterID = iCurrentCounter Then

                    oICL.Counted = BoYesNoEnum.tNO

                    '//Implement here the same code used for Single Counter Type

                    '//...

                    '//...

                End If

            Next

        End If

        Try

            oICS.Update(oIC)

            MessageBox.Show("Counting document updated!")

        Catch ex As Exception

            Dim ierr As Integer

            Dim serr As String

            oCompany.GetLastError(ierr, serr)

            MessageBox.Show(serr)

        End Try

Best Regards,

Emilio

1 Comment
yair_loera
Explorer
0 Kudos
Hi, is this method just to perform updates to a redial or also works to create zeros a count?
Labels in this area