2009 Jul 14 11:27 AM
Hi,
I am downloading few records from one internal table.But While downloading I want to add the filed names(to identify which record belongs to which field) too.Can anyone help me with some sample code for this?Thanks.
2009 Jul 14 12:05 PM
Hi, Do this way. <li>Take headers in one table. Download that table using cl_gui_frontend_services=>gui_download. Here u need to set Append parameter as ' '. <li>Take data in another table. Download that table using cl_gui_frontend_services=>gui_download. Here u need to set Append parameter as 'X'. <li>When you call cl_gui_frontend_services=>gui_download method first time it creates file and keeps the header and when u call second time it appends to the existing file. File path should be same. I hope that it solves your problem. Thanks Venkat.O
Hi, Do this way. <li>Take headers in one table. Download that table using cl_gui_frontend_services=>gui_download. Here u need to set Append parameter as ' '. <li>Take data in another table. Download that table using cl_gui_frontend_services=>gui_download. Here u need to set Append parameter as 'X'. <li>When you call cl_gui_frontend_services=>gui_download method first time it creates file and keeps the header and when u call second time it appends to the existing file. File path should be same. I hope that it solves your problem. Thanks Venkat.O
2009 Jul 14 11:29 AM
Hi
Before downloading the internal table.
First transfer all heading into one area and insert into u r internal table with index 1.
2009 Jul 14 11:35 AM
Hi,
Are you downloading the internal table to a excel sheet? Then use FM 'GUI_DOWNLOAD'.In that FM,in the TABLES parameter list,set the parameterFIELDNAMES. like the following way.
TYPES : BEGIN OF ty_header,
fieldname(100) TYPE c,
END OF ty_header.
DATA:it_head TYPE TABLE OF ty_header,
wa_head TYPE ty_header.
then call a subroutine like the following one before calling the FM.
form BUILD_HEADING .
CLEAR wa_head.
wa_head-fieldname = 'PersonnelId'.
APPEND wa_head TO it_head.
CLEAR wa_head.
wa_head-fieldname = 'StartDate'.
APPEND wa_head TO it_head.
CLEAR wa_head.
wa_head-fieldname = 'EndDate'.
APPEND wa_head TO it_head.
CLEAR wa_head.
wa_head-fieldname = 'Reason'.
APPEND wa_head TO it_head.
CLEAR wa_head.
wa_head-fieldname = 'WageType'.
APPEND wa_head TO it_head.
CLEAR wa_head.
wa_head-fieldname = 'NewHourlyRate'.
APPEND wa_head TO it_head.
CLEAR wa_head.
wa_head-fieldname = 'NewAnnualSalary'.
APPEND wa_head TO it_head.
CLEAR wa_head.
endform. " BUILD_HEADING
finally call the FM where you have to set..........
Tables
FIELDNAMES = it_head.
Hope it helps you.
Regards.
Sarbajit.
2009 Jul 14 11:37 AM
Hi,
You need to append the header names.
Check this Wiki
[https://wiki.sdn.sap.com/wiki/display/Snippets/downloaddataintoexcelwith+header]
Link
Regards
Sarves
2009 Jul 14 11:56 AM
Hi All,
Thanks for the reply.But I am downloading one tab delimated file using cl_gui_frontend_services=>gui_download.
2009 Jul 14 12:05 PM
Hi, Do this way. <li>Take headers in one table. Download that table using cl_gui_frontend_services=>gui_download. Here u need to set Append parameter as ' '. <li>Take data in another table. Download that table using cl_gui_frontend_services=>gui_download. Here u need to set Append parameter as 'X'. <li>When you call cl_gui_frontend_services=>gui_download method first time it creates file and keeps the header and when u call second time it appends to the existing file. File path should be same. I hope that it solves your problem. Thanks Venkat.O
| User | Count |
|---|---|
| 3 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |