Skip to Content

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

How do I TRANSFER a blank line to a dataset?

Hey everyone,

Learning all about datasets today, and it seems clear enough. What I'm doing is outputting a "report" of sorts to a dataset during a batch process. I'm reporting on whether or not each transaction processes successfully, as well as providing a summary at the end.

I'd like to put a blank line in a few places, but when I try to TRANSFER what I believe should be a blank line, I don't see a blank line in the resulting file.

Here is my OPEN command:

OPEN DATASET w_dsn FOR OUTPUT IN TEXT MODE ENCODING DEFAULT.

I suppose if worse comes to worse, I can always output a "blank" line with some small character, such as a period.

Any ideas? Thanks so much!

Tags:
replied

I assumed that it worked how Amit has suggested, if not, have you tried using a CR. Check the code below for cl_abap_char_utilities=>cr_lf.


report zrich_0001.

parameters: d1 type localfile default '/usr/sap/TST/SYS/Data1.txt'.


data: begin of itab occurs 0,
      rec(200) type c,
      end of itab.

start-of-selection.

  itab-rec = 'This is record number 1'. append itab.
  itab-rec = 'This is record number 2'. append itab.

  open dataset d1 for output in text mode ENCODING DEFAULT.
  loop at itab.
    transfer itab to d1.
    transfer <b>cl_abap_char_utilities=>cr_lf</b> to d1.
  endloop.
  close dataset d1.

Regards,

Rich Heilman

0 View this answer in context
Not what you were looking for? View more on this topic or Ask a question