1
votes

What I'm trying to accomplish is to find out what views are actually used by a large collection of reports (5,000 or so). To help me do that:

Can someone show C# or VB code to get list the tables in a .rpt file?

These reports have been created mostly under CR XI, some under 2011.

These reports are also under SAP Central Management Console. But I don't see that that gives me anything in interactive use. If there's a programmatic way to get the tables from Management Console, I'd be interested in that too.

3

3 Answers

5
votes

Thanks Lee and Craig, but I'm going to answer my own question ... using Intellisense Oriented Design I found:

References

 CrystalDecisions.CrystalReports.Engine
 CrystalDecisions.Data.AdoDotNetInterop
 CrystalDecisions.Shared


 CrystalDecisions.CrystalReports.Engine.ReportDocument doc;
 doc = new CrystalDecisions.CrystalReports.Engine.ReportDocument();
 doc.Load(@"C:\temp\mftrailers.rpt");
 foreach (CrystalDecisions.CrystalReports.Engine.Table t in doc.Database.Tables)
 {
    Console.WriteLine(t.Name);
 }

This was with 2008, I don't have a later VS to see if the libraries SAP is making nowadays have the same objects.

1
votes

Is this any good?: http://www.ml-consult.co.uk/cryst-07.htm

"CR Doc is a simple freeware program that lists all the database tables and fields used in one or more reports."