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: 

Excel download

Former Member
0 Kudos

Hi All,

I am downloading data in excel from an internal table using GUI_DOWNLOAD . data is correct but few rows it is showing in one cell.

on old screen system if i see that data it is found okay but on new screen(flat screen) it is concatamnating multiple rows in one cell.

please reply me if u have any input for solving the same.

Thanks,

Tanisha

4 REPLIES 4

Former Member
0 Kudos

Hi

call function 'GUI_DOWNLOAD'
    exporting
*     BIN_FILESIZE                    =
      filename                        = filename
      filetype                        = 'DAT'
*     APPEND                          = ' '
     WRITE_FIELD_SEPARATOR           = 'X'
    tables
      data_tab                        = dwnloc
     fieldnames                      = fld
   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.

<REMOVED BY MODERATOR>

Edited by: Alvaro Tejada Galindo on Apr 11, 2008 5:41 PM

Former Member
0 Kudos
CALL FUNCTION 'WS_DOWNLOAD'
 EXPORTING
   FILENAME                      = p_file1
  FILETYPE                      = 'dat'
  TABLES
    data_tab                      = it_out

 EXCEPTIONS
  FILE_OPEN_ERROR               = 1
   FILE_WRITE_ERROR              = 2
   INVALID_FILESIZE              = 3
   INVALID_TYPE                  = 4
   NO_BATCH                      = 5
   UNKNOWN_ERROR                 = 6
   INVALID_TABLE_WIDTH           = 7
   GUI_REFUSE_FILETRANSFER       = 8
   CUSTOMER_ERROR                = 9
   NO_AUTHORITY                  = 10
   OTHERS                        = 11
          .
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.

Try the above code..

Former Member
0 Kudos

Hi,

DATA: BEGIN OF HEAD OCCURS 0,

HEAD(450),

END OF HEAD.

data: begin of itab occurs 0,

matnr like mara-matnr,

ersda like mara-ersda,

end of itab.

*parameters: P_FILE LIKE RLGRAP-FILENAME.

data: e_file type DYNPREAD-fieldname,

i_file type IBIPPARMS-path..

DATA: FILE TYPE STRING.

select matnr

ersda

from mara

into table itab

UP TO 10 ROWS.

call function 'F4_FILENAME'

EXPORTING

PROGRAM_NAME = SYST-CPROG

DYNPRO_NUMBER = SYST-DYNNR

FIELD_NAME = e_FILE

IMPORTING

FILE_NAME = i_file

.

REFRESH HEAD.

HEAD-HEAD = 'MATNR'.

APPEND HEAD.

CLEAR HEAD.

HEAD-HEAD = 'ERSDA'.

APPEND HEAD.

CLEAR HEAD.

FILE = I_FILE.

call function 'GUI_DOWNLOAD'

exporting

filename = file

FILETYPE = 'ASC'

WRITE_FIELD_SEPARATOR = 'X'

tables

data_tab = ITAB

FIELDNAMES = HEAD[]

.

if sy-subrc <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

endif.

LOOP AT ITAB.

write:/ itab-matnr , itab-ersda.

ENDLOOP .

Regards,

Brown.

former_member226203
Active Contributor
0 Kudos

Hi,

Using GUI_download u can download into excel format

OR

call method cl_gui_frontend_services=>gui_download

exporting

filename = 'C:/test1.xls'

write_field_separator = 'X'

changing

data_tab = it_excel.

Hope this is helpful.

<REMOVED BY MODERATOR>

Thanks.

Edited by: Alvaro Tejada Galindo on Apr 11, 2008 5:41 PM