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

Challenging Question : ABAP TRANSFER statement Issue

Hi SAP Gurus,

I am using statment

TRANSFER g_str TO p_unixf LENGTH 512.

to write the <i>g_str</i> to UNIX file <i>p_unixf</i>

I have some <b>BLANK</b> spaces at the end of each record which I want to retain in the UNIX FILE.

But TRANSFER statment writes only character ignoring the BLANK spaces at the end.

All the record length should be of 512 in UNIX FILE irrespective of what data contains in the record.

Help is much appreciated!

Thanks

Shital

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

2 Answers

  • author's profile photo Former Member
    Former Member
    Posted on Nov 10, 2007 at 02:15 AM

    Hi Shital,

    TRANSFER will write blank also. Just do one thing add "end of line"(EOL) character as the last character in each line of your file.

    Cl_ABAP_CHAR_UTILITIES=>CR_LF is the EOL character (Carriage return+line feed)

    Regards,

    Atish

    Message was edited by:

    Atish Sarda

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on May 10, 2009 at 05:24 PM

    Closing the thread.

    Add a comment
    10|10000 characters needed characters exceeded

    • Try use a field type X at end of structure of internal table will be transfered to file.

      For each line of internal table, place at type X field the value "0D" (CR).

      DATA: BEGIN OF ti_file OCCURS 0,
             tipo(3),     
             space1(1),
             seq(4),
             cnpj(14),
             ano(1),
             retif(1),
             stcd1(6),
             valor(14),
             cnae(7),    
             space10(10),
             cr TYPE vv_crlf VALUE '0D',     "Use this field to line wrap with spaces
            END OF ti_file.
      

      For each line of ti_file:

      LOOP AT ti_file.
      
      " Fill the fields
      
      ti_file-cr = '0D'.
      APPEND ti_file.
      CLEAR ti_file.
      
      

      Regards,

      Leonardo Valente

      Edited by: Leonardo Valente on Sep 8, 2009 2:48 PM

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.