cancel
Showing results for 
Search instead for 
Did you mean: 

How to get next series number for user form?

Former Member
0 Kudos

Hi,

I am using UDO for my form with Manage series inorder to maintain automatic documnet number.

Like sales order screen if u open the form it should display with next generated document number.

In my form it is not displaying the next number

I want to display primary as selected and next series number.Please help me.

I have used the following code

If (FormUID = "FM_PURCHASEINDENT") And (pVal.ItemUID = "SerName") Then

If (pVal.EventType = SAPbouiCOM.BoEventTypes.et_COMBO_SELECT) And (pVal.Before_Action = True) Then

Dim oForm As SAPbouiCOM.Form

Dim oComboBox As SAPbouiCOM.ComboBox

Dim oEditText As SAPbouiCOM.EditText

Dim str As String

Dim lNum As Long

oForm = SBO_Application.Forms.Item(FormUID)

oComboBox = oForm.Items.Item("SerName").Specific

str = oComboBox.Selected.Value

'SBO_Application.MessageBox("Selected Series: " & str)

'// The following method provides the next value of the series

lNum = oForm.BusinessObject.GetNextSeriesNumber(CLng(str))

oEditText = oForm.Items.Item("SrValue").Specific

oEditText.String = lNum

oForm.Update()

End If

End If

Regards

Jambu

Accepted Solutions (1)

Accepted Solutions (1)

alex_ucerogarcia
Explorer
0 Kudos

Hi,

This is a little example for UDO with series (www.expertone.es/ficheros/SIMPLE_UDO.rar)

Code in Vb6.0

<b>Public Sub Load_UDO(ByRef rsbo As SAPbouiCOM.Application)</b>
Dim oFormParams As SAPbouiCOM.FormCreationParams
Dim oForm As SAPbouiCOM.Form
Dim oCombo As SAPbouiCOM.ComboBox

   Set oFormParams = rsbo.CreateObject(cot_FormCreationParams)
   
   oFormParams.XmlData = DameXML(App.Path & "XMLEXO_UDO.srf")
   
   Set oForm = rsbo.Forms.AddEx(oFormParams)
   
   'Load series in combo
    Set oCombo = oForm.Items("EXO_CBO1").Specific    
    <b>oCombo.ValidValues.LoadSeries oForm.BusinessObject.Type, sf_Add</b>
    oCombo.Select 0, psk_Index
     RellenarNumDoc rsbo, oForm       
    oForm.Visible = True

End Sub

<b>Private Sub RellenarNumDoc(ByRef rsbo As SAPbouiCOM.Application, ByRef rForm As SAPbouiCOM.Form)</b>
    
    With rForm.DataSources.DBDataSources("@EXO_OUDO")
        .SetValue "DocNum", .Offset, CStr(rForm.BusinessObject.GetNextSerialNumber(rForm.Items("EXO_CBO1").Specific.Selected.Description))
    End With
    
End Sub

Private Function DameXML(ByVal vsRuta As String) As String
Dim xmlDoc As New MSXML2.DOMDocument

   xmlDoc.Load vsRuta
   DameXML = xmlDoc.xml

End Function

Answers (0)