Skip to Content

No popup when using cl_bsp_utility=>download

Hi friends,

I´m using cl_bsp_utility=>download method from my BSP to download a file. I´ve never used it, but as long as I could see in the forum, it´s suppossed to open a popup to choose the file destination, right?...

Well, I´m getting nothing...what could be happening? I´ve tried the same code from different pc´s, to discard antivitrus, or popup blockers, or something like that, and nothing at all. After my pushbutton click, runs all the code without any error, but no popup.

I would appreciate very much any kind of help. Here´s my code, just in case...


	  call function 'SCMS_STRING_TO_XSTRING'
            exporting
              text     = lv_string
              mimetype = 'APPLICATION/MSEXCEL;charset=utf-8'
            importing
              buffer   = lv_xstring.

          concatenate cl_abap_char_utilities=>byte_order_mark_little
                      lv_xstring into lv_xstring in byte mode.

          call method cl_bsp_utility=>download
            exporting
              object_s            = lv_xstring
              content_type        = 'APPLICATION/MSEXCEL;charset=utf-8'
              content_disposition = 'attachment;filename=*.xls'
              response            = _m_response
              navigation          = navigation.

Thanks in advance!

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

6 Answers

  • avatar image
    Former Member
    Jul 27, 2009 at 05:25 PM

    Hi,

    Try the below code in place of the cl_bsp_utility=>download.

    DATA:  L_APP_TYPE  TYPE STRING,
             L_FILENAME  TYPE STRING,
             L_XSTRING   TYPE XSTRING,    "needed for HTTP response
             L_XLEN       TYPE I.
    
    * Setting Content Type
      MOVE 'application/msexcel' TO L_APP_TYPE.
      MOVE 'attachment; filename=webforms.xls' TO L_FILENAME.
    
      CLEAR L_XSTRING.
      L_XSTRING = V_XSTRING. " Here you can directly pass your XSTRING
    
    *-----------------------------------------------------------------------
    * Fill HTTP request
    *-----------------------------------------------------------------------
      RESPONSE->SET_HEADER_FIELD( NAME  = 'content-type'
                                  VALUE = L_APP_TYPE ).
    
      RESPONSE->DELETE_HEADER_FIELD(
                          NAME = IF_HTTP_HEADER_FIELDS=>CACHE_CONTROL ).
      RESPONSE->DELETE_HEADER_FIELD(
                          NAME = IF_HTTP_HEADER_FIELDS=>EXPIRES ).
      RESPONSE->DELETE_HEADER_FIELD(
                          NAME = IF_HTTP_HEADER_FIELDS=>PRAGMA ).
    
      RESPONSE->SET_HEADER_FIELD(
                           NAME  = 'content-disposition'
                           VALUE = L_FILENAME ).
    
    * finally display XLS format in Browser
      L_XLEN = XSTRLEN( L_XSTRING ).
      RESPONSE->SET_DATA( DATA   = L_XSTRING
                          LENGTH = L_XLEN ).
      NAVIGATION->RESPONSE_COMPLETE( ).

    I have used it one of my program and it worked.

    Thanks,

    Sreekanth

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Jul 27, 2009 at 05:38 PM

    Thank you very much.

    I´ve replaced my code with your proposal, but I had the same result (or the lack of it, in fact). The code doesn´t do anything.

    What could be missing?

    Regards,

    Federico.

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Jul 28, 2009 at 02:29 PM

    Thanks for your suggestion.

    Indeed, one those code samples is what I´m trying to make work, but it doesn´t. I´m looking for someone who might have experienced the same problem.

    Kind regards,

    Federico.

    Add comment
    10|10000 characters needed characters exceeded

  • Jul 28, 2009 at 05:13 PM

    I finally did it, my mistake was to use the mreponse object, instead of the response object belonging to my page.

    As it is not available from OnInputProcessing event, all I did was fetch it from the runtime:

    response = runtime->server->response.

    Hope this could help someone else.

    Regards.

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Mar 16, 2011 at 06:18 PM

    Hi All,

    I am using the same as mentioned above while Download the data into Excel.

    I got the popup with SAVE, CANCEL and OPEN. After SAVING file

    it stores the data into Excel sheet. But cursor will not move to the regular place.

    am i missing anything here . I want to know the reson why it's not going back after SAVE file or CANCEL?

    Secondly i tried the below link also,

    return-after-pdf-display

    According to this I tryied to call the URL using Java script. But it is working in some browsers but not in other browsers.

    Is there any changes I need to do in this.

    I am not bale to fingure it out. Please suggest some points on it ...

    Thanks..

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    May 10, 2012 at 06:46 PM

    Hi Federico,

    Could you please suggest about m_response population, whihc is you generating at Run time of .htm,

    from where u got this instance populated, which view of the component, please guide us, as we are not at all getting XLS download popup, it is giving page error, please guide us.

    Thanks & Regards,

    Vjmhyd

    Add comment
    10|10000 characters needed characters exceeded