2009 Aug 31 8:34 AM
Hi experts,
I want to download the content of my internal table into an excel file while I'm debugging.
It's working fine, but my problem that the header of the coloumns are not downloaded. Is there any setting which can be set to be able to download the header?
2009 Aug 31 8:35 AM
2009 Aug 31 9:12 AM
You can do one thing, take the name of fields into one internal table then download the file with these field names then append the data of these fields into the same file
Example:
data: begin of itab occurs 0,
field1(10) type c,
field2(10) type c,
end of itab.
data: begin of itab1 occurs 0,
matnr like mara-matnr,
spart like mara-spart,
end of itab1.
itab-field1 = 'MATNR'.
itab-field2 = 'SPART'.
append itab.
call function 'GUI_DOWNLOAD'
exporting
BIN_FILESIZE =
filename = 'C:\test1.xls'
filetype = 'ASC'
tables
data_tab = itab.
if sy-subrc <> 0.
message id sy-msgid type sy-msgty number sy-msgno
with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
endif.
itab1-matnr = 'Material'.
itab1-spart = '40'.
append itab1.
call function 'GUI_DOWNLOAD'
exporting
filename = 'C:\test1.xls'
filetype = 'ASC'
append = 'X'
tables
data_tab = itab1.
2009 Aug 31 9:17 AM
Hi ,
in your case , you can take the help of check groups.
Please let me know if you still need any more help.
Thanks and regards,
Rajeshwar.
2009 Aug 31 9:26 AM
Hi White,
for getting the header just follow the sample code,
have all the header in an work area.
w_initial-matnr = 'Material Number'. "Material Number
w_initial-mtart = 'Material Type'. "Material Type
w_initial-mbrsh = 'Industry Sector '. "Industry Sector
w_initial-werks = 'Plant'. "Plant
w_initial-lgort = 'Storage Location'. "Storage Location
w_initial-vkorg = 'Sales Organization'. "Sales Organization
w_initial-vtweg = 'Distribution Channel'. "Distribution Channel
w_initial-maktx = 'Description'. "Material Description (Short Text)
w_initial-spras = 'Language Key'.
then while downloading pass this in the first line as below,
DATA : f_string TYPE string.
f_string = p_down.
INSERT w_initial INTO t_outdat INDEX 1.
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
* BIN_FILESIZE =
filename = f_string
filetype = 'ASC'
* APPEND = ' '
write_field_separator = 'X'
TABLES
data_tab = t_outdat[]
2009 Aug 31 9:39 AM
Hello,
In GUI_DOWNLOAD you can provide table FIELDNAMES for downloading header of the data.
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
* BIN_FILESIZE =
filename =
* FILETYPE = 'ASC'
* APPEND = ' '
* WRITE_FIELD_SEPARATOR = ' '
* HEADER = '00'
* TRUNC_TRAILING_BLANKS = ' '
* WRITE_LF = 'X'
* COL_SELECT = ' '
* COL_SELECT_MASK = ' '
* DAT_MODE = ' '
* CONFIRM_OVERWRITE = ' '
* NO_AUTH_CHECK = ' '
* CODEPAGE = ' '
* IGNORE_CERR = ABAP_TRUE
* REPLACEMENT = '#'
* WRITE_BOM = ' '
* TRUNC_TRAILING_BLANKS_EOL = 'X'
* IMPORTING
* FILELENGTH =
tables
data_tab = ---> Provide data internal table
* FIELDNAMES = ---> Provide single line internal table filled with column headers.
Hope this resolves your issue!
Thanks,
Augustin.
2009 Aug 31 9:48 AM
2009 Aug 31 10:09 AM
Hello,
In debugging mode you can place cursor on internal table in table view mode and right click to select "Save as excel sheet". It will ask for lines to download. So you give '0' to max number of lines you want to download and it will save data in xls file with header.
It worked for me. check if it helps!
Thanks,
Augustin.
2009 Aug 31 1:20 PM
Augustarian, I tired it but it says I cannot give 0 az a starting position.
2009 Aug 31 1:30 PM
Hi,
If you want download in debug mode. you can append line at the first row by clicking append button , now update first row details
with your header details. Now download from row 1 to EOF .
TC
Sajimon Chandran