Skip to Content

Saving a Business One Crystal layout into PDF programmatically

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?

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • 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
                oCompany.GetCompanyService.SaveBlobToFile(oBlobParams)
    
        End Sub
    

    Regards

    Edy

    Add comment
    10|10000 characters needed characters exceeded