UAE: ✆+971 58 5616 616       USA: ✆+14099168409        ✉  info@insightcubes.com

SAP: Exporting To Excel, CSV, And PDF With SAP Analytics Designer

How to export reports to Excel, CSV, and PDF with SAP Analytics Designer

In this blog, we will be discussing how to export data in the widgets within the analytics application to Excel, CSV, and PDF. This method is the easiest and simplest to apply, and in a subsequent blog, we will be discussing an advanced method of exporting to Excel, CSV, and PDF that provides further options to end users to configure the content of the output.

For now, let’s get started with this easy and quick way to configure our exports.

Exporting reports with SAP analytics Designer
Export to Excel, PDF, and CSV with SAP Analytics Designer (SAC)

The first step is to configure the Export to Excel, Export to CSV, and Export to PDF in Scripting before writing Java script.

Export Scripting with SAP analytics Designer
Setting up Scripting for exporting reports with SAP Analytics Designer (SAC)

Then we configure the Properties for each of the export Scripting settings.

The below snippet is for the Export to Excel Properties. We name it ExportToExcel to use in java script later, designate an Exported File Name, in our case it is InsightCubes_Excel, then decide if we want to turn on the optionality to Include MetadataInclude Number Formatting, and Keep Hierarchy Indentation.

Export to Excel Properties SAP Analytics designer - SAP Analytics Cloud
Export to excel Scripting with SAP Analytics Designer (SAC)

We also need to select the Included Widgets in the Exported Excel file. In the snippet below we have one widget selected (Table).

Included Widgets for exporting to Excel with SAP Analytics designer - SAP Analytics Cloud
Included widgets when exporting to excel with SAP Analytics Designer (SAC)

Now we will add the Java script to the Export to Excel button on click event.

Export to Excel OnClick Button SAP Analytics Designer
Export to Excel with SAP Analytics Designer (SAC)


The below onclick event java script for Export to Excel starts by closing the menu (Line 1), then setting the export to Excel widget (Line 2) and populating a local variable member with the entered text in the input field named InputField_ExportExcelOptions_FileName (Line 3). In case the user did not enter any text in the input field (Line 4), we populate a fixed text named InsightCubes (Line 5), otherwise, if the user entered a text (Line 6), we set the file name as entered by the user and stored by the local variable called FileName (Line 7).

Last, the export to Excel is executed (Line 9), and an Application Message of Type Success is shown to the user (Line 10).

OnClick Java Script Export to Excel SAP Analytics Designer
Export to excel button on click fx JavaScript with SAP Analytics Designer (SAC)

The below snippet is for the Export to CSV Properties. We name it ExportToCSV to use in java script later. Select the data source for the exported CSV file, in our case it is the widget (Table). Designate an Exported File Name, in our case it is InsightCubes_CSV, then decide if we want to turn on the optionality to Include Number Formatting. Selecting the Scope either as a Point of View or All and whether to Flatten Data Hierarchy or not.

Export to CSV Properties SAP analytics Designer
Export to CSV Scripting with SAP Analytics Designer (SAC)

Now we will add the JavaScript to the Export to CSV button on click event.

Export to CSV button SAP Analytics Designer
Export to CSV with SAP Analytics Designer (SAC)

The below onclick event java script for Export to CSV starts by closing the menu (Line 1), then setting the export to CSV widget (Line 2) and populating a local variable member with the entered text in the input field named InputField_ExportCSVOptions_FileName (Line 3). In case the user did not enter any text in the input field (Line 4), we populate a fixed text named InsightCubes (Line 5), otherwise, if the user entered a text (Line 6), we set the file name as entered by the user and stored by the local variable called FileName (Line 7).

Last, the export to CSV is executed (Line 9), and an Application Message of Type Success is shown to the user (Line 10).

OnClick Java Script Export to CSV SAP Analytics Designer
Export to CSV button on click fx JavaScript with SAP Analytics Designer (SAC)

The below snippet is for the Export to PDF Properties. We name it ExportToPDF to use in javascript later. Choose the desired General Settings. In our case Orientation is LandscapePaper Size is A4Page Number Location is set to NoneExported File Name is InsightCubes_PDF. We have Enable export in the background checked, and the Display fully the exported widgets unchecked, this option enables printing the dashboard as a report (note only Tables are currently supported). Then we detail our Header SettingsFooter SettingsAppendix Settings, and Comment Settings.

Export to PDF Properties SAP analytics Designer
Export to PDF Scripting with SAP Analytics Designer (SAC)

We also need to select the widgets included in the Export to PDF. The Included Widgets for the Export to PDF Properties has a different approach than Export to Excel and CSV. You can select the specific details you want to show in the PDF, in our case we have all elements in the widgets selected.

Export to PDF Included widgets SAP analytics Designer
Included widgets when exporting to PDF with SAP Analytics Designer (SAC)

Now we will add the JavaScript to the Export to PDF button on click event.

Export to PDF button SAP Analytics Designer
Export to PDF with SAP Analytics Designer (SAC)

The below onclick event java script for Export to PDF starts by closing the menu (Line 1), then we set a condition as to whether the user clicked on Switch_FullTable or not, which in turn returns whether the export of all included tables in full length (report) is enabled when the analytic application is exported to a PDF file (Line 2 to 6). Then populating a local variable member with the entered text in the input field named Side_Export_PDF_FileName (Line 8). In case the user did not enter any text in the input field (Line 9), we populate a fixed text named InsightCubes (Line 10), otherwise, if the user entered a text (Line 11), we set the file name as entered by the user and stored by the local variable called FileName (Line 12).

Last, the export to PDF is executed (Line 15), and an Application Message of Type Success is shown to the user (Line 16).

OnClick Java Script Export to PDF SAP Analytics Designer
Export to PDF button on click fx JavaScript with SAP Analytics Designer (SAC)

Advanced Exporting of Reports

In this blog we will be discussing an advanced, and more detailed method of exporting data in the widgets within the analytics application to Excel, CSV and PDF that provides further options to end users to configure the content of the output. We discussed the simple way of exporting in another blog called Exporting Reports To Excel, CSV, And PDF With SAP Analytics Designer.

Now, lets get started with this more detailed and advanced way to configure our exports with advanced settings.

Upon clicking the Advanced Settings button from the “Export To” button, a popup with three tabs is visible:

  • PDF
  • Excel
  • CSV

We will be listing the components of each tab subsequently in detail.

The first tab is Export to PDF, including all the advanced options needed to export the report to a PDF file as needed. The advanced settings tab for PDF includes Exporting File Name, Orientation, Paper Size, Page Number location, Date location under General Settings. Header Text input field with an On/Off switch . Footer Text input field with an On/Off switch. Switch to allow or prohibit Comments. Appendix On/Off Switch and an Switch option to include the entire Table. Last is the Export to PDF button and we will be listing how to configure them in the same order shown in the snippet below.

Add this line of code to the “Exported File Name” input field onChange fx: ExportToPDF.setFileName(this.getValue());

You will find this input field referenced in two other locations, one in the Advanced Export to PDF button starting (Line 8), and one in the Utils._Model-onInit (Line 9). You will find them later in this blog.

Manually fill the Orientation dropdown as shown below

Then add the below code to the Dropdown onSelect fx

Manually input the Paper Sizes to the dropdown as shown below

Then add the below code to the onSelect fx event of the dropdown

Manually input the Page Number Location to the dropdown as shown below

And add the below code to the Page Number location dropdown onSelect fx

Manually input the locations for the date in the PDF to the dropdown Designer

Write the following code to the Date Location dropdown onSelect fx

Add the following code to the Header Text input field onChange fx

And the following to the Header switch onChange fx

Do the same for the Footer Text input field. Add this line of code to the Footer Text input field onChange fx: ExportToPDF.setFooterText(Footer_Input.getValue());

And this line to the Footer Text switch onChange fx: ExportToPDF.setFooterVisible(this.isOn());

Comment switch onChange fx: ExportToPDF.setCommentsVisible(this.isOn());

Appendix first switch onChange fx: ExportToPDF.setAppendixVisible(this.isOn());

Appendix Full Table switch onChange fx

As mentioned in the beginning of this PDF section we have to create a Script Object, call it Utils_Model and add a Script Function called “onInit”, with a Return Type: void. Without switching on Set as Array and no Arguments to set the Export file name for PDF (Line 9), Excel and CSV (Lines 8, 10) Exporting File name fx.

Refer to this snippet of the Script Object fx to set the FileName for Excel and CSV too, (Lines 8, 10)
Figure 1.1

Lastly for the PDF Export is the “Export to PDF” button. Add the following code to the buttons’ onClick fx, and you are ready to Export reports to PDF files.


The second tab is Export to Excel, including all the advanced options available in the backend of the Analytics Designer. These options can be used in the simple export method but are fixed and cant be changed on the run application. We have configured the settings to be available for users in the run application for an advanced end-level ease of use. The Export to Excel advanced settings tab includes Exported File Name, Include Table Metadata, Include Number Formatting, and Keep Hierarchical Indentation for the Data Labels switches and we will be listing how to configure them in the same order shown in the snippet below.

On the “Exported File Name” input field onChange fx add this line of code: ExportToExcel.setFileName(this.getValue());

Refer to Figure 1.1 for the other code needed to set the “FileName” in the “Utils_Model” “onInit” (Line 8). And on the “Advanced Export to Excel” button onClick fx starting (Line 3).

Add the following code to the “Include Table Metadata” Switch onChange fx: ExportToExcel.setAppendixIncluded(this.isOn());

The following to the “Include Number Formatting” Switch onChange fx: ExportToExcel.setExportFormattedValues(this.isOn());

Last add this code to the “Keep Hierarchal Indentation for the Data Labels” Switch onChange fx: ExportToExcel.setIndentedHierarchy(this.isOn());


The third tab is Export to CSV, like the export to Excel Tab it includes all the advanced options available in the backend of the Analytics Designer. These options can be used in the simple export method but are fixed and cant be changed on the run application. We have configured the settings to be available for users in the run application for an advanced end-level ease of use. The Export to CSV advanced settings tab includes Exported File Name, Scope, Include Number Formatting, and Show Hierarchal in separate columns switches and we will be listing how to configure them in the same order shown in the snippet below.

On the “Exported File Name” input field onChange fx add this line of code: ExportToCSV.setFileName(this.getValue());

Refer to Figure 1.1 for the other code needed to set the “FileName” in the “Utils_Model” “onInit” (Line 10). And on the “Advanced Export to CSV” button onClick fx starting (Line 3).

Add the following code to the “Scope” Dropdown onSelect fx

Figure 1.2

The following to the “Include Number Formatting” Switch onChange fx: ExportToCSV.setExportFormattedValues(this.isOn());

Last add this code to the “Show Hierarchy in Separate Columns” Switch onChange fx: ExportToCSV.setHierarchyLevelsInIndividualCells(this.isOn());

For the “Show Hierarchy in Separate Columns” Switch you will find two more lines of code (Line 4, and 8) on the Scope Dropdown onSelect fx called “DD_ExportCSVOptions_POV” in Figure 1.2.

Now you can export with SAP Analytics Designer.

Recent Posts

SAP Analytics Cloud Calendar

SAP Analytics Cloud Calendar Features and API’s Workflow Organization (Calendar) Use the SAP Analytics Cloud calendar to organize your workflows with calendar events: You can

SAP Analytics Cloud Data Connections

Live connection (Online) and Import connection (batch) with SAP Analytics Cloud SAP Analytics Cloud enables access to on-premise and cloud data sources using two main

Insightcubes Cloud Consolidation Extension for SAP Analytics Cloud – Landing Page

Landing Page Dashboard

InsightCubes’ SAP Analytics Cloud Consolidation Landing Page Dashboard is a navigational menu designed to provide easy access to all the Cloud Consolidation extension stories and

InsightCubes Consolidation Extension for SAP Analytics Cloud- Data Preparation

SAP Data Preparation

After the trial balances have been imported from source systems, for all the subsidiaries and affiliates, we can trigger the automated process of SAP data

Get in Touch

Learn more and ask us About Our Cloud Consolidation Solution

Share This Post

Share this Page!

Share this with your network.

Want to Know More?

Get In Touch

Something isn’t Clear?


Feel free to contact us, and we will be more than happy to answer all of your questions.