Technology Blogs by SAP
Learn how to extend and personalize SAP applications. Follow the SAP technology blog for insights into SAP BTP, ABAP, SAP Analytics Cloud, SAP HANA, and more.
cancel
Showing results for 
Search instead for 
Did you mean: 
former_member200290
Contributor
0 Kudos

I love getting interesting questions thrown my way, it gives me the opportunity to not only learn something new, but also find out what Crystal Reports users are trying to do, and just how functional Crystal Reports is.

The question that crossed my path a couple of times is one that has been showing up in our forums, how to build reports off of the Entity Data Model (EDM) Framework.

Not having any idea what this was or why one would want to use it I did some searching and came across this web site that had a great introduction to this http://www.devx.com/codemag/Article/36133/0/page/1

I followed this just to the point where I could display the Northwind Customers table in a datagrid. Then I went and tried to create a report off of the EDM Customers table, and it was amazingly easy to do.

I am going to assume when you are reading this you already have your EDM already created, if you haven't and don't know where to begin, I suggest the link above.

To report off of this is two steps, first you have to create the report:

  1. Right-Click your project and select Add New Item.
  2. Under Reporting select Crystal Report and click Add.
  3. Click OK to use the Report Wizard.
  4. Expand Project Data
  5. Expand .NET Objects
  6. You should now see a list of your available tables in your EDM
  7. Select a table and add it, in my case I selected Customers
  8. Click Next and continue to go through the wizard.

The second thing you need to do is set datasource at runtime. This is simple as creating an instance of your EDM in code, and calling the report's SetDataSource method like this:

 

//===============================

// Create an instance of the Customers table
            EntityModel.Customers emCustomers = new Customers();

            // Create and instatiate strongly-typed report
            CrystalReport1 MyCrystalReport1 = new CrystalReport1();

            // Set the report's datasource to my EDM and then view
            MyCrystalReport1.SetDataSource(emCustomers);
crystalReportViewer1.ReportSource = cr;

//===============================

As you can see this is fairly simple to do.

Happy Reporting!

1 Comment