Quantcast
Channel: SCN : All Content - SAP CRM: Webclient UI - Framework
Viewing all articles
Browse latest Browse all 4552

How to: Download Microsoft Excel from CRM Web UI

$
0
0
This document explains how to:

Download Microsoft Excel from CRM Web UI

  1. Create a BSP Controller "downloadExcel" for Excel.
  2. Create a Controller class "ZCL_CRM_DOWNLOAD_EXCEL" with superclass CL_BSP_CONTROLLER2. Redefine the DO_REQUEST method with the below code.
METHOD do_request.
DATA:
lv_xls           TYPE xstring.
lv_len            TYPE i.
*   Get the excel file here. For more details, you can refer the definition of the following method in How to - Add Custom XML Parts to Microsoft Excel using ABAP
get_xls_download(
      IMPORTING
        ev_xml_xstring_xls = lv_xls
      EXCEPTIONS
        error_occurred     = 1
                             ).
  lv_len = xstrlen( lv_xls ).
*   Export response data
CALL METHOD response->if_http_entity~append_data
    EXPORTING
      data   = lv_xls
      length = lv_len.
*   Set response content-type as Excel
  CALL METHOD response->if_http_entity~set_header_field
    EXPORTING
      name  = 'content-type'                                "#EC NOTEXT
"content-type for XLSX
      value = 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'.
"Content types
"Excel (*.xlsx) - 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'
"Excel (*.xlsm) - application/vnd.ms-excel.sheet.macroenabled.12'

ENDMETHOD.
 
   3.  Set the contoller class to the BSP Controller. Now you can use this controller to download the file.
BSPControllerExcel.png

Viewing all articles
Browse latest Browse all 4552

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>