Application Development 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: 

Line break problem in open DATAset after additon LENGTH NO END OF LINE .

former_member194669
Active Contributor
0 Kudos

Here is the code i am using for open dataset and transfer, but giving LENGTH and NO END OF LINE also i am getting the line break


  open dataset gv_fname  for output in text mode encoding utf-8.
  if sy-subrc <> 0.
    raise open_data_set_error.
  endif.
  data : lv_ln type i.
  lv_ln = strlen( it_istring ).
  transfer it_istring to gv_fname length lv_ln NO END OF LINE .
  close dataset gv_fname.

How to avoid line break

1 ACCEPTED SOLUTION

Clemenss
Active Contributor
0 Kudos

Hi a®s,

it is not visible what the content and datatype of it_istring is.

replace all occurences of:
  cl_abap_char_utilities=>cr in it_istring with '',
  cl_abap_char_utilities=>cr_lf in it_istring with '',
  cl_abap_char_utilities=>newline in it_istring with ''.

Regards,

Clemens

8 REPLIES 8

Clemenss
Active Contributor
0 Kudos

Hi a®s,

it is not visible what the content and datatype of it_istring is.

replace all occurences of:
  cl_abap_char_utilities=>cr in it_istring with '',
  cl_abap_char_utilities=>cr_lf in it_istring with '',
  cl_abap_char_utilities=>newline in it_istring with ''.

Regards,

Clemens

0 Kudos

Hi,

After giving your suggested code also still line break is showing

Clemenss
Active Contributor
0 Kudos

Hi,

what is content and datatype of it_istring?

and where (how) do you see line break?

I will try.

Regards,

Clemens

0 Kudos

The type it_istring is TPEC(3200) C. and content is simple XML tags in txt format i am seeing the cursor get stops in the nex lines when i open the file

Former Member
0 Kudos

TRANSFER statement with text mode will by default adds a line break at the end of the line. Try opening the file in the binary mode, so that the string is preserved unless you pass explicit line breaks.

Regards

Ranganath

Clemenss
Active Contributor
0 Kudos

Hi a®s,

if I understand you right you did not identify any linefeed characters in the output file but the program you open the file with inserts the line breaks.

The question might be what you want to achieve.

You may open the file for input after writing and closing and then READ DATASET into a string. Then check what the string contains where you observe line breaks.

Regards,

Clemens

Former Member
0 Kudos

Also if your content is XML, open the file in notepad to see if there are linebreaks? May be the program that you are using for reading XML inserts the line break?

0 Kudos

I know this is 13 years old...but if anyone is looking for the answer: use addition "NO END OF LINE" in your transfer statement to avoid the final line break.