Skip to Content
0
Former Member
Feb 28, 2007 at 09:51 AM

Transfer method not working

17 Views

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.