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: 

Downloading data into text file from table

Former Member
0 Kudos

Hi Friends,

I want to download the data from the tables into text file using a tab delimiter, can you guys tell me how to download the data into a text file by using a program, as I need to do this for nearly 20 tables.

All answers are rewarded,

Regards,

Line

1 ACCEPTED SOLUTION

Former Member
0 Kudos

simple yaar....

just use GUI_DOWNLOAD AND GUI_UPLOAD function modules for uploading and downloading the data from internal table to text file....

reward points please

6 REPLIES 6

Former Member
0 Kudos

Hello,

Use the FM <b>SAP_CONVERT_TO_TXT_FORMAT</b>

Regards,

LIJO

Former Member
0 Kudos

simple yaar....

just use GUI_DOWNLOAD AND GUI_UPLOAD function modules for uploading and downloading the data from internal table to text file....

reward points please

Former Member
0 Kudos

Hi,

Use the FM <b>GUI_DOWNLOAD</b>

Regards,

Nilesh

Former Member
0 Kudos

Hi Turbin,

Try the following code: (Just replace the file path & Internal table name)



Data: l_file type string.

l_file = c:temptest.txt

      CALL FUNCTION 'GUI_DOWNLOAD'
        EXPORTING
          filename                = l_file
          write_field_separator   = 'X'
        TABLES
          data_tab                = it_main3
        EXCEPTIONS
          file_write_error        = 1
          no_batch                = 2
          gui_refuse_filetransfer = 3
          invalid_type            = 4
          no_authority            = 5
          unknown_error           = 6
          header_not_allowed      = 7
          separator_not_allowed   = 8
          filesize_not_allowed    = 9
          header_too_long         = 10
          dp_error_create         = 11
          dp_error_send           = 12
          dp_error_write          = 13
          unknown_dp_error        = 14
          access_denied           = 15
          dp_out_of_memory        = 16
          disk_full               = 17
          dp_timeout              = 18
          file_not_found          = 19
          dataprovider_exception  = 20
          control_flush_error     = 21
          OTHERS                  = 22.

      IF sy-subrc <> 0.
        MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
      ENDIF.


if you want to append the data of all the tables into one file then use this parameter in Exporting of GUI_DOWNLOAD:

          append                  = 'X'

Reward points if helpful answer.

Ashvender

Former Member
0 Kudos

use the fm GUI_UPLOAD if the version using after 4.6 otherwise use UPLOAD.

Former Member
0 Kudos

Hi,

  • Use the GUI_DOWNLOAD function module.

  • First you should create one text file in desktop and give that file path in FILENAME.

CALL FUNCTION 'GUI_DOWNLOAD'

EXPORTING

FILENAME = 'C:\Documents and Settings\psksenthilkumar\Desktop\VEN\VEN.DOC'

FILETYPE = 'ASC'

TABLES

DATA_TAB = B_BDCMSGCOLL

EXCEPTIONS

FILE_WRITE_ERROR = 1

NO_BATCH = 2

GUI_REFUSE_FILETRANSFER = 3

INVALID_TYPE = 4

NO_AUTHORITY = 5

UNKNOWN_ERROR = 6

HEADER_NOT_ALLOWED = 7

SEPARATOR_NOT_ALLOWED = 8

FILESIZE_NOT_ALLOWED = 9

HEADER_TOO_LONG = 10

DP_ERROR_CREATE = 11

DP_ERROR_SEND = 12

DP_ERROR_WRITE = 13

UNKNOWN_DP_ERROR = 14

ACCESS_DENIED = 15

DP_OUT_OF_MEMORY = 16

DISK_FULL = 17

DP_TIMEOUT = 18

FILE_NOT_FOUND = 19

DATAPROVIDER_EXCEPTION = 20

CONTROL_FLUSH_ERROR = 21

OTHERS = 22.

B_BDCMSGCOLL is the internal table

IF USEFULL REWARD