Skip to Content
0
Former Member
Nov 29, 2007 at 04:28 PM

Problem generating filler (blank spaces) at the end of line in text file

86 Views

Hello guys,

I'm facing a problem when I generate a text file (with FM WS_DOWNLOAD). This text file contains several lines with length 120 characters, though, in all cases the last characters are blank spaces (filler).

The main problem is that this blank spaces are not appearing in those lines, always the line ends with the last character different of blank.

What has been done is quite simile to the code below:

TYPES: BEGIN OF L_DATA,

TEST(50) TYPE C,

TEST1(50) TYPE C,

FILLER(20) TYPE C, "BLANK SPACES

END OF L_DATA.

TYPES: BEGIN OF L_STRUC,

LINE(120),

END OF L_STRUC.

DATA L_TAB TYPE TABLE OF L_STRUC.

DATA WA_TAB TYPE L_STRUC.

DATA WA_DATA TYPE L_DATA.

WA_DATA-TEST = 'Test'.

WA_DATA-TEST1 = 'Test1'.

WA_TAB = WA_DATA.

APPEND WA_TAB TO L_TAB.

PERFORM DOWNLOAD TABLES L_TAB.

&----


*& Form download

&----


  • text

----


  • -->T_TAB text

----


FORM DOWNLOAD TABLES T_TAB.

DATA: FILENAME LIKE RLGRAP-FILENAME.

CALL FUNCTION 'WS_FILENAME_GET'

EXPORTING

DEF_FILENAME = FILENAME

  • DEF_PATH = ' '

MASK = ',.,..'

MODE = 'S'

  • TITLE = ' '

IMPORTING

FILENAME = FILENAME

  • RC =

EXCEPTIONS

INV_WINSYS = 1

NO_BATCH = 2

SELECTION_CANCEL = 3

SELECTION_ERROR = 4

OTHERS = 5

.

IF SY-SUBRC <> 0.

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

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

ENDIF.

CALL FUNCTION 'WS_DOWNLOAD'

EXPORTING

  • bin_filesize = ' '

  • CODEPAGE = ' '

FILENAME = FILENAME

FILETYPE = 'ASC'

  • MODE = ' '

  • WK1_N_FORMAT = ' '

  • WK1_N_SIZE = ' '

  • WK1_T_FORMAT = ' '

  • WK1_T_SIZE = ' '

  • COL_SELECT = ' '

  • COL_SELECTMASK = ' '

  • NO_AUTH_CHECK = ' '

  • IMPORTING

  • FILELENGTH =

TABLES

DATA_TAB = T_TAB

  • FIELDNAMES =

EXCEPTIONS

FILE_OPEN_ERROR = 1

  • FILE_WRITE_ERROR = 2

  • INVALID_FILESIZE = 3

  • INVALID_TABLE_WIDTH = 4

  • INVALID_TYPE = 5

  • NO_BATCH = 6

  • UNKNOWN_ERROR = 7

  • GUI_REFUSE_FILETRANSFER = 8

  • OTHERS = 9

. "dot

ENDFORM. "download

In the text file after the string 'Text1' there are no blank fields.

Do you have any idea to solve that?

Kind regards,

Thiago