Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

TRANSFER statment and CRLF

Hello!

I'm using the following line in my program to write a row from an itab to a file:

OPEN DATASET gv_outbfile FOR OUTPUT IN TEXT MODE ENCODING NON-UNICODE MESSAGE lv_errmsg.

When I download the file to my PC I notice that there's only a LF (0A) character at the end of the line. My functional guy wants a CR/LF pair at the end of each row so it will display properly in Notepad. How can I get the CRLF on the end of each row?

Tags:
Former Member
Former Member replied

You need to check addition LINEFEED & SET in open dataset

DATA: file TYPE string VALUE 'test1.dat',
      pos  TYPE i,
      text TYPE string.

OPEN DATASET file FOR OUTPUT IN TEXT MODE
                             ENCODING DEFAULT
                             WITH SMART LINEFEED.

TRANSFER: 'Line1' TO file,
          'Line2' TO file,
          'Line3' TO file.

SET DATASET file POSITION 0.
READ DATASET file INTO text.
SET DATASET file POSITION END OF FILE.

TRANSFER: 'Line4' TO file,
          'Line5' TO file,
          'Line6' TO file.

CLOSE DATASET file.

0 View this answer in context

Helpful Answer

by
Not what you were looking for? View more on this topic or Ask a question