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: 

call function 'gui_download'

Former Member
0 Kudos

Hallo Friends,

I am using the above fuction in my program. I want the header of my internal table to be writen als header in the text file. So, I created another Itab (Itab-col_1) and appended all the headers in this, which I later use as below.

Problem:

1.

I am not satisfied with the downloaded output in file.txt I want the header to be excactly over the column content. Please see my output:

MANDT LIFNR LAND1 NAME1 NAME2 NAME3

010

§§§§§§

0000010000

§§§§§§§§§§§§§§§§§§

DE

§§§§§§

Test


010

§§§§§§

0000100000

§§§§§§§§§§§§§§§§§§

US

§§§§§§

TEST

§ § means Space

It is Obvious LAND1 should be over DE / US, NAME1 should be over Test / TEST etc etc

2.

I would like filed seperator to be ( ; ) not space. The flag 'X' gives space.

CALL FUNCTION 'GUI_DOWNLOAD'

EXPORTING

filename = str

filetype = 'ASC'

write_field_separator = 'X'

dat_mode = 'X'

TABLES

data_tab = itab_kreditor

fieldnames = itab_datei_col_header

EXCEPTIONS

file_write_error = 1

file_not_found = 19

OTHERS = 22.

So, how can I solve these two problems.

Blacky.

4 REPLIES 4

Former Member
0 Kudos

CALL FUNCTION 'GUI_DOWNLOAD'

EXPORTING

  • BIN_FILESIZE = BIN_FILESIZE

filename = filename

  • FILETYPE = 'ASC'

  • APPEND = ' '

<b> WRITE_FIELD_SEPARATOR = ';'</b>

  • 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 = ' '

  • TRUNC_TRAILING_BLANKS_EOL = 'X'

  • WK1_N_FORMAT = ' '

  • WK1_N_SIZE = ' '

  • WK1_T_FORMAT = ' '

  • WK1_T_SIZE = ' '

  • IMPORTING

  • FILELENGTH = FILELENGTH

TABLES

data_tab = data_tab

  • FIELDNAMES = FIELDNAMES

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

Regards

Vasu

Former Member
0 Kudos

Hello Moses,

Download your file as XLS or CSV file rather than downloading as TXT using the same function modul. this could solve your problem.

cheers,

~thomas.

Former Member
0 Kudos

Hi,

If you download the fiel in a TXT format, then it will download based on the field lengths, so if you see the downloaded TXT file, then you can come to know, it will not come under the headings, if you want the fields come under the headings then download it in XLS format

Regards

Sudheer

Former Member
0 Kudos

hi

if u want field separator as ';' then u declare an internal table with field of length 255 then concatenate all the fields of internal table into this field separated by ';'

loop at itab1.

concatenate f1 f2 ....into itab-field separated by ';'.

append itab.

endloop.

if u want to write the field values under the headings u can use fixed file format.

like u specify the positions where they have to b displayed......

Message was edited by:

Premalatha G