10-09-2007 1:23 PM
i have data obtained from 5 transparent tables but only one transparent table is chosen in selection screen per execution, so i will be getting different structured internal tables because of different transparent table is being selected. Finally i need to download this data to one excel file from internal table using single gui_download function module. in this FM , data_tab should be filled with internal table. how should i acheive this?
10-09-2007 1:29 PM
Hi
Try like this
Loop at <final table>.
read table <1st table name> using <condition>
then copy fields by fields to final table.
endloop.
Same do for other tables also. Then at last all the data will be stored in the final internal table. Then in GUI_DOWNLOAD give the final internal table name in which you got all the data.
Regards
Haritha.
10-09-2007 1:46 PM
hi
good
go through this code and use accordingly.
Download internal table to presentation server file(PC)
DATA: ld_filename TYPE string,
Pre version 4.7 declaration e_file like rlgrap-filename.
DATA: begin of it_datatab occurs 0,
row(500) type c,
end of it_datatab.
call function 'GUI_DOWNLOAD'
exporting
filename = ld_filename
filetype = 'ASC'
tables
data_tab = it_datatab[]
exceptions
file_open_error = 1
file_write_error = 2
others = 3.
Download internal table to presentation server file(PC)
Separating fields/columns by a tab
DATA: ld_filename TYPE string,
Pre version 4.7 declaration e_file like rlgrap-filename.
DATA: begin of it_datatab occurs 0,
col1(50) type c,
col2(50) type c,
col3(50) type c,
etc....
end of it_datatab.
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
filename = ld_filename
filetype = 'ASC'
APPEND = 'X'
write_field_separator = 'X'
CONFIRM_OVERWRITE = 'X'
TABLES
data_tab = it_datatab[]
EXCEPTIONS
file_open_error = 1
file_write_error = 2
OTHERS = 3.
reward point if helpful.
thanks
mrutyun^
10-09-2007 2:21 PM
Hi rishi,
if you want to structure your itab dynamicly use
CALL METHOD CL_ALV_TABLE_CREATE=>CREATE_DYNAMIC_TABLE
Can you tell a little bit more abaout your problem?
Regards, Dieter