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: 

How can I put the report generated by a program into a File?

Former Member
0 Kudos

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.

8 REPLIES 8

Former Member
0 Kudos

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

Former Member
0 Kudos

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.

Former Member
0 Kudos
  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

kiran_k8
Active Contributor
0 Kudos

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

Former Member
0 Kudos

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

Former Member
0 Kudos

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..........

Former Member
0 Kudos

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

Former Member
0 Kudos

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