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: 
JWiseman
Active Contributor
0 Kudos
2,475

Want to make your exsting reports (or reports that you will be creating) easier to adapt to any datasource? Want to make a report more portable or more like a template?

 

Many of you have crystal reports that are run off of tables and want to set these reports to a stored procedure. Or they are run off of a universe and want to set them to tables. Some of these datasource migration tasks can be difficult to accomplish.

 

Making a report portable or adaptable to any datasource involves replacing any fields on the report canvas (or any fields in summaries, condtional formatting, cross-tabs or charts) with formulas.  

 

 

 

Using the steps below will ensure that you are able to set your report to any datasource (tables, stored procedures, commands, universes, etc.) and ensure that none of your fields, summaries, charts or cross-tabs drop off of the report or cause errors. 

 

This method is very handy if you are also designing a report where the database structure is frequenty changing or hasn't been built. You can even start building a report without any datasource.

 

A) If you have an existing report

 

If you have reports that you need to be more adaptable to a new datasource this can be a bit of work depending on how many fields you use. However, in many cases the extra work could prove worth it if you have hit a wall trying to change the datasource. 

 

1) in the Formula Workshop create a new formula for every field that you have on the report canvas...for example, if you have {Customer.Country} on the report canvas, create a formula called Country that has syntax of {Customer.Country}.



2) while still in the Formula Workshop do the above step for any fields that you will have on your charts and cross-tabs.



3) on your report canvas replace all of your fields with the applicable formulas.



4) on your report canvas edit all of your summaries to use the appicable formulas instead of the fields.



5) in your charts and cross-tabs replace all of your fields with formulas.

 

6) do the same for any conditional formulas on the report that use fields directly.

 

7) after you are done the above steps, close the Formula Workshop and ensure that you are in Design mode of crystal and not in preview mode...this will avoid a lot of records coming into the report or database errors when doing the steps below.

 

😎 you can now add the new database tables or stored procedure or universe or command to your report using the Database Expert wizard.



**** do not use the Set Datasource Location wizard...just add the new datasource to the report

**** do not remove the old datasource yet



😎 in the Formula Workshop edit all of your new formulas by replacing your old datasource fields with your new datasource fields.

 

9) replace any old database fields in your record or group or saved data selection formulas with your new database fields.



10) in the Field Explorer, double check that there are no old database fields with a check mark beside them...if there are, find out where they are...right click on them and use the Find In Formulas option if you are using a newer version of crystal reports.

 

B) If you are creating a new report


1) for any field that you want on the report canvas, create a formula that contains just the field. do not add any fields onto the report canvas, just the formulas. if you do not have a datasource yet, put a dummy value into the formula.


2) for any field that you want in a cross-tab or chart, create a formula that contains just the field or a dummy value.

 

3) you can still use fields directly in the selection filters as these are easy to replace when adding a new datasource to the report.

 

if you design all of your new reports using this method, you will make your reports more adaptable and more portable.

7 Comments