Showing results for 
Search instead for 
Did you mean: 

Downloading internal table as XL file from BSP Applications ?.

Former Member
0 Kudos


Is there a way to download an internal table as an Excel file ?.

I referred this weblog and created a similar bsp element as mentioned but I ran into some issues.


The BSP app I'm working is pretty small and simple, dont have those setup as mentioned in the above weblog.

Thanks in Advance,


View Entire Topic
Developer Advocate
Developer Advocate
0 Kudos

>mentioned but I ran into some issues

What kind of issues did you run into? Do you need an example of using this extension in a Page with Flow Logic? I probably have something laying around if that is the case.

Former Member
0 Kudos


Yes, an example of this extension would be of great help. Could you please let me know.

My appl. is a simple one ( no controller classes), it just query info from table and display. If the user wants, it should download to an excel sheet.

I'm also trying with the other option mentioned earlier in this thread by Raja.

Thanks in advance,


Developer Advocate
Developer Advocate
0 Kudos

Sure here is a simple example (a stateless BSP):

I have two page attribues both with Auto Set

display_url TYPE	STRING        
isflight    TYPE	T_SFLIGHT	Flight

(T_SFLIGHT is a local Type Definition;

types: t_sflight type table of sflight.)

In my OnInitialization I have the following code:

select * from sflight into table isflight.

In OnInputProcessing I have the following code. This is the logic that will create the output object and place a URL to it in the display_url attribute. This is a stateless page so I have to reselect my data. I assume you already have a way to persist your data.

if event_id cs 'htmlb'.
  data: htmlb_event_ex type ref to if_htmlb_data.
  htmlb_event_ex ?= cl_htmlb_manager=>get_event_ex( request ).
  check htmlb_event_ex is not initial.
  if htmlb_event_ex->event_id cs 'DOWNLOAD'.
    data: itab type ref to data.
    select * from sflight into table isflight.
    get reference of isflight into itab.
    me->display_url = zcl_es_bsp_elmnt_dwn_tbl_excl=>handle_event(
                                                     htmlb_event_ex = htmlb_event_ex
                                                     runtime        = runtime
                                                     itab           = itab ).

Finally I have the following very simple Layout(which basically just has my download button and a tableview that shows the data:

<%@page language="abap" %>
<%@extension name="htmlb" prefix="htmlb" %>
<%@extension name="xhtmlb" prefix="xhtmlb" %>
<%@extension name="phtmlb" prefix="phtmlb" %>
<%@extension name="ZDOWNLOAD" prefix="zdownload" %>
<htmlb:content design           = "DESIGN2003"
               controlRendering = "sap"
               rtlAutoSwitch    = "true" >
      <htmlb:tray id        = "tray"
                  width     = "100%"
                  hasMargin = "false"
                  title     = "<%= page->get_page_name( ) %>" >
          <htmlb:gridLayout rowSize     = "2"
                            columnSize  = "1"
                            cellSpacing = "0" >
            <htmlb:gridLayoutCell columnIndex = "1"
                                  rowIndex    = "1" >
                            <zdownload:downloadTableExcel text        = "<%= me->text %>"
                                            onDownload  = "Download"
                                            id          = "Download"
                                            display_url = "<%= me->display_url %>" />
              <htmlb:tableView id              = "isflight"
                               table           = "<%= isflight %>"
                               visibleRowCount = "5" />
            <htmlb:gridLayoutCell columnIndex = "1"
                                  rowIndex    = "2" >