📚 SAP Business One SDK Help

GetPeriod Method
See Also  Example
pIPeriodCategoryParams
Period category key parameters input.

Description

Returns the PeriodCategory data structure according to the specified period category key parameters.

Syntax

Visual Basic
Public Function GetPeriod( _
   ByVal pIPeriodCategoryParams As PeriodCategoryParams _
) As PeriodCategory

Parameters

pIPeriodCategoryParams
Period category key parameters input.

Example

The following is a VB.NET sample that retrieves the period categories by its parameters.
GetPeriod (Visual Basic)Copy Code
Dim oCompanyService As SAPbobsCOM.CompanyService
Dim oPeriodCategoryColl As PeriodCategoryParamsCollection
Dim oPerCategory As PeriodCategory
Dim oFinancePeriods As FinancePeriods
Dim oFinancePeriod As FinancePeriod
Dim i As Integer
Dim j As Integer

'get company service
oCompanyService = oCompany.GetCompanyService

'get Period Category Collection
oPeriodCategoryColl = oCompanyService.GetPeriods

'print all periods
For i = 0 To oPeriodCategoryColl.Count - 1
   'get period category
    oPerCategory = oCompanyService.GetPeriod(oPeriodCategoryColl.Item(i))
    'print period category name
    Debug.WriteLine(oPerCategory.PeriodName)

    'get all finance periods (if the sub period isn't a year then it
    'has more than one finance period, for example sub period month has 12 finance periods)
    oFinancePeriods = oCompanyService.GetFinancePeriods(oPeriodCategoryColl.Item(i))

    For j = 0 To oFinancePeriods.Count - 1
        'get finance period
        oFinancePeriod = oFinancePeriods.Item(j)
        'print the period name
        Debug.WriteLine(oFinancePeriod.PeriodName)
    Next j

Next i

See Also