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

Data set Line feed

Former Member
0 Likes
679

Hi I am writing a file using data set.

But the each line doesnot start in a new line. how do i make it possible?

Points will be rewarded

thanks

My code is ...

OPEN DATASET p_unixfile FOR OUTPUT IN text mode ENCODING DEFAULT.

LOOP AT i_opfile INTO wa_opfile.

TRANSFER wa_opfile TO p_unixfile.

CLEAR wa_opfile.

ENDLOOP.

CLOSE DATASET p_unixfile.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
644

that logic sholud work.i am not getting why its not working.

your Itab record will be transferred record by record to your file.

check it again or download that file to presentation server using <b>CG3Y</b> transction and check it.

Regards

Srikanth

Hi I am writing a file using data set.

But the each line doesnot start in a new line. how do i make it possible?

Points will be rewarded

thanks

My code is ...

OPEN DATASET p_unixfile FOR OUTPUT IN text mode ENCODING DEFAULT.

LOOP AT i_opfile INTO wa_opfile.

TRANSFER wa_opfile TO p_unixfile.

CLEAR wa_opfile.

ENDLOOP.

CLOSE DATASET p_unixfile.

6 REPLIES 6
Read only

anversha_s
Active Contributor
0 Likes
644

hi,

use this.

CL_ABAP_CHAR_UTILITIES=>NEWLINE

Data: data_string type string.

data_string = '123456789'.

concatenate data_string cl_abap_char_utilities=>NEWLINE

into data_string.

rgds

anver

pls mark hlpful asnwers

Message was edited by: Anversha s

Read only

0 Likes
644

Hi,

Alternatively, you can use CL_ABAP_CHAR_UTILITIES=>CR_LF

Eddy

Read only

Former Member
0 Likes
644

Hi,

OPEN DATASET p_unixfile FOR OUTPUT IN <b>BINARY MODE</b> ENCODING DEFAULT.

LOOP AT i_opfile INTO wa_opfile.

TRANSFER wa_opfile TO p_unixfile.

CLEAR wa_opfile.

ENDLOOP.

CLOSE DATASET p_unixfile.

Regards

Sudheer

Read only

Former Member
0 Likes
645

that logic sholud work.i am not getting why its not working.

your Itab record will be transferred record by record to your file.

check it again or download that file to presentation server using <b>CG3Y</b> transction and check it.

Regards

Srikanth

Read only

Former Member
0 Likes
644

Hi s kantheri,

1. Your code is ok.

2. Since we are opening in TEXT mode,

new line will go automatically.

regards,

amit m.

Read only

0 Likes
644

Then when i open it in notepad using wordwrap..some of the lines are in same line.

Each opline should be displayed in different lines in the file right