Skip to Content
0
May 14, 2018 at 06:16 AM

SAP Business One Crystal Reports - Visual Studio Issue

483 Views

Hi

I have installed the SAP Crystal Reports Runtime installation from the below link. I am getting error "Error while connecting to Crystal Runtime; check the installation". There is no issue SAP DI API Connectivity and It works fine. Please help.

https://wiki.scn.sap.com/wiki/display/BOBJ/Crystal+Reports%2C+Developer+for+Visual+Studio+Downloads (VS2017 - SP21 and higher)

My environment details are below

1. OS: Windows 10 Enterprise - 64 bit

2. Visual Studio 2017 Enterprise

3. .NET 3.5 SDK Installed

4. SAP Business One 9.2 PL 10 - 64 bit

5. SAP Business One DI API 9.2 PL 10

My Test Code is below

var conCreator = new ConnectionCreator();
            var conSAP = conCreator.GetDIConnection("test");
            try
            {
                var connResult = conSAP.Connect();
                if (connResult != 0)
                {                   
                    throw new InvalidOperationException(string.Format("(ConnectSap){0}-{1}",
                        conSAP.GetLastErrorCode(), conSAP.GetLastErrorDescription()));
                }
                SAPbobsCOM.ReportLayoutsService oReportLayoutService;
                SAPbobsCOM.ReportLayoutPrintParams oPrintParam = null;
                var companyService = conSAP.GetCompanyService();
                oReportLayoutService = (ReportLayoutsService)companyService.GetBusinessService(SAPbobsCOM.ServiceTypes.ReportLayoutsService);
                oPrintParam = (ReportLayoutPrintParams)oReportLayoutService.GetDataInterface(SAPbobsCOM.ReportLayoutsServiceDataInterfaces.rlsdiReportLayoutPrintParams);
                oPrintParam.LayoutCode = "INV2014";
                oPrintParam.DocEntry = 54723;
                oReportLayoutService.Print(oPrintParam);
            }
            finally
            {
                if (conSAP != null) conSAP.Disconnect();
                conSAP = null;                
            }