Skip to Content
author's profile photo Former Member
Former Member

Transfer method not working

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.

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

1 Answer

  • Posted on Feb 28, 2007 at 09: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

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member

      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

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.