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()


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.Items.Item("25").Specific.Value = Auto


Catch ex As Exception


End Try

End Sub

I call this function in,

Public Sub New()



' Load the Tab Order form


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

oForm.Visible = True


End Sub

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