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 write a internal table into file

Former Member
0 Kudos

Hello.

i would like to ask one favor, i am trying to write all the internal table informacion into a file(.txt .dat), i don't know how to do that, please if you have any information please send me one .

thanks a lor for you help.

5 REPLIES 5

Former Member
0 Kudos

Hello,

In order to download your internal table just call the following fm:

CALL FUNCTION 'TB_LIMIT_WS_DOWNLOAD'

EXPORTING

  • BIN_FILESIZE = ' '

filename = dest

filetype = 'ASC'

mode = 'O'

IMPORTING

filelength = filesi "Bytes read

TABLES

data_tab = p_ti_temp "your IT

EXCEPTIONS

file_write_error = 1

invalid_filesize = 2

invalid_type = 3

no_batch = 4

unknown_error = 5

gui_refuse_filetransfer = 6

no_authority = 7

OTHERS = 8

Hope this helps

Gabriel

former_member583013
Active Contributor
0 Kudos

You must use <b>GUI_DOWNLOAD</b> -;)


CALL FUNCTION 'GUI_DOWNLOAD'
  EXPORTING
    FILENAME                       = 'C:File.txt'
  TABLES
    DATA_TAB                       = INTERNAL_TAB
 EXCEPTIONS
   FILE_WRITE_ERROR                = 1
   NO_BATCH                        = 2
   GUI_REFUSE_FILETRANSFER         = 3
   INVALID_TYPE                    = 4
   NO_AUTHORITY                    = 5
   UNKNOWN_ERROR                   = 6.

Greetings,

Blag.

Former Member
0 Kudos

If you want to download the information to a desktop directory, then use function module GUI_DOWNLOAD with your internal table. If you want to download to the server directory, then use the following logic.


OPEN DATASET v_file FOR OUTPUT IN TEXT MODE ENCODING DEFAULT.
LOOP AT itab.
  TRANSFER itab TO v_file LENGTH reclen.
ENDLOOP.
CLOSE DATASET v_file.

Former Member
0 Kudos

Hi,

you can download the Internal table data in to a local file using WS_DOWNLOAD or GUI_DOWNLOAD

<u><b>WS_DOWNLOAD -- ></b></u> Save Internal Table as File on the Presentation Server

use this link to know more

http://www.sapdevelopment.co.uk/file/file_updown.htm

Thanks

Sudheer

0 Kudos

Actually...You should avoid the using of <b>WS_DOWNLOAD</b>...because it's obsolet...Always go for <b>GUI_DOWNLOAD</b> -;)

Greetings,

Blag.