2051340 - Table alias names can't be changed after applying Service Pack 8

SAP Knowledge Base Article - Public

2051340 - Table alias names can't be changed after applying Service Pack 8

Symptom

  • Table alias names can't be changed after applying Service Pack 8

Environment

  • SAP Crystal Reports, developer version for Microsoft Visual Studio SP3
  • SAP Crystal Reports, developer version for Microsoft Visual Studio SP8, SP9 and SP10

Reproducing the Issue

  1. Execute the following C# code in SP7

e.g.
 
ReportDocument rptDoc = new ReportDocument();
rptDoc.Load("C:\testA.rpt");
foreach (CrystalDecisions.CrystalReports.Engine.Table tbl in rptDoc.Database.Tables)
{
   tbl.Location = tbl.Location.Replace("A", "B");
   tbl.ApplyLogOnInfo(tbl.LogOnInfo);
   tbl.LogOnInfo.TableName = tbl.LogOnInfo.TableName.Replace("A", "B");
   tbl.ApplyLogOnInfo(tbl.LogOnInfo);
}
rptDoc.SaveAs("C:\testB.rpt");
rptDoc.Close();

  1. Table alias names can be changed properly.
  2. After applying SP8 into the same runtime environment.
  3. Execute the same above code.
  4. Table alias names can't be changed.

Cause

The replace Alias feature is removed from SP8 due to regression.

It's by design that the Alias of table name must not be replaced via TableName.Replace function.

Resolution

Workaround: To use ModifyTableAlias of RAS SDK instead of TableName.Replace function.

e.g. (C#)

ReportDocument rptDoc = new ReportDocument();
rptDoc.Load("C:\\testA.rpt");
CrystalDecisions.ReportAppServer.ClientDoc.ISCDReportClientDocument rd = rptDoc.ReportClientDocument;
foreach (CrystalDecisions.ReportAppServer.DataDefModel.ISCRTable tbl in rd.Database.Tables)
{
       // Replace A with B
       rd.DatabaseController.ModifyTableAlias(tbl,"B");
}
string saveDirectory = "C:\\";
object saveDir = (object)saveDirectory;
rd.SaveAs("testB.rpt", ref saveDir, (int)CrystalDecisions.ReportAppServer.ClientDoc.CdReportClientDocumentSaveAsOptionsEnum.cdReportClientDocumentSaveAsOverwriteExisting);
rd.Close();

Keywords

cr, rpt, sdk, c#, c sharp, alias name, change data source, location, xml, merge module , KBA , BI-RA-CR-SDK , SDK related, including Java/.NET etc. , BI-DEV-NET , BI Software Development Kits (SDKs) - .NET or Other , Problem

Product

SAP Crystal Reports, developer version for Microsoft Visual Studio