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: 

Downloading data to excel sheet

Former Member
0 Kudos

Hi All,

I have data present in internal table <FS>.

when i tried to download it, using FM GUI_DOWNLOAD , i got error as :

"<FS>" is not a "STANDARD TABLE".

Could any body please tell me how can i download the data in excel shet ?

my code is

CALL FUNCTION 'GUI_DOWNLOAD'

EXPORTING

FILENAME = filename

WRITE_FIELD_SEPARATOR = 'X'

TABLES

DATA_TAB = <FS>.

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi,

plz declare this way:

DATA: i_itab type standard table of mara.

FIELD-SYMBOLS : <fs> TYPE STANDARD TABLE .

ASSIGN i_itab  to <fs>.

select * from mara into table
i_itab
up to 100 rows.
 

CALL FUNCTION 'GUI_DOWNLOAD'
  EXPORTING
    filename                        = 'C:\testfile.xls'
    WRITE_FIELD_SEPARATOR           = 'X'
  TABLES
    data_tab                        = <fs>
 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
          .

thanx.

Edited by: Dhanashri Pawar on Sep 24, 2008 11:52 AM

10 REPLIES 10

Former Member
0 Kudos

Hi deepika,

WELCOME TO SDN

It seems the type of dat_tab & <fs> is not matching ..Please check that in the FM.

Goodluck,

Bhumika

Former Member
0 Kudos

Hi,

Check these links, I have posted sample program for GUI_DOWNLOAD

Regards

Abhijeet

Former Member
0 Kudos

Use WS_EXCEL Function module

CALL FUNCTION 'WS_EXCEL'

EXPORTING

FILENAME = 'c:\1.xls '

TABLES

DATA = itab name.

Former Member
0 Kudos

hii

use like below code

FIELD-SYMBOLS : <fs_table> TYPE STANDARD TABLE .

 ASSIGN i_final_header TO <fs_table>.-->i_final_header  is an internal table


CALL FUNCTION 'GUI_DOWNLOAD'
    EXPORTING
      filename                = lw_file1
      filetype                = 'ASC'
      write_field_separator   = c_x
    TABLES
      data_tab                = <fs_table>

regards

twinkal

Former Member
0 Kudos

Hi Deepika,

WELCOME TO SDN

Check your internal table, it should work like this:


Data:
  t_kna1 like standard table of kna1.

select * from kna1 into t_kna1.

 CALL FUNCTION 'GUI_DOWNLOAD'
    EXPORTING
      FILENAME                      = lw_file
      FILETYPE                      = 'ASC'
      WRITE_FIELD_SEPARATOR         = 'X'
    TABLES
      DATA_TAB                      = t_KNA1.

With luck,

Pritam.

Former Member
0 Kudos

Hi,

You can also use another FM as

EXCEL_OLE_STANDARD_DAT

Just try with it. Hope it helps you.

Thanks,

Nitesh Jain

Former Member
0 Kudos

Hello,

Put the data into an internal table of standard table table corresponding to the <FS>.

Then use the FM.

Regards,

Rajat

Former Member
0 Kudos

Hi,

plz declare this way:

DATA: i_itab type standard table of mara.

FIELD-SYMBOLS : <fs> TYPE STANDARD TABLE .

ASSIGN i_itab  to <fs>.

select * from mara into table
i_itab
up to 100 rows.
 

CALL FUNCTION 'GUI_DOWNLOAD'
  EXPORTING
    filename                        = 'C:\testfile.xls'
    WRITE_FIELD_SEPARATOR           = 'X'
  TABLES
    data_tab                        = <fs>
 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
          .

thanx.

Edited by: Dhanashri Pawar on Sep 24, 2008 11:52 AM

Former Member
0 Kudos

Hello User an Alv.

there you have this function

regards

Chris

Former Member
0 Kudos

Hi All,

I have assigned points to you people..

Thanks for replies..

I will try to modify the code....and will update the thread accordingly.