Skip to Content
0
Former Member
Jan 05, 2011 at 08:03 AM

Problem in Automatic Document Numbering

215 Views

Hi !!!

I have created a User Defined Form in Screen Painter. I have Bind one field of this form with a UDF of my UDT. That UDF is similar to Document number in marketing documents. I want to increment automatically that number after user adds the data of that form. How to do that??? I have written a code but it is not working......

 

 Private Sub SBO_Application_FormDataEvent(ByRef BusinessObjectInfo As SAPbouiCOM.BusinessObjectInfo, ByRef BubbleEvent As Boolean) Handles SBO_Application.FormDataEvent

        Try
            If (BusinessObjectInfo.BeforeAction = True) Then 'Before Event
                'Dim form As SAPbouiCOM.Form = SBO_Application.Forms.Item(BusinessObjectInfo.FormUID)
                'docentry = CType(form.Items.Item("Num").Specific.value, Integer)
                Return
            Else 'After event
                Dim form As SAPbouiCOM.Form = SBO_Application.Forms.Item(BusinessObjectInfo.FormUID)
                bisObj = form.BusinessObject
                Dim uid As String = bisObj.Key
               
                If bisObj.Type = "CSID" And SAPbouiCOM.BoEventTypes.et_FORM_DATA_ADD Then
                    CallerForm.Items.Item("DocNum").Specific.Value=bisObj.GetNextSerialNumber("Primary", "CSID")
                End If
            End If
        Catch ex as exception
        End Try
End Sub

Above code is not throwing any exception at the time of execution but the field "DocNum" of form is empty..

If any body has some solution then please help me.......