Application Development and Automation 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: 
Read only

Save Internal table to disk!?

Former Member
0 Likes
764

Hi,

I have an Internal table in my program that I want to save to disk in some way...

Is there any FM or something for this ?

//Martin

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
711

Hi Martin,

By "disk" do you mean your local hard drive or is it the SAP Application Server that you are referring to ?

Regards,

Anand Mandalika.

6 REPLIES 6
Read only

Former Member
0 Likes
711

martin,

you could use FM 'WS_DOWNLOAD' or 'GUI_DOWNLOAD' - the documentation inline should be simple enough to follow.

ryan.

Read only

Former Member
0 Likes
712

Hi Martin,

By "disk" do you mean your local hard drive or is it the SAP Application Server that you are referring to ?

Regards,

Anand Mandalika.

Read only

0 Likes
711

Hi,

I have a abap report and now I want to save the the internal table to a file (static path).

No user input should be nessesary.

EX

In other programming languages:

MyInternalTAb.Save('
SERVER1\TMP\output.txt')

Howto in ABAP ?

//Martin

Message was edited by: Martin Andersson

Read only

0 Likes
711

As Ryan has already suggested WS_DOWNLOAD AND GUI_DOWNLOAD, I would also recommend to use the method GUI_DOWNLOAD from the class CL_GUI_FRONTENDSERVICE . Go to SE24, put the class name and you will find the various methods available. One of them is GUI_DOWNLOAD.

I would suggest you to use the PATTERN button in SE38, then click on ABAP 00, and there mention the name of the method(GUI_DOWNLOAD) , class name (CL_GUI_FRONTENDSERVICE). It writes the code for you. All you now need to do is

a) Mention the filename

b) Mention the filetype

c) Pass the internal table

Let us know how it goes.

Regards,

Subramanian V.

Read only

0 Likes
711

try this:

  
     call function 'WS_DOWNLOAD'
       exporting
            filename                = cpath
                                      "c:tempoutput.txt
            filetype                = 'DAT' "tab-delimited
       tables
            data_tab                = itab
       exceptions
            file_open_error         = 1
            file_write_error        = 2
            invalid_filesize        = 3
            invalid_type            = 4
            no_batch                = 5
            unknown_error           = 6
            invalid_table_width     = 7
            gui_refuse_filetransfer = 8
            customer_error          = 9
            others                  = 10.

ryan.

Read only

0 Likes
711

A TRANSFER can also be used. You do a transfer of a field, a string, or a structure. You must always transfer internal tables line by line, for example, using a LOOP construction.