I hope my experience will save some time for some programmers who never experienced this scenario before.
By submitting your email address, you agree to receive emails regarding relevant topic offers from TechTarget and its partners. You can withdraw your consent at any time. Contact TechTarget at 275 Grove Street, Newton, MA.
When sending a fixed length text file with spaces at the end of the file;
Trailing blanks are truncated when writing in text mode.
To create fixed length records, use binary mode to write each record and append your own line break(CRLF-Hex ODOA).
File-type 'BIN' gives you the option of defining the file_size while using the ws_download function to download the file.
For an 80 character fixed length file, The internal table should be defined with the 2 extra one character type x fields.
data: begin of intab occurs 10, field1(01) type c, bkacct(03) type c, field3(02) type n, value '00', acount(10) type c , field5(01) type c value ' ', ttype(01) type c, indicator(01),( field8(01) type c, chect(10) type n , trwbtr(10), laufd(6) type c, znme1(20), filler(14) type c value ' '. cr(1) type x value '0D', lf(1) type x value '0A', end of intab. calling the function module with filetype bin with the specific file size. form download_filetab. * Check that data exists describe table intab lines sy-tfill. ws_size = sy-tfill * 82. call function 'WS_DOWNLOAD' exporting bin_filesize = ws_size filename = ws_file filetype = 'BIN' tables data_tab = intab exceptions file_open_error = 1 file_write_error = 2 invalid_filesize = 3 invalid_table_width = 4 invalid_type = 5 others = 6. Hope it helps!