📚 SAP Business One SDK Help

GetList Method
See Also  Example

Description

Returns the keys for all the rows in the main table for a specific UDO.

For example, if the UDO MealOrders was linked to the user-defined table @SM_OMOR table, and the service was instantiated for the MealOrders UDO, then this method would return the keys for all the rows in @SM_OMOR.

Syntax

Visual Basic
Public Function GetList() As GeneralCollectionParams

Return Type

A collection of GeneralDataParams objects is returned.

Each object contains the key for one row in the table. For example, for a UDO for a master data table, each object contains a property called Code whose value is the key of a row in the table.

Example

Getting list of all records (Visual Basic)Copy Code
Dim oGeneralService As SAPbobsCOM.GeneralService
Dim oGeneralData As SAPbobsCOM.GeneralData
Dim oGeneralParams As SAPbobsCOM.GeneralDataParams
Dim oGeneralList As SAPbobsCOM.GeneralCollectionParams
Dim lRet As Long

'Create handle to "MUSIC" UDO
oGeneralService = sCmp.GetGeneralService("MUSIC")

'Add first record
oGeneralData = oGeneralService.GetDataInterface(gsGeneralData)
oGeneralData.SetProperty("Code", "First")
oGeneralData.SetProperty("U_Data", "my data")
oGeneralService.Add(oGeneralData)

'Add second record
oGeneralData = oGeneralService.GetDataInterface(gsGeneralData)
oGeneralData.SetProperty("Code", "Second")
oGeneralData.SetProperty("U_Data", "my data")
oGeneralService.Add(oGeneralData)

'Get list of all records
oGeneralList = oGeneralService.GetList

See Also