+ All Categories
Home > Documents > Download Data From Web Ui to Excel and PPT - SAP CRM

Download Data From Web Ui to Excel and PPT - SAP CRM

Date post: 18-Jul-2016
Category:
Upload: kenguvatirupati
View: 108 times
Download: 3 times
Share this document with a friend
Description:
Download Data From Web Ui
6
11/13/2014 Download data from web ui to Excel and PPT - CRM - SCN Wiki http://wiki.scn.sap.com/wiki/display/CRM/Download+data+from+web+ui+to+Excel+and+PPT 1/6 Getting Started Newsletters Store Search the Community Welcome, Guest Login Register Products Services & Support About SCN Downloads Industries Training & Education Partnership Developer Center Lines of Business University Alliances Events & Webinars Innovation Added by ArunKumar Balakrishnan, last edited by Gregor Wolf on May 11, 2012 CRM / / CRM Web Client UI Framework Download data from web ui to Excel and PPT Link to Content's target Space : http://w iki.sdn.sap.com/w iki/display/CRM/CRM+Web+Client+UI+Framew ork Applies to: CRM 6.0/7.0 Summary Dow nload data from w eb ui to Excel and Pow erpoint presentation w ith formatting options using ActiveXObjects and Javascript. As an alternative for an Excel Export that doesn't require ActiveX check out WebClient UI Export to Spreadsheet w ith abap2xlsx Author(s): Company: Accenture Created on: May'11 - 2010 Author(s) Bio Arun Kumar is a CRM developer w orking w ith Accenture India. Exporting data to a file from w eb ui is already available in CRM but it is limited to certain file types. For example data cannot be dow nloaded to an Excel file or Pow erpoint presentation. The 'Export to Excel' button available in tableview tag dow nloads the file as an XML spreadsheet and not to an Excel file. This w iki explains how to dow nload data to an Excel file and Pow erpoint presentation using ActiveXObjects in Javascript. We do not use SICF service or any handler class. I have created a value node and populated some data and displayed it in a Table View and added a button 'Dow nload to Excel' w hich triggeres the Javascript function 'dow nload()' onclientclick. The entire dow nload function is w ritten in the page layout. ( Note: I was not able to save the wiki with standard scripting and activex keywords. So i have added the coding as image as per the advice from SDN support) Download to Excel function: Create an Excel w orkbook using acitvexobject and get the reference in a variable 'Excel'. ( I have used AXO to refer active x objects. I cant use the original keyw ord. ) Add Workbooks to the file. The object reference is passed to a variable'Workbook'. This reference variable 'Workbook' has a list of properties and methods that can be used to format the Excel file further. These are available in the Microsoft msdn library. Now w e can directly add values to the Excel sheet that is active in the Excel w orkbook. This statement w rites the value 'Hello' to cell 1:1 of the first sheet in the Excel file. Adding background color to a range of cells, Excel = new AXO( "Excel.Application" ); Workbook = Excel.Workbooks.Add(); Workbook.ActiveSheet.Cells( 1 , 1 ).Value = "Hello" ; Workbook.ActiveSheet.Range( "A1:F1" ).Interior.ColorIndex = 43 ;
Transcript
Page 1: Download Data From Web Ui to Excel and PPT - SAP CRM

11/13/2014 Download data from web ui to Excel and PPT - CRM - SCN Wiki

http://wiki.scn.sap.com/wiki/display/CRM/Download+data+from+web+ui+to+Excel+and+PPT 1/6

Getting Started Newsletters Store

Search the Community

Welcome, Guest Login Register

Products Services & Support About SCN Downloads

Industries Training & Education Partnership Developer Center

Lines of Business University Alliances Events & Webinars Innovation

Added by ArunKumar Balakrishnan, last edited by Gregor Wolf on May 11, 2012

CRM / … / CRM Web Client UI Framework

Download data from web ui to Excel and PPT

Link to Content's target Space :

http://w iki.sdn.sap.com/w iki/display/CRM/CRM+Web+Client+UI+Framew ork

Applies to:

CRM 6.0/7.0

Summary

Dow nload data from w eb ui to Excel and Pow erpoint presentation w ith formatting options using ActiveXObjects and Javascript.

As an alternative for an Excel Export that doesn't require ActiveX check out WebClient UI Export to Spreadsheet w ith abap2xlsx

Author(s):

Company: Accenture

Created on: May'11 - 2010

Author(s) Bio

Arun Kumar is a CRM developer w orking w ith Accenture India.

Exporting data to a f ile from w eb ui is already available in CRM but it is limited to certain f ile types. For example data cannot be dow nloaded to an Excel f ile or Pow erpoint presentation. The 'Export to

Excel' button available in tableview tag dow nloads the f ile as an XML spreadsheet and not to an Excel f ile.

This w iki explains how to dow nload data to an Excel f ile and Pow erpoint presentation using ActiveXObjects in Javascript. We do not use SICF service or any handler class.

I have created a value node and populated some data and displayed it in a Table View and added a button 'Dow nload to Excel' w hich triggeres the Javascript function 'dow nload()' onclientclick. The

entire dow nload function is w ritten in the page layout.

( Note: I was not able to save the w iki w ith standard scripting and activex keywords. So i have added the coding as image as per the advice from SDN support)

Download to Excel function:

Create an Excel w orkbook using acitvexobject and get the reference in a variable 'Excel'. ( I have used AXO to refer active x objects. I cant use the original keyw ord. )

Add Workbooks to the f ile. The object reference is passed to a variable'Workbook'.

This reference variable 'Workbook' has a list of properties and methods that can be used to format the Excel f ile further. These are available in the Microsoft msdn library.

Now w e can directly add values to the Excel sheet that is active in the Excel w orkbook.

This statement w rites the value 'Hello' to cell 1:1 of the f irst sheet in the Excel f ile.

Adding background color to a range of cells,

Excel = new AXO("Excel.Application");

Workbook = Excel.Workbooks.Add();

Workbook.ActiveSheet.Cells(1,1).Value = "Hello";

Workbook.ActiveSheet.Range("A1:F1").Interior.ColorIndex = 43;

Page 2: Download Data From Web Ui to Excel and PPT - SAP CRM

11/13/2014 Download data from web ui to Excel and PPT - CRM - SCN Wiki

http://wiki.scn.sap.com/wiki/display/CRM/Download+data+from+web+ui+to+Excel+and+PPT 2/6

This statement adds color from cell A1 to F1.

All formatting options including adding formula to a cell, condition formatting, inserting images etc., can be done using ActiveXObjects.

Finally the Excel f ile must be made visible.

The f ile can be saved directly to the user desktop.

Download to PPT

Create a pow erpoint application using AXO.

Add Presentations to the application and slides to the presentation. Once the clides are created, add tables to populate the data.

Data can be populated to table cells by referring to the cell location.

Finally the presentation is made visible.

Tableview:

Downloaded Excel file:

Coding:

Excel.Visible = "true";

Workbook.SaveAs( <filename>);

var myApp = new AXO("PowerPoint.Application");

var presentation = myApp.Presentations.Add();

presentation.Slides.Add(1,12);

presentation.Slides(1).Shapes.AddTable(7, 6, 60, 120, 600, 316);

presentation.Slides(1).Shapes(1).Table.Cell(1, 1).Shape.TextFrame.TextRange.Text = "Product ID";

myApp.Visible = true;

Page 3: Download Data From Web Ui to Excel and PPT - SAP CRM

11/13/2014 Download data from web ui to Excel and PPT - CRM - SCN Wiki

http://wiki.scn.sap.com/wiki/display/CRM/Download+data+from+web+ui+to+Excel+and+PPT 3/6

Page 4: Download Data From Web Ui to Excel and PPT - SAP CRM

11/13/2014 Download data from web ui to Excel and PPT - CRM - SCN Wiki

http://wiki.scn.sap.com/wiki/display/CRM/Download+data+from+web+ui+to+Excel+and+PPT 4/6

Page 5: Download Data From Web Ui to Excel and PPT - SAP CRM

11/13/2014 Download data from web ui to Excel and PPT - CRM - SCN Wiki

http://wiki.scn.sap.com/wiki/display/CRM/Download+data+from+web+ui+to+Excel+and+PPT 5/6

Thanks & Regards,

Arun Kumar

download excel ppt activex crm webclientui webui

5 Comments

Uday Kumar Reddy Velagacharla

Hi Arun,

I got the similar kind of requirement for dow nloading the data into Excel from UI. I did the same steps but w hen i had clicked on the button in w hich excel dow nload has to be done, nothing is

happening. Could you please let me know any more steps required inorder to trigger the logic behind the button.

If you dont mind, could you please provide your mail id so that i can explain more by giving screenshots.

Thanks & Regards,

Uday

Gregor Wolf

Hi Uday,

I think the approach show n by Arun could be problematic in a environment w here you can't use Microsoft Internet Explorer. A better idea if you need nicely formatted Excel f iles is the

abap2xlsx project available at https://cw .sdn.sap.com/cw /groups/abap2xlsx. A standard solution for Excel dow nloads is the Excel dow nload available in all table view s.

Best regards

Gregor

Page 6: Download Data From Web Ui to Excel and PPT - SAP CRM

11/13/2014 Download data from web ui to Excel and PPT - CRM - SCN Wiki

http://wiki.scn.sap.com/wiki/display/CRM/Download+data+from+web+ui+to+Excel+and+PPT 6/6

This ad is supporting your extension ruul (screen ruler): More info | Privacy Policy | Hide on this page

ArunKumar Balakrishnan

Hi Gregor,

The abap2xlsx project dow nloads the f ile in .xlsx format (Open XML Format Spreadsheet f ile) and not in an Excel format. .Xlsx f ile is similar to a zipped f ile package of XML spreadsheets. And

the standard 'Export to Excel' available is table view , DOWNLOADS XML FILES and not Excel f iles. The 'Export to Excel' event handler class is CL_CHTMLB_CONFIG_TAB_EXCEL_EXP.

Hi Uday,

My mail id is available in my business card.

Regards,

Arun

Gregor Wolf

Hi Arun,

as there are free converters for older Excel Version to read the XLSX format I don't see a problems here. The Export to excel w orks also f ine in Excel 2003.

Best regards

Gregor

Guest

Hi Arun,

I am also using the same code w hat you suggested . But nothing is happening and i am getting java script error as mentioned below .

1. I tried to get your email id through your business card but i am not able to see it. Could you please send me your email id.

You can send it on my email id [email protected]

2. Also can you please tell is there any special setup needed for active x object.

Please provide me your valuable inputs for this requirement. I w ill really appreciate your help.

syntax error.

1. BSPWDAPPLICATION.DO

2. OBJECTEXPECTED

EVENT.JS

Thanks & Regards,

Kapil Kumar

Follow SCNContact Us SAP Help Portal

Privacy Terms of Use Legal Disclosure Copyright


Recommended