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: 

Adding titlles while loading on App. Server...urgent!!!

Former Member
0 Kudos

hello everyone,

This is what i'm doing:

*********************************************************

Open dataset....

Loop at internal table.

*Collect all data

*Concatenating all fields into string separated by comma

transfer string to string1

Endloop.

close dataset.

********************************************************

I need to add headings/titles corresponding to the fields that i'm concatenating into the string so that when i open the file on the App. Server I see the titles corresponding to the data.

How can I do that?

Thanks in advance.

Regards,

Fred.

1 ACCEPTED SOLUTION

LucianoBentiveg
Active Contributor
0 Kudos

Open dataset....

Loop at internal table.

at first.

  • Concatenating all headings into string separated by

  • comma

transfer string to string1

endat.

*Collect all data

*Concatenating all fields into string separated by comma

transfer string to string1

Endloop.

close dataset.

2 REPLIES 2

LucianoBentiveg
Active Contributor
0 Kudos

Open dataset....

Loop at internal table.

at first.

  • Concatenating all headings into string separated by

  • comma

transfer string to string1

endat.

*Collect all data

*Concatenating all fields into string separated by comma

transfer string to string1

Endloop.

close dataset.

RichHeilman
Developer Advocate
Developer Advocate
0 Kudos

Just write to the dataset before the loop.

report zrich_0001.


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


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


start-of-selection.

* Open
  open dataset d2 for output in text mode.

<b>* Write headings
  wa = 'Field1,Field2,Field3,Field4,Field5'.
  transfer wa to d2.</b>

* Write detail from itab
  loop at itab.
    transfer itab to d2.
  endloop.

* Close it
  close dataset d2.

Regards,

Rich Heilman