SAP Knowledge Base Article - Public

1215594 - How to set location from a Table to a Command Object in Crystal Reports?

Symptom

  • How to switch from a Table to a custom SQL Query?
  • How can you set the database location for a report from using a Table, to using a Command Object, in Crystal Reports?

Environment

  • SAP Crystal Reports 2013
  • SAP Crystal Reports 2016
  • SAP Crystal Reports 2020 

Resolution

  • To switch a report from using a Table, to using a Command Object, perform a Set Datasource location:        
    1. In Crystal Reports, open your report.

    2. Under the menu "Database", select "Set Datasource Location..."

    3. In "Set Datasource Location", under "Replace With", create a connection to the data source.

    4. Still in the section "Replace With", select under you data source connection: "Add Command"

    5. At the top, under "Current Data Source", select your Table.

    6. On the right side, click on "Update".

    7. It the window "Add Command To Report", enter the SQL Query for your report.

    8. Click "OK"

      If your SQL Query returns all the same database fields, then your report now is connecting to the same data source, but it is sending the custom SQL Query you have written. If the database fields name are different, you will have a mapping window that will prompt you to map the database fields.
        
    9. Back to the window "Set Datasource Location", click "Close"
        
    10.  Save your report.

Keywords

ADD COMMAND OBJECT SET LOCATION SQL QUERY DATABASE EXPERT REPOSITORY Crystal Reports Set location Command object Repository , c2012566 , KBA , BI-RA-CR , Crystal Reports designer or Business View Manager , How To

Product

SAP Crystal Reports 2013 ; SAP Crystal Reports 2016 ; SAP Crystal Reports 2020