Skip to Content

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

Transfer from Internal Table to csv file

Hi,

Is it possible to downlad internal table to external file of type CSV ??

(The FM GUI_DOWNLOAD doesn't enable that)..

Thanks,

Tags:
Former Member
replied

You can use GUI_DOWNLOAD to do this, but you need to pass a flat table with the data separated by commas.


report zrich_0001 .

data: it001 type table of t001 with header line.
data: iout type table of string .
data: xout type string.
field-symbols: <fs>.

select * into table it001 from t001.

loop at it001.

  clear xout.
  do.
    assign component sy-index of structure it001 to <fs>.
    if sy-subrc <> 0.
      exit.
    endif.
    if sy-index = 1.
      xout = <fs>.
    else.
      concatenate xout <fs> into xout separated by ','.
    endif.
  enddo.

  append xout to iout.

endloop.

call function 'GUI_DOWNLOAD'
     exporting
          filename = 'C:test.csv'
     tables
          data_tab = iout.

Regards,

Rich Heilman

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