📚 SAP Business One SDK Help

AddReportLayout Method
See Also  Example
pIReportLayout

The data for the new report/report layout.

Description

Adds a new report/report layout.

Syntax

Visual Basic
Public Function AddReportLayout( _
   ByVal pIReportLayout As ReportLayout _
) As ReportLayoutParams

Parameters

pIReportLayout

The data for the new report/report layout.

Return Type

Contains the key (DocCode) of the new report/report layout.

Remarks

For Crystal Reports, use this method to add a report (as a standalone report or as a report layout) by setting the fields Name, TypeCode, Author and Category of the ReportLayout object. Set Category to Crystal Reports and set TypeCode to either RCRI (for standalone report) or a document type (for report layouts).

For PLD report layouts, use this only to transfer report layouts from one company to another. When transferring a system layout, change the following properties before adding the layout to the destination company:

  • Author: Change from System to a different name. If left unchanged, an exception is thrown.
  • Editable: Change from NO to Yes to make the new layout editable.
  • Name: Give the report layout a new name.

Do not change any other properties.

Example

Adding a PLD report layout (Visual Basic)Copy Code
Dim oCmpSrv As SAPbobsCOM.CompanyService
Dim oReportLayoutService As ReportLayoutsService
Dim oReportLayout As ReportLayout
Dim oReportLayoutParam As ReportLayoutParams

'Get report layout service
oCmpSrv = oCompany.GetCompanyService
oReportLayoutService = oCmpSrv.GetBusinessService(ServiceTypes.ReportLayoutsService)

'Set parameters
oReportLayoutParam = oReportLayoutService.GetDataInterface(ReportLayoutsServiceDataInterfaces.rlsdiReportLayoutParams)
oReportLayoutParam.LayoutCode = "POR20002"

'Get report layout
oReportLayout = oReportLayoutService.GetReportLayout(oReportLayoutParam)

'Add report layout
oReportLayoutService.AddReportLayout(oReportLayout)


See Also