06-11-2007 10:04 AM
Hi all,
How can I put the report generated by a program into a File?It can be in TXT format or excel format which ever is possible.
I need to export this file to memory,How can I do that??
Regards,
Shashank.
06-11-2007 10:10 AM
Hi,
u can download the content into presentation server
by using the function module
gui_download
if it is into application server
use
open data set...
regards,
venkatesh
06-11-2007 10:15 AM
Hi,
Get the data into a single internal table and use the function module 'GUI_DOWNLOAD' to get the data in an application server.
Regards,
Sriram.
PS: Reward Points if it is useful.
06-11-2007 10:17 AM
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.
2. for comma separate
* 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 points if it is usefull ...
Girish
06-11-2007 10:17 AM
Shashank,
Once you get the report as a list output,go to system in the menu bar,choose list-save--local file.
There you can choose in whatever the format you want to download the list output.
K.Kiran.
Message was edited by:
Kiran K
06-11-2007 10:20 AM
HI,
down load into Preasetion serve
Get the data into a single internal table and use the function module <b>'GUI_DOWNLOAD'</b> to get the data in an application server
Or if u want to down load into excel file
u can use FM "<b>SAP_CONVERT_TO_XLS_FORMAT'</b>
Down load into Application server:
use the "open data set < dataset name> for output.
Regards
Suresh.D
06-11-2007 10:21 AM
Hi
Your Query is not really Clear. To Export variables or Internal Tables Into Memory You can Use Export Import parameters.
For Eg: export r1 to memory id 'aaaan'.
import r1 from memory id 'aaaan'.
If you want to download your program into a local file , you can do it directly , below your Report Name you can see a Button export to Local File. Click here and give your format. Thats all.
If you need to save the report output Goto Systems -> List->Save-> Local File and Give your format...
Hope this will help you..
Reward All Helpfull answers..........
06-11-2007 10:37 AM
Hello Shashank,
There are several ways to do this...
two of them are
1. List -> Save -> File and press enter..
it will ask for the format, then path where to save it. Just give the path.
2. Using function module 'GUI_DOWNLOAD'.
I'm giving the example bellow which explains the usage of both GUI_UPLOAD and GUI_DOWNLOAD.
REPORT zssr_bdc .
DATA: BEGIN OF g_t_itab OCCURS 0,
matnr LIKE mara-matnr,
maktx LIKE makt-maktx,
END OF g_t_itab.
DATA: g_t_bdcdata TYPE TABLE OF bdcdata.
DATA: path TYPE string.
path = 'C:\Documents and Settings\ssr3kor\Desktop\TEST\test.txt'.
**************************
*contents of test.txt *
*
*TEST1 ,BOT *
*TEST2 ,BOT *
*TEST3 ,BUT *
**************************
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename = path
TABLES
data_tab = g_t_itab.
LOOP AT g_t_itab.
WRITE:/1(18) g_t_itab-matnr, 20(40) g_t_itab-maktx.
ENDLOOP.
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
filename = 'C:\Documents and Settings\ssr3kor\Desktop\TEST\TEST1.TXT'
filetype = 'ASC'
TABLES
data_tab = g_t_itab.
<b>REWARD POINTS IF IT IS HELPFUL</b>
Regards
--
Sasidhar Reddy Matli
06-11-2007 11:09 AM
Hello Shashank,
Please ignore my previous answer... Ofcourse it works...
There are several ways to do this...
two of them are
1. List -> Save -> File and press enter..
it will ask for the format, then path where to save it. Just give the path.
2. Using function module 'GUI_DOWNLOAD'.
I'm giving the example bellow which explains the usage of both GUI_UPLOAD and GUI_DOWNLOAD.
To do this... you need to have folder with name 'TEST' and a .txt file in it with name 'test'. And contents of it are :
TEST1 ,BOT
TEST2 ,BOT
TEST3 ,BUT
with spaces.
REPORT zssr_bdc .
DATA: BEGIN OF g_t_itab OCCURS 0,
matnr LIKE mara-matnr,
maktx LIKE makt-maktx,
END OF g_t_itab.
DATA: g_t_bdcdata TYPE TABLE OF bdcdata.
DATA: path TYPE string,
path1 type string.
path = 'C:\Documents and Settings\ssr3kor\Desktop\TEST\test.txt'.
path1 = 'C:\Documents and Settings\ssr3kor\Desktop\TEST\test1.txt'.
**************************
*contents of test.txt *
*
*TEST1 ,BOT *
*TEST2 ,BOT *
*TEST3 ,BUT *
**************************
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename = path
TABLES
data_tab = g_t_itab.
LOOP AT g_t_itab.
WRITE:/1(18) g_t_itab-matnr, 20(40) g_t_itab-maktx.
ENDLOOP.
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
filename = path1
filetype = 'ASC'
TABLES
data_tab = g_t_itab.
Now you will get one .txt file with name 'TEST1.TXT' in the TEST folder.
<b>REWARD POINTS IF IT IS HELPFUL</b>
Regards
--
Sasidhar Reddy Matli