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: 

selected records of a table upload to excel.

Former Member
0 Kudos

hi everybody,

i need to upload all records of a selected table to excel sheet.

can anybody help me how to do this report.

if possible with example.

thanks & regards,

venu.

2 REPLIES 2

thomas_jung
Developer Advocate
Developer Advocate
0 Kudos

This program will take any table with any where clause and download it to Excel (written in 640). Is this the kind of thing you are looking for?


REPORT  ze_bc640_00_u07_table.

PARAMETERS: table(30) TYPE c,
            where(100) TYPE c.

DATA tabref TYPE REF TO data.
FIELD-SYMBOLS <table> TYPE ANY TABLE.

CREATE DATA tabref TYPE TABLE OF (table).
ASSIGN tabref->* TO <table>.

SELECT * FROM (table) INTO TABLE <table> WHERE (where).

DATA: filename TYPE string VALUE 'c:test.xls'.
CALL METHOD cl_gui_frontend_services=>gui_download
  EXPORTING
    filename              = filename
    filetype              = 'ASC'
    write_field_separator = 'X'
  CHANGING
    data_tab              = <table>.

RichHeilman
Developer Advocate
Developer Advocate
0 Kudos

Here is one way.....



report zrich_0001 .

data: imara type table of mara with header line.

start-of-selection.

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


  call function 'WS_EXCEL'
       exporting
            filename = 'TEST.XLS'
       tables
            data     = imara.

Regards,

Rich Heilman