📚 SAP Business One SDK Help

LoadSeries Method
See Also  Example
ObjectType
The unique ID of a UDO. The IDs of the series of this UDO are loaded into the valid values.
Mode
Specifies which series to load

Description

Loads into the valid values a list of the IDs of the series attached to a specific UDO.

The UDO must have been created with the Manage Series service, and one or more series must be connected to the UDO. To check the series connected to a UDO, go to Administration --> System Initialization --> Document Numbering. An entry exists for each UDO with Manage Series.

Syntax

Visual Basic
Public Sub LoadSeries( _
   ByVal ObjectType As String, _
   ByVal Mode As BoSeriesMode _
) 

Parameters

ObjectType
The unique ID of a UDO. The IDs of the series of this UDO are loaded into the valid values.
Mode
ValueDescription
sf_AddAll series in the current period that are open for new documents and for which the user has permission to add new documents
sf_ViewAll series in all periods defined in the system
Specifies which series to load

Remarks

You can use BusinessObject.GetNextSerialNumber to get the next number in the series.

Example

Letting user select series for UDO (Visual Basic)Copy Code
Dim f As SAPbouiCOM.Form
Dim oItem As SAPbouiCOM.Item
Dim oCB As SAPbouiCOM.ComboBox
Dim oEdit As SAPbouiCOM.EditText

Dim cp As SAPbouiCOM.FormCreationParams
cp = SBO_Application.CreateObject(SAPbouiCOM.BoCreatableObjectType.cot_FormCreationParams)

cp.FormType = "myForm"
cp.ObjectType = "TestUDO"
cp.UniqueID = "myFormID"

Try
    f = SBO_Application.Forms.AddEx(cp)
Catch ex As Exception
    f = SBO_Application.Forms.GetForm("FrmMeal", 1)
    f.Visible = True
End Try

' Defining form dimentions
f.ClientWidth = 370
f.ClientHeight = 300

''''''''''''''''''''''''''''''''''''''''''''''
' Add edit box (DocNum) and combo box (Series)
''''''''''''''''''''''''''''''''''''''''''''''
' Edit box for DocNum
oItem = f.Items.Add("txtDocNum", SAPbouiCOM.BoFormItemTypes.it_EDIT)
oItem.Left = 200
oItem.Top = 10
oItem.AffectsFormMode = True
oEdit = oItem.Specific
oEdit.DataBind.SetBound(True, "@Test", "DocNum")

' Combo box for selecting series
oItem = f.Items.Add("cmbMyField", SAPbouiCOM.BoFormItemTypes.it_COMBO_BOX)
oItem.Left = 60
oItem.Top = 50
oItem.AffectsFormMode = True
oCB = oItem.Specific
oCB.DataBind.SetBound(True, "@Test", "Series")
oCB.ValidValues.LoadSeries("TestUDO", SAPbouiCOM.BoSeriesMode.sf_Add)

' Add the Ok/Add/Update button
oItem = f.Items.Add("1", SAPbouiCOM.BoFormItemTypes.it_BUTTON)
oItem.Left = 10
oItem.Top = 270

' Add the cancel button
oItem = f.Items.Add("2", SAPbouiCOM.BoFormItemTypes.it_BUTTON)
oItem.Left = 90
oItem.Top = 270

'--------------------------------------------------------
'
'**********************************************************
' Add event handler for when user selects series; set DocNum
Private Sub SBO_Application_ItemEvent(ByVal FormUID As String, ByRef pVal As SAPbouiCOM.ItemEvent, ByRef BubbleEvent As Boolean) Handles SBO_Application.ItemEvent

    If ((FormUID = "TestUDOID") And (pVal.ItemUID = "cmbMyField") And (pVal.EventType = SAPbouiCOM.BoEventTypes.et_COMBO_SELECT) And (pVal.Before_Action = False)) Then
            Dim lNum As Long
            Dim series As String
            Dim oForm As SAPbouiCOM.Form
            oForm = SBO_Application.Forms.Item(FormUID)

            Dim cmbo As SAPbouiCOM.ComboBox
            cmbo = oForm.Items.Item("cmbMyField").Specific
            series = cmbo.Selected.Value
            lNum = oForm.BusinessObject.GetNextSerialNumber(series)

            Dim oEditText As SAPbouiCOM.EditText
            oEditText = oForm.Items.Item("txtDocNum").Specific()
            oEditText.Value = lNum
    End If
End Sub

See Also