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

table_----------> text file

Former Member
0 Likes
759

how i make text file of table?

(with comma delimeter

1 ACCEPTED SOLUTION
Read only

FredericGirod
Active Contributor
0 Likes
735

Hi,

Go in SE16, display all the fields of your table. In the user parameter set display as ALV Grid, and export the file.

Rgd

Frédéric

6 REPLIES 6
Read only

FredericGirod
Active Contributor
0 Likes
736

Hi,

Go in SE16, display all the fields of your table. In the user parameter set display as ALV Grid, and export the file.

Rgd

Frédéric

Read only

0 Likes
735

how i export the file?

Read only

Former Member
0 Likes
735
TABLES: ztable.
DATA itab LIKE TABLE OF ztable WITH HEADER LINE.

SELECT *
 FROM ztable
 INTO TABLE itab
.

CALL FUNCTION 'GUI_DOWNLOAD'
  EXPORTING
    FILENAME                        = 'test'
  TABLES
    DATA_TAB                        = itab.

Read only

Former Member
0 Likes
735

use GUI_download

CALL FUNCTION 'GUI_DOWNLOAD'

EXPORTING

  • BIN_FILESIZE =

FILENAME = LV_FILE

FILETYPE = 'ASC'

  • APPEND = ' '

WRITE_FIELD_SEPARATOR = LV_DEL

  • HEADER = '00'

  • TRUNC_TRAILING_BLANKS = ' '

  • WRITE_LF = 'X'

  • COL_SELECT = ' '

  • COL_SELECT_MASK = ' '

  • DAT_MODE = ' '

  • CONFIRM_OVERWRITE = ' '

  • NO_AUTH_CHECK = ' '

  • CODEPAGE = ' '

  • IGNORE_CERR = ABAP_TRUE

  • REPLACEMENT = '#'

  • WRITE_BOM = ' '

  • IMPORTING

  • FILELENGTH =

TABLES

DATA_TAB = F_TABLE

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.

ENDIF.

Read only

Former Member
0 Likes
735

Hi Rani,

use the following..

CALL FUNCTION 'SAP_CONVERT_TO_CSV_FORMAT'

  • EXPORTING

  • I_FIELD_SEPERATOR = ';'

  • I_LINE_HEADER =

<b> I_FILENAME =</b>

  • I_APPL_KEEP = ' '

TABLES

<b> I_TAB_SAP_DATA =</b>

  • CHANGING

  • I_TAB_CONVERTED_DATA =

  • EXCEPTIONS

  • CONVERSION_FAILED = 1

  • OTHERS = 2

.

IF SY-SUBRC <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

hope this works

regards

satesh

Read only

Former Member
0 Likes
735

Hi rani,

1. For getting COMMA delimited file

(and not tab delimited)

normal gui_download FM won't help.

2. We need to use 1 + 1 FM.

3. use this code (just copy paste in new program)

REPORT abc.

TYPE-POOLS : truxs.

DATA : t001 LIKE TABLE OF t001 WITH HEADER LINE.

DATA : itab TYPE truxs_t_text_data.

SELECT * FROM t001 INTO TABLE t001.

*----


Loop

CALL FUNCTION 'SAP_CONVERT_TO_CSV_FORMAT'

EXPORTING

i_field_seperator = '>'

  • I_LINE_HEADER =

i_filename = 'D:\tt.txt'

  • I_APPL_KEEP = ' '

TABLES

i_tab_sap_data = t001

CHANGING

i_tab_converted_data = itab

EXCEPTIONS

conversion_failed = 1

OTHERS = 2

.

CALL FUNCTION 'SAP_CONVERT_TO_TEX_FORMAT'

EXPORTING

i_field_seperator = ','

TABLES

i_tab_sap_data = t001

CHANGING

i_tab_converted_data = itab

EXCEPTIONS

conversion_failed = 1

OTHERS = 2.

CALL FUNCTION 'GUI_DOWNLOAD'

EXPORTING

filename = 'd:\tt.txt'

TABLES

data_tab = itab.

BREAK-POINT.

regards,

amit m.