Application Development 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: 

download of alv output in a file

Former Member
0 Kudos

Hi all,

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

Regards,

Lisa.

12 REPLIES 12

Former Member
0 Kudos

Hi Lisa,

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

Regards,

John.

0 Kudos

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

Former Member
0 Kudos

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

0 Kudos

Hi Rich,

I need to download a file which iam getting randomly and the user will give me the file format also. so i need show the the output in file name which the user has mentioned and the output file must be in the format which the user is mentioned. like xml ,csv. etc

for example the file name is

temp and the format is xml the i need to show the out put in temp.xml

i hope u understood my requirement.

Regards,

Lisa.

Message was edited by: Lisa Roy

0 Kudos

Take the filename and format as parameters on the selection screen and use the parameters as the file name and format when passing to the FM.

Parameters: PFile like rlgrap-filename..

p_format like rlgrap-filetype..

Regards,

Ravi

0 Kudos

I see, so you don't want to use the built in standard functionality provided by the grid, right?

If not, you will need to set a new button on your application toolbar using SET PF-STATUS, when the user clicks on this button you can throw a dialog where they can enter the path/file, then you can format your internal table and pass it to the GUI_DOWNLOAD(fm or method).

Regards,

RIch Heilman

0 Kudos

Hi Rich,

Yes, I dont want to use the standard functionality.

Regards,

Lisa.

0 Kudos

Hi,

what about this..., downloading to HTML

check this thread..

Regards

vijay

Former Member
0 Kudos
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

Former Member
0 Kudos

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

Former Member
0 Kudos

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

0 Kudos

Please look into my requirement. which i have replied to Rich Heilman.

Regards,

Lisa.