on 04-03-2013 10:41 AM
Hi,
I am working in migrating from CR11 to CR13 . I have created UFL (User function lib) in .Net.
Now some reports which have subreports in them dont work fine in case of ORACLE database. Things are working fine in case of SQL database in background.
Some more details are,
RPT file is developed with SQL.
This report works fine with SQL database.
Report has three subreports.
In case of ORACLE if there are no subreports then report is displayed properly.
I am using below code for Replace connection,
CrystalDecisions.ReportAppServer.ClientDoc.ISCDReportClientDocument reportClientDocument;
reportClientDocument = new CrystalDecisions.ReportAppServer.ReportClientDocumentWrapper();
reportClientDocument = rptDoc.ReportClientDocument;
reportClientDocument.DatabaseController.LogonEx(strDSN, strDatabaseName, strUserID, strPassword);
//Create the logon propertybag for the connection we wish to use
CrystalDecisions.ReportAppServer.DataDefModel.PropertyBag objlogonDetails = new CrystalDecisions.ReportAppServer.DataDefModel.PropertyBag();
//Create the QE (query engine) propertybag with the provider details and logon property bag.
CrystalDecisions.ReportAppServer.DataDefModel.PropertyBag objMainPropertyBag = new CrystalDecisions.ReportAppServer.DataDefModel.PropertyBag();
if (m_bSqlServer)
{
objMainPropertyBag.Add("Database DLL", "crdb_odbc.dll");
objMainPropertyBag.Add("QE_DatabaseName", strDatabaseName);
objMainPropertyBag.Add("QE_SQLDB", "True");
}
else
{
objMainPropertyBag.Add("Server", strDSN);
//objMainPropertyBag.Add("Database DLL", "crdb_oracle.dll");
objMainPropertyBag.Add("Database DLL", "crdb_ado.dll");
objMainPropertyBag.Add("QE_DatabaseName", strDatabaseName);
objMainPropertyBag.Add("QE_SQLDB", "False");
}
objMainPropertyBag.Add("QE_DatabaseType", "ODBC (RDO)");
objMainPropertyBag.Add("QE_LogonProperties", objlogonDetails);
objMainPropertyBag.Add("QE_ServerDescription", strDSN);
objMainPropertyBag.Add("SSO Enabled", "False");
objlogonDetails.Add("UseDSNProperties", true);
if (m_bSqlServer)
{
objlogonDetails.Add("PreQEDatabaseName", strDatabaseName);
objlogonDetails.Add("PreQEServerName", strDSN);
objlogonDetails.Add("Trusted_Connection", "False");
}
else
{
objlogonDetails.Add("DSN", strDSN);
objlogonDetails.Add("PreQEServerName", strDSN);
objlogonDetails.Add("Trusted_Connection", false);
objMainPropertyBag.Add("Owner", strUserID);
}
CrystalDecisions.ReportAppServer.DataDefModel.ConnectionInfo objNewConnInfo = new CrystalDecisions.ReportAppServer.DataDefModel.ConnectionInfo();
CrystalDecisions.ReportAppServer.DataDefModel.ConnectionInfo objOldConnInfo;
CrystalDecisions.ReportAppServer.DataDefModel.ConnectionInfos objOldConnInfos;
objOldConnInfos = reportClientDocument.DatabaseController.GetConnectionInfos();
for (int i = 0; i < objOldConnInfos.Count; i++)
{
objOldConnInfo = objOldConnInfos[i];
objNewConnInfo.Attributes = objMainPropertyBag;
objNewConnInfo.Password = strPassword;
objNewConnInfo.UserName = strUserID;
objNewConnInfo.Kind = CrystalDecisions.ReportAppServer.DataDefModel.CrConnectionInfoKindEnum.crConnectionInfoKindCRQE;
reportClientDocument.DatabaseController.ReplaceConnection(objOldConnInfo, objNewConnInfo, null, CrystalDecisions.ReportAppServer.DataDefModel.CrDBOptionsEnum.crDBOptionDoNotVerifyDB);
foreach (string strSubreportsName in reportClientDocument.SubreportController.GetSubreportNames())
{
CrystalDecisions.ReportAppServer.Controllers.ISCRSubreportClientDocument oSubReportClientDocument = reportClientDocument.SubreportController.GetSubreport(strSubreportsName);
oSubReportClientDocument.DatabaseController.LogonEx(strDSN, strDatabaseName, strUserID, strPassword);
oSubReportClientDocument.DatabaseController.ReplaceConnection(objOldConnInfo, objNewConnInfo, null, CrystalDecisions.ReportAppServer.DataDefModel.CrDBOptionsEnum.crDBOptionDoNotVerifyDB);
}
}
//For each table in main report
foreach (CrystalDecisions.ReportAppServer.DataDefModel.Table oTableOld in reportClientDocument.Database.Tables)
{
CrystalDecisions.ReportAppServer.DataDefModel.Table oTableNew = GetNewTable(oTableOld, objNewConnInfo, strDatabaseName);
reportClientDocument.DatabaseController.SetTableLocation(oTableOld, oTableNew);
oTableNew = null;
}
//For Subreports
foreach (string strSubreportsName in reportClientDocument.SubreportController.GetSubreportNames())
{
//Loop through each table in subreport database and set its new table
foreach (CrystalDecisions.ReportAppServer.DataDefModel.Table objTableOld in reportClientDocument.SubreportController.GetSubreportDatabase(strSubreportsName).Tables)
{
CrystalDecisions.ReportAppServer.Controllers.ISCRSubreportClientDocument oSubReportClientDocument = reportClientDocument.SubreportController.GetSubreport(strSubreportsName);
CrystalDecisions.ReportAppServer.DataDefModel.Table objTableNew = GetNewTable(objTableOld, objNewConnInfo, strDatabaseName);
reportClientDocument.SubreportController.SetTableLocation(strSubreportsName, objTableOld, objTableNew);
bool bVerify = oSubReportClientDocument.DatabaseController.VerifyTableConnectivity(objTableNew);
objTableNew = null;
}
}
reportClientDocument.VerifyDatabase();
When there are subreports in rpt file and when we use ORACLE in that case VerifyDatabase() function throws exception as "No error"
Thanks in advance.
Hello Nilesh
First, I'd like you to make sure you are using Service Pack 5 for CRVS:
http://scn.sap.com/docs/DOC-7824
If that does not help, foloow these steps:
1) Download an eval of CR 2011 from here:
http://www.sap.com/solutions/sapbusinessobjects/sme/freetrials/index.epx
2) Try to do the replacing of the connection in the designer. Can you make is work in the designer? If not, this may point you in a direction that may help (e.g.; db client, etc., etc.). If you are able to convert the report in the designer, save out the subreport as it's own rpt.
3) Download the code writing utility attached to KB 1553921
4) Open the saved out subreport in the code writing utility
5) Use that code in your app
- Ludek
Follow us on Twitter
Got Enhancement ideas? Try the SAP Idea Place
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Installed CR 2011.
Report gets displayed in case of SQL when connection is updated with ODBC (RDO).
For ORACLE connection needs to be done in Oracle Server.
I would like to add one thing,
This problem does not seems to be related to Subreports but is associated with "Stored Procedures". Reports associated with Store Procedure have this problem in case of ORACLE database.
Re:
This problem does not seems to be related to Subreports but is associated with "Stored Procedures".
See KBA 1203145 - How to apply log on information to an Oracle stored procedure at runtime
- Ludek
User | Count |
---|---|
91 | |
10 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.