Downloading internal tables to Excel using classes

by Diwakar

report  zdemo_program .
types: begin of t_excel,
       fld1(20) type c,
       fld2(20) type c,
       fld3(20) type c,
       end of t_excel.
data: it001 type table of t001.
data: xt001 type t001.
data: iexcel type table of t_excel.
data: xexcel type t_excel.
select * into table it001 from t001.
xexcel-fld1 = 'Field 1'.
xexcel-fld2 = 'Field 2'.
xexcel-fld3 = 'Field 3'.
append xexcel to iexcel.
loop at it001 into xt001.
  xexcel-fld1 = xt001-bukrs.
  xexcel-fld2 = xt001-butxt.
  xexcel-fld3 = xt001-ort01.
  append xexcel to iexcel.
call method cl_gui_frontend_services=>gui_download
    filename                = 'C:/test.xls'
    write_field_separator   = 'X'
    data_tab                = iexcel.


Please send us your feedback/suggestions at webmaster@SAPTechnical.COM 

HomeContribute About Us Privacy Terms Of Use • Disclaimer • SafeCompanies: Advertise on SAPTechnical.COM | Post JobContact Us  

Graphic Design by Round the Bend Wizards

footer image footer image