Skip to Content

Saving a Business One Crystal layout into PDF programmatically

Dec 01, 2017 at 05:06 PM


avatar image

Hello, all

Is it possible in SAP Business One programmatically to save a print layout into a PDF file?

If not, how to extract from the database the .rpt file corresponding to some print layout, as registered in the RDOC table?

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

1 Answer

Edy Simon Dec 02, 2017 at 08:32 AM

Hi Anton,

Looks like we can not export directly a crystal layout to PDF yet from SBO.
Below code to extract the crystal .rpt from the layout, you will then need to generate the report yourself and export to pdf

If you don't mind VB

    Public Sub GetCrystalReportFile(ByVal RDOCCode As String, ByVal outFileName As String)
            Dim oBlobParams As SAPbobsCOM.BlobParams = oCompany.GetCompanyService().GetDataInterface(SAPbobsCOM.CompanyServiceDataInterfaces.csdiBlobParams)
            oBlobParams.Table = "RDOC"
            oBlobParams.Field = "Template"
            Dim oKeySegment As SAPbobsCOM.BlobTableKeySegment = oBlobParams.BlobTableKeySegments.Add()
            oKeySegment.Name = "DocCode"
            oKeySegment.Value = RDOCCode '"INV20004" '

            oBlobParams.FileName = outFileName

    End Sub



10 |10000 characters needed characters left characters exceeded