Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Challenging Question : ABAP TRANSFER statement Issue

Former Member
0 Likes
1,189

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

Hi Shital,

Can you paste your code. How are you looking at file?

Regards,

Atish

7 REPLIES 7
Read only

Former Member
0 Likes
1,082

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

Read only

0 Likes
1,082

pls send the sample code.

Thanks

Shital

Read only

0 Likes
1,082

I m not in front of system..but it is not that hard just give your self a try and if any issue comes let me know.

Read only

0 Likes
1,082

Its not working its still gives the same file

Read only

0 Likes
1,082

Hi Shital,

Can you paste your code. How are you looking at file?

Regards,

Atish

Read only

Former Member
0 Likes
1,082

Closing the thread.

Read only

0 Likes
1,082

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