Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Download

Former Member
0 Likes
826

Hi all,

I have a requirement that I have to download the ALV list into a Local file (Presentation Server) . For that we have an option in the ALV Tool bar. In that we have a lot of option Unconverted,Spreadsheet,Word.....etc.. <b>But, I want only the UNCONVERTED</b> . Once we give Unconverted it asks for file name in that <b>i want a default file name corresponding to my selection screen parameter..</b>

Can any body help me??

Hi all,

I have a requirement that I have to download the ALV list into a Local file (Presentation Server) . For that we have an option in the ALV Tool bar. In that we have a lot of option Unconverted,Spreadsheet,Word.....etc.. <b>But, I want only the UNCONVERTED</b> . Once we give Unconverted it asks for file name in that <b>i want a default file name corresponding to my selection screen parameter..</b>

Can any body help me??

5 REPLIES 5
Read only

Former Member
0 Likes
749

Hi Gopi,

That is not possible.

Instead you can create your own button on ALV toolbar say 'DOWNLOAD" button.

When user clicks on it, use FM "GUI_DOWNLOAD" & pass the internal table & file name which user has entered.

* This method of file download with check uses the latest techniques 
* and achieves a very neat solution
  DATA: ld_filename TYPE string,
        ld_path TYPE string,
        ld_fullpath TYPE string,
        ld_result TYPE i.

* Display save dialog window
  CALL METHOD cl_gui_frontend_services=>file_save_dialog
    EXPORTING
*      window_title      = ' '
      DEFAULT_EXTENSION = 'XLS'
      default_file_name = 'accountsdata'
      INITIAL_DIRECTORY = 'c:temp'
    CHANGING
      filename          = ld_filename
      path              = ld_path
      fullpath          = ld_fullpath
      user_action       = ld_result.

* Check user did not cancel request
  CHECK ld_result EQ '0'.

  CALL FUNCTION 'GUI_DOWNLOAD'
   EXPORTING
        filename         = ld_fullpath
        filetype         = 'ASC'
*       APPEND           = 'X'
        write_field_separator = 'X'
*       CONFIRM_OVERWRITE = 'X'
   TABLES
        data_tab         = it_datatab[]     "need to declare and populate
   EXCEPTIONS
        file_open_error  = 1
        file_write_error = 2
        OTHERS           = 3.

Best regards,

Prashant

Read only

0 Likes
749

Thanks for ur reply,

I think that in this way, we can download only the contents of a particular Internal Table. am i right?? if yes, i have some other values in that list apart from the alv internal table. i.e. i used at end of list.

Read only

Former Member
0 Likes
749

Hi Gopi,

You can APPEND the same file with different data.

* HEADER DATA
 CALL FUNCTION 'GUI_DOWNLOAD'
   EXPORTING
        filename         = ld_fullpath
        filetype         = 'ASC'
*       APPEND           = 'X' "Commented for 1st time
        write_field_separator = 'X'
*       CONFIRM_OVERWRITE = 'X'
   TABLES
        data_tab         = it_header[]     "need to declare and populate
   EXCEPTIONS
        file_open_error  = 1
        file_write_error = 2
        OTHERS           = 3.


* ITEM DATA
 CALL FUNCTION 'GUI_DOWNLOAD'
   EXPORTING
        filename         = ld_fullpath
        filetype         = 'ASC'
       APPEND           = 'X'  " Uncommented
        write_field_separator = 'X'
*       CONFIRM_OVERWRITE = 'X'
   TABLES
        data_tab         = it_item[]     "need to declare and populate
   EXCEPTIONS
        file_open_error  = 1
        file_write_error = 2
        OTHERS           = 3.


* FOOTER DATA
 CALL FUNCTION 'GUI_DOWNLOAD'
   EXPORTING
        filename         = ld_fullpath
        filetype         = 'ASC'
       APPEND           = 'X' "Uncommented
        write_field_separator = 'X'
*       CONFIRM_OVERWRITE = 'X'
   TABLES
        data_tab         = it_footer[]     "need to declare and populate
   EXCEPTIONS
        file_open_error  = 1
        file_write_error = 2
        OTHERS           = 3.

Read only

0 Likes
749

Hi patil,

I have some Variables too..

Read only

Former Member
0 Likes
749

Hi Gopi,

You can move all the variables to an internal table & download the same.

Best regards,

Prashant