Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Problem in document number auto generation

Dear All,

I have created a screen in this screen,i want to generate a auto generate number

for that i have write a code but when am executing the program in VS2005,the form was loaded in SAPB1 2005,But am not getting the auto generate number in the particular coloumn.

It shows an error like pbject reference not set to an instance of an object

the code is,

Private Sub DCNumber()

Try

oForm = SBO_Application.Forms.Item("FormEditor")

Dim oRs As SAPbobsCOM.Recordset

oRs = ocompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset)

oRs.DoQuery("Select DocNum IS NULL THEN '1' ELSE DocNum+1 from @SCDC")

Dim Auto As String = oRs.Fields.Item(0).Value

oForm.Freeze(True)

oForm.Items.Item("25").Specific.Value = Auto

oForm.Freeze(False)

Catch ex As Exception

SBO_Application.StatusBar.SetText(ex.Message)

End Try

End Sub

I call this function in,

Public Sub New()

MyBase.New()

SetApplication()

' Load the Tab Order form

LoadFromXML("SCDC.srf")

oForm = SBO_Application.Forms.Item("FormEditor")

oForm.Visible = True

DCNumber()

End Sub

Former Member
Not what you were looking for? View more on this topic or Ask a question