Skip to Content
avatar image
Former Member

download of alv output in a file

Hi all,

I need to download the output which is present in alv into a file.How can i do that?.

Regards,

Lisa.

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

5 Answers

  • avatar image
    Former Member
    Apr 05, 2006 at 02:23 PM

    Hi Lisa,

    There should be standard buttons in the ALV to download the ALV to Excel, local file, and so on.

    Regards,

    John.

    Add comment
    10|10000 characters needed characters exceeded

    • John is right, this functionality is provided by the ALV grid, just click the appropriate button. If you want to do it yourself, I would suggest using the GUI_DOWNLOAD function module or the CL_GUI_FRONTEND_SERVICES=>GUI_DOWNLOAD class/method.

      Regards,

      Rich Heilman

  • avatar image
    Former Member
    Apr 05, 2006 at 02:28 PM

    Hi

    u can use

    gui_download

    v_file id nothing but the local file name

    CALL FUNCTION 'GUI_DOWNLOAD'
      EXPORTING
        filename                        = 'v_file'
       FILETYPE                        = 'ASC'
      tables
        data_tab                        = internal table
     EXCEPTIONS
       FILE_WRITE_ERROR                = 1
       NO_BATCH                        = 2
       GUI_REFUSE_FILETRANSFER         = 3
       INVALID_TYPE                    = 4
       NO_AUTHORITY                    = 5
       UNKNOWN_ERROR                   = 6
       HEADER_NOT_ALLOWED              = 7
       SEPARATOR_NOT_ALLOWED           = 8
       FILESIZE_NOT_ALLOWED            = 9
       HEADER_TOO_LONG                 = 10
       DP_ERROR_CREATE                 = 11
       DP_ERROR_SEND                   = 12
       DP_ERROR_WRITE                  = 13
       UNKNOWN_DP_ERROR                = 14
       ACCESS_DENIED                   = 15
       DP_OUT_OF_MEMORY                = 16
       DISK_FULL                       = 17
       DP_TIMEOUT                      = 18
       FILE_NOT_FOUND                  = 19
       DATAPROVIDER_EXCEPTION          = 20
       CONTROL_FLUSH_ERROR             = 21
       OTHERS                          = 22
              .
    IF sy-subrc <> 0.
     MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
             WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.

    or

    after the output u do this

    system->list->save->localfile.

    here u can download it in the local file.

    thanks

    Vikrant

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Apr 05, 2006 at 02:31 PM
    u can download to excel file
    
    click on the export button in application toolbar
    
    spreadsheet-->press enter-->pivot-->microsoft excel
    
    u willl get the data in sheet1 of that excel generated
    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Apr 05, 2006 at 02:38 PM

    Hi,

    Press CTRLSHIFTF9 for downloading the ALV output to your system. Its ask your to select the required format Eg HTML file, PLain Text etc and also the location where it must be saved.

    Thanks,

    Ramu N

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Apr 05, 2006 at 03:42 PM

    hello Lisa,

    I used once the mentioned method CL_GUI_FRONTEND_SERVICES=>GUI_DOWNLOAD (which I think calls intern the FM 'GUI_DOWNLOAD', isn't that funny, a method calls a FM...):

    Concatenate the drive, the filename and the type of file into the filename like:

    CONCATENATE 'D:\' 'temp' '.XLS' INTO l_filename.

    CALL METHOD cl_gui_frontend_services=>gui_download

    EXPORTING

    • BIN_FILESIZE =

    filename = l_filename

    filetype = 'ASC'

    • APPEND = SPACE

    write_field_separator = 'X'

    • HEADER = '00'

    trunc_trailing_blanks = 'X'

    • WRITE_LF = 'X'

    • COL_SELECT = SPACE

    • COL_SELECT_MASK = SPACE

    • dat_mode = 'X'

    confirm_overwrite = 'X'

    • IMPORTING

    • FILELENGTH =

    CHANGING

    data_tab = itab.

    that worked at least with Excel. User could open the file on 'D:temp.xls' and it opened as an excel-file.

    Regards,

    Samir

    Add comment
    10|10000 characters needed characters exceeded