📚 SAP Business One SDK Help

AddProfitCenter Method
See Also  Example
pIProfitCenter
The data for the new profit center.

Description

Adds a profit center.

Syntax

Visual Basic
Public Function AddProfitCenter( _
   ByVal pIProfitCenter As ProfitCenter _
) As ProfitCenterParams

Parameters

pIProfitCenter
The data for the new profit center.

Return Type

Contains the key (PrcCode) of the new profit center.

Remarks

When you add a profit center, a distribution rule is automatically created with the same name and one line. The rule distributes the cost or expense 100 percent to the profit center, and the rule cannot be changed.

Example

Adding a profit center (Visual Basic)Copy Code
oCmpSrv = oCompany.GetCompanyService()

Dim oPCService As SAPbobsCOM.IProfitCentersService
Dim oPC As SAPbobsCOM.IProfitCenter
Dim oPCParams As SAPbobsCOM.IProfitCenterParams
Dim oPCsParams As SAPbobsCOM.IProfitCentersParams

oPCService = oCmpSrv.GetBusinessService(SAPbobsCOM.ServiceTypes.ProfitCentersService)
oPCParams = oPCService.GetDataInterface(SAPbobsCOM.DimensionsServiceDataInterfaces.dsDimensionParams)

oPC = oPCService.GetDataInterface(SAPbobsCOM.ProfitCentersServiceDataInterfaces.pcsProfitCenter)
oPC.CenterCode = "code"
oPC.CenterName = "name"
oPC.GroupCode = "GRP"
oPC.InWhichDimension = 1
oPCParams = oPCService.AddProfitCenter(oPC)
oStr = oPCParams.CenterCode

See Also