2010 Dec 03 3:59 PM
Hello,
We have a requisite to create a file on the Application Server (AS/400) with CRLF at the end of every record. The records are stored in this structure:
- OUTPUT: CHAR655, text to export;
- LENGTH: NUMC4, length of the record (text to export).
To create the file I have the following code:
open dataset lv_filename
for output in text mode
encoding default
with windows linefeed.
loop at pt_output into ls_output.
try.
clear lv_length.
lv_length = ls_output-length.
transfer ls_output-output to lv_filename
length lv_length.
catch cx_root into gv_oref.
* TODO
endtry.
endloop.
I have two problems:
1º When I open the file in Notepad++ the records should have 500 caracters (lv_length = 500), but it has 502;
2º Only LF appears, not CRLF.
Can anyone help me please?
Regards.
Hello,
We have a requisite to create a file on the Application Server (AS/400) with CRLF at the end of every record. The records are stored in this structure:
- OUTPUT: CHAR655, text to export;
- LENGTH: NUMC4, length of the record (text to export).
To create the file I have the following code:
open dataset lv_filename
for output in text mode
encoding default
with windows linefeed.
loop at pt_output into ls_output.
try.
clear lv_length.
lv_length = ls_output-length.
transfer ls_output-output to lv_filename
length lv_length.
catch cx_root into gv_oref.
* TODO
endtry.
endloop.
I have two problems:
1º When I open the file in Notepad++ the records should have 500 caracters (lv_length = 500), but it has 502;
2º Only LF appears, not CRLF.
Can anyone help me please?
Regards.
2010 Dec 03 5:22 PM
Hello,
Strangest thing, when I test it with 255 characters it works fine (CR+LF):
clear lv_string.
ls_output-output+254(1) = cl_abap_char_utilities=>cr_lf.
lv_string = ls_output-output+0(255).
transfer lv_string to lv_filename
length 255.
When I try with 256 characters it doesn't work, at the end of each record I can only find LF:
clear lv_string.
ls_output-output+255(1) = cl_abap_char_utilities=>cr_lf.
lv_string = ls_output-output+0(256).
transfer lv_string to lv_filename
length 256.
Don't understand why...
Regards.
2010 Dec 06 6:30 PM
You'lll notice in your reference to CR_LF that the result is 2 bytes.....look again at your cl_abap_char_utilities definition. In NotePad, I would not expect to see the CRLF on the end of the row.
2010 Dec 28 3:33 PM
The mentioned code was working, the problem was using FM EPS_FTP_PUT after.
Regards,
Mário Espinheira