2008 May 22 1:39 PM
Hi
I need to create a text file that is 80 Characters in length, so spaces must be filled.
I'm using Class Attribute CL_ABAP_CHAR_UTILITIES=>CR_LF.
But when I do this it created additonal lines in the file so instead of 5 lines i get 10 lines.
Any solutions will be appreciated?
REPORT YTEST7.
class CL_ABAP_CHAR_UTILITIES definition load.
data: L_LINE(133) type c.
TYPES : BEGIN OF itable_out_text,
line(1000) TYPE c,
END OF itable_out_text.
DATA : lt_out_text TYPE STANDARD TABLE OF itable_out_text WITH HEADER LINE.
concatenate 'SYSTEM: ' SY-SYSID
'USER: ' SY-UNAME
'CLIENT: ' SY-MANDT
into L_LINE.
l_line+80 = CL_ABAP_CHAR_UTILITIES=>CR_LF .
do 5 times.
lt_out_text-line = l_line.
append lt_out_text.
enddo.
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
filename = 'C:\testing.txt'
filetype = 'ASC'
TABLES
data_tab = lt_out_text.
Edited by: KevC on May 22, 2008 2:41 PM
Hi
I need to create a text file that is 80 Characters in length, so spaces must be filled.
I'm using Class Attribute CL_ABAP_CHAR_UTILITIES=>CR_LF.
But when I do this it created additonal lines in the file so instead of 5 lines i get 10 lines.
Any solutions will be appreciated?
REPORT YTEST7.
class CL_ABAP_CHAR_UTILITIES definition load.
data: L_LINE(133) type c.
TYPES : BEGIN OF itable_out_text,
line(1000) TYPE c,
END OF itable_out_text.
DATA : lt_out_text TYPE STANDARD TABLE OF itable_out_text WITH HEADER LINE.
concatenate 'SYSTEM: ' SY-SYSID
'USER: ' SY-UNAME
'CLIENT: ' SY-MANDT
into L_LINE.
l_line+80 = CL_ABAP_CHAR_UTILITIES=>CR_LF .
do 5 times.
lt_out_text-line = l_line.
append lt_out_text.
enddo.
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
filename = 'C:\testing.txt'
filetype = 'ASC'
TABLES
data_tab = lt_out_text.
Edited by: KevC on May 22, 2008 2:41 PM
2008 May 22 2:01 PM
Hi,
Try to decrease the field lenth of internal table from 1000 to less 100.
check it........
I Think may file length may be less than 1000.
By
Gupta
.
2008 May 22 2:22 PM
hi,
I guess you are getting blank lines after each line
just comment the code :
l_line+80 = CL_ABAP_CHAR_UTILITIES=>CR_LF and it should work fine.
A new line is created anyways for every line you append to the itab and then downloaded.
regards,
Advait
2008 May 22 2:27 PM
Kev,
When exporting the table to the text file, Adding CRLF to the end will cause a blank like as the process does that anyway.
The problem is how to force an 80 char Record length.
Generally when reading this type record in, by whatever you are passing this file to, would read one line at at time and the imbedded CRLF would signify the end of the record. When whatever is reading this in, if the process has the input record defined as 80 bytes,
you should be fine.
Only other solution that I can think of is to bury a character in the 80th position and let the reading process ignore or change that character to a space when they read it in.
| User | Count |
|---|---|
| 3 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |