Skip to Content
0
Former Member
Jul 25, 2008 at 05:12 PM

gui_download issue - trailing spaces getting truncated for fixed length fil

1330 Views

Hi All,

I have a requirement where I need to download an internal table as a fixed length file.

The code is as follows:

CALL FUNCTION 'GUI_DOWNLOAD'

EXPORTING

BIN_FILESIZE =

FILENAME = L_FILE

FILETYPE = 'ASC'

APPEND = 'X'

WRITE_FIELD_SEPARATOR = ' '

HEADER = '00'

TRUNC_TRAILING_BLANKS = ' '

WRITE_LF = ' '

COL_SELECT = ' '

COL_SELECT_MASK = ' '

DAT_MODE = ' '

IMPORTING

FILELENGTH =

TABLES

DATA_TAB = IT_TEXT

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

Each row in the internal table IT_TEXT is 242 chars long.

The FM is truncatinf the trailing blanks on the file. How do I get the FM to not truncate the trailing blanks in each row?

My internal table has multiple rows and the number of rows on the table should be same as the number of rows on the downloaded file.

I tried setting the WRITE_LF parameter to space.

In this case, the trailing spaces are not truncated(which is as per my requirement), BUT all the rows in the internal table appear in a single line on the downloaded file instead of multiple rows.

I also tried setting the TRUNC_TRAILING_BLANKS field to space but that does not work either. Spaces at the end of the row are still truncated.

so the requirement is: the spaces at the end of each row should not be truncated and

each row on the internal table should have a corresponding row on the downloaded file.

(it is a fixed length file)

I also tried using the following code

class cl_abap_char_utilities definition load.

DATA: BEGIN OF IT_TEXT OCCURS 0,

TEXT(242) TYPE C,

cr_lf TYPE c VALUE cl_abap_char_utilities=>cr_lf,

END OF IT_TEXT.

when i compile, i get the following error

The type "CL_ABAP_CHAR_UTILITIES" is unknown.

Im using R/3 4.6C. Could this be a problem?

Please suggest a solution for this problem.

Thanks!

Sandeep

Edited by: sandeep reddy on Jul 25, 2008 7:16 PM