There are umpteen ways of incorporating downloading the contents in SAP CRM WEBUI framework like using transformation to convert content from ABAP to XLS and then later using the converted content from transformation to be displayed on WEBUI framework using output stream. Although this approach is appropriate in case where we need output in excel sheet in particular format like specific font, background color, calculation fields and so on. But in some cases we may need simple download functionality which will be covered here. The scenario/requirement which I had encountered was simple download of data in the form of internal table populated from third party system using Remote function(RFC) enabled function module. I may not be able to showcase the complete scenario but will showcasing the approach to simply download the string content to excel. This particular step by step approach could be used to download any other application like PDF, MS Word and the mime type(MIME table SDOKMIME and SDOKMIME_C) supported in the system.
Rajwin Singh Sood
Created on: 8th Dec 2015
Rajwin Singh Sood is currently working as Team lead/Solution
Architect at Atos. He has got experience of about 10 years in SAP ABAP and SAP CRM web UI. He is also a
SAP CRM EHP2 Certified associated consultant. Prior to working with Atos he had worked with SAP India(SAP
Global Delivery), Capgemini , Accenture and Infosys. He worked in SAP CRM Web Ui in areas like BSP
enhancements, transaction launchers, BOL Programming, BRFPlus .
Button "Excel Download" will be added at the search result list view on click of that excel sheet will be opened with the text "Excel generation" and "this is automated generated excel sheet".
Firstly BSP component BT115QS_SLSQ/SlsQuotSR is enhanced. then redefine the method DO_PREPARE_OUTPUT and add the below code to add the button:-
CALL METHOD super->do_prepare_output
iv_first_time = iv_first_time.
CONSTANTS lc_button_click TYPE string VALUE 'OPEN_EXCEL'.
DATA: ls_button TYPE crmt_thtmlb_button.
READ TABLE gt_button TRANSPORTING NO FIELDS WITH KEY text = 'Excel Download'. "#EC NOTEXT