‎2007 Feb 28 9:51 AM
Hi,
I have this code to transfer a file, but it doesn't do what I want.
PARAMETERS p_output TYPE rlgrap-filename.
DATA: BEGIN OF e_output,
text(10) TYPE c,
filler(10) TYPE c.
DATA: END OF e_output.
DATA: wa_text(10) TYPE c VALUE 'Test Data'.
MOVE wa_text TO e_output-text.
OPEN DATASET p_output FOR OUTPUT IN TEXT MODE ENCODING DEFAULT.
TRANSFER e_output TO p_output.
CLOSE DATASET p_output.
What I want in the output is 'Test Data___________'. With the filler showing as blank spaces, the spaces don't work in this forum, so I have represented them with _.
I have found that it respecs the spaces if I use this code.
CLASS: cl_abap_char_utilities DEFINITION LOAD.
PARAMETERS p_output TYPE rlgrap-filename.
DATA: BEGIN OF e_output,
text(10) TYPE c,
filler(200) TYPE c,
c_ret TYPE c VALUE cl_abap_char_utilities=>cr_lf.
DATA: END OF e_output.
DATA: wa_text(10) TYPE c VALUE 'Test Data'.
MOVE wa_text TO e_output-text.
OPEN DATASET p_output FOR OUTPUT IN TEXT MODE ENCODING DEFAULT.
TRANSFER e_output TO p_output.
CLOSE DATASET p_output.
But then I have an extra line caused by the carriage return. Any ideas how I can do this? Just to add, I am on unicode.
‎2007 Feb 28 9:54 AM
HI jez,
Put a break point at te OPEN dataset statement and see if the open dataset statement is successfull or not.
If it is not, then you may not have the write permission on the application server or the file name is wrong.
Regards,
Ravi
‎2007 Feb 28 9:56 AM
Hi,
The file transfers OK, the problem is the spaces are not present on the output file. I thought the filler would be output as 10 blank spaces on the end of the data element, but it doesn't output them unless I have a carriage return on the end.
Thanks