SAP Knowledge Base Article - Public

1817212 - Column headers repeats for each row of data when exporting a report to CSV from Crystal Reports

Symptom

  • Column Headers repeats on each row.
  • Page Header text appears on each line.
  • All headers are populated before the data in the row.
  • Column Headers appears on each row when exporting a report to Character Separated Values (CSV) from Crystal Reports.
  • When exporting a report to CSV format, the page header and group header appear at the beginning of each record, instead of just once at the beginning of the CSV file.
  • How to display the column header only once when exporting to CSV from Crystal Reports?
      
       
  • Note: Images and data in this SAP Knowledge Base Article is from SAP internal systems, sample data, or demo systems. Any resemblance to real data is purely coincidental.

Environment

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

Reproducing the Issue

  1. In Crystal Reports, create a report of any data source.
      
  2. Add a couple of columns to the report.
         
  3. Export the report to CSV format, and notice the column header appears on each row.
        
    For example, if we have a report displaying 3 columns like:
      
    Product   Quantity    Ship Date
    Bicycle           1           2014/03/01
    Scooter          5           2014/12/04
    Skateboard    2            2014/05/01

    When exporting the report to CSV format, it duplicate the headers data for each row like:

    "Product","Quantity","Ship Date", "Bicycle", 1, "2014/03/01"
    "Product","Quantity","Ship Date", "Scooter", 5, "2014/12/04"
    "Product","Quantity","Ship Date", "Skateboard", 2, "2014/05/01"

    But the expectation is to see the header row only once in the CSV file like:
     
    "Product","Quantity","Ship Date"
    "Bicycle", 1, "2014/03/01"
    "Scooter", 5, "2014/12/04"
    "Skateboard", 2, "2014/05/01"

Cause

  • By design, when exporting to CSV format, it exports all the text and data that appears in the Report Headers, Page Headers, and Group Header for each row of data.

Resolution

  • To export the column headers inserted in the Page Header only once to CSV format, check the option "Isolate Report/Page sections"
         
    1. Open the report in Crystal Reports designer.
        
    2. Under the menu "File", select "Export - Export Report"
        
    3. In the "Export" window, select the format "Separated Values (CSV)", and click "OK"
        
    4. In the "Separated Values Export Options" window, check the option "Isolate Report/Page sections"
        
       CSV - Options - 1.png 
        
       
    5. Click "OK" to export the report.
       
      The column headers located in the Page Header section will now only export once.
          
           
         
  • Notes: 
    • When exporting a report to CSV format from SAP BI LaunchPad, there is no options to change how the report is exported. If you want the report to always use specific options when exported to CSV, set the default export CSV options on the report, and the report will export using those options from SAP BI LaunchPad. For steps on how to set the default export options for a report, see the SAP Knowledge Base Article: 2775495
          
    • From Crystal Reports XI R2, the above export options to CSV were added to control how the Report Header, Page Header and Group Header will export to CSV.

 

Keywords

Header, Crystal, Formatting, export, missing , KBA , BI-RA-CR , Crystal Reports designer or Business View Manager , Problem

Product

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