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: 

downloading internal table to application server file

Former Member
0 Kudos

I am trying to download internal table into an Excel application server file in and when i view that file i cannot see most of the fiels data in the file.The internal table has the whole data.Can anyone pls tell me how to get all the fields into the excel file and is it possible to give column headers for that file.

6 REPLIES 6

RichHeilman
Developer Advocate
Developer Advocate
0 Kudos

This works pretty good for me. You downloads as a comma delimited file which excel can open.



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>.

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

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.

open dataset d1 for output in text mode.
loop at iout into xout.
  transfer xout to d1.
endloop.
close dataset d1.

Regards,

Rich Heilman

0 Kudos

LOOP AT ITAB .

CONCATENATE ITAB-KUNNR ITAB-BBBNR ITAB-BBSNR ITAB-KTOKD ITAB-KUKLA

ITAB-LAND1 ITAB-NAME1 ITAB-NAME2 ITAB-NIELS ITAB-ORT01 ITAB-ORT02

ITAB-PSTLZ ITAB-REGIO ITAB-SORTL ITAB-SPRAS ITAB-STRAS ITAB-TELBX

ITAB-TELF1 ITAB-TELFX ITAB-LZONE ITAB-BRAN1 ITAB-TXJCD ITAB-HZUOR

ITAB-VKORG ITAB-VTWEG ITAB-SPART ITAB-VERSG ITAB-KALKS ITAB-KDGRP

ITAB-BZIRK ITAB-KONDA ITAB-AWAHR ITAB-EIKTO ITAB-WAERS ITAB-VKGRP

ITAB-VKBUR ITAB-VSBED ITAB-ANTLF ITAB-VWERK ITAB-INCO1 ITAB-INCO2

ITAB-KTGRD ITAB-BUKRS ITAB-ZUAWA ITAB-AKONT ITAB-ZTERM ITAB-ALTKN

ITAB-LOCKB ITAB-ALAND ITAB-TATYP ITAB-TAXKD ITAB-PARVW ITAB-KUNN2

ITAB-SNAME1 ITAB-SNAME2 ITAB-SORT01 ITAB-PSTLZ ITAB-REGIO ITAB-STRAS

ITAB-TELBX ITAB-TELF1

INTO ITABOUT SEPARATED BY ','.

APPEND ITABOUT.

CLEAR ITABOUT.

TRANSFER ITAB TO FILENAM1.

ENDLOOP.

ENDIF.

CLOSE DATASET FILENAM1.

ENDIF.

i used the above statements to download the file with comma delimited but still i dont see the data of all the fields in the application server

0 Kudos

Thanks Rich,

It worked out.i can see the whole data in application server now.I downloaded it in csv format but the user wants it in Excel.How can we convert it to excel file?

0 Kudos

Simply open the file with Excel. Right-click on it and choose "Open With" then Excel. That's it.

Regards,

Rich Heilman

Former Member
0 Kudos

Hi,

insert column heading at index 1 in your table

itab-field1 = 'TEST'.

insert itab at index 1.

loop at itab.

transfer itab to file.

endloop.

Regards,

Amole

Former Member
0 Kudos

I am trying to download internal table into an Excel application server file.I am not able to see all the data in the excel file after downloading.When i tried to download the same in .txt or .csv i can see all the details but i donno how to convert it into excel file after downloading.I appreciate if anyone can help me with this.