2016 Feb 03 5:24 PM
Hi all,
I have a requirement to download internal table to excel sheet including header.In my method cl_gui_fronted_services=>gui_download I used file type DBF. But when I download data to presentation sever header field names truncated to 10 characters. Anyone could you please suggest how to get full length header using file type DBF.
Code:
CALL METHOD cl_gui_frontend_services=>gui_download
EXPORTING
filename = lv_file_path1
filetype = 'DBF'
write_field_separator = 'X'
fieldnames = gt_header[]
CHANGING
data_tab = gt_finaldata[]
EXCEPTIONS
file_write_error = 1
no_batch = 2
gui_refuse_filetransfer = 3
invalid_type = 4
no_authority = 5
unknown_error = 6
header_not_allowed = 7
separator_not_allowed = 8
filesize_not_allowed = 9
header_too_long = 10
dp_error_create = 11
dp_error_send = 12
dp_error_write = 13
unknown_dp_error = 14
access_denied = 15
dp_out_of_memory = 16
disk_full = 17
dp_timeout = 18
file_not_found = 19
dataprovider_exception = 20
control_flush_error = 21
not_supported_by_gui = 22
error_no_gui = 23
OTHERS = 24.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
Thanks in Advance,
Suneel.Uggina.
Hi all,
I have a requirement to download internal table to excel sheet including header.In my method cl_gui_fronted_services=>gui_download I used file type DBF. But when I download data to presentation sever header field names truncated to 10 characters. Anyone could you please suggest how to get full length header using file type DBF.
Code:
CALL METHOD cl_gui_frontend_services=>gui_download
EXPORTING
filename = lv_file_path1
filetype = 'DBF'
write_field_separator = 'X'
fieldnames = gt_header[]
CHANGING
data_tab = gt_finaldata[]
EXCEPTIONS
file_write_error = 1
no_batch = 2
gui_refuse_filetransfer = 3
invalid_type = 4
no_authority = 5
unknown_error = 6
header_not_allowed = 7
separator_not_allowed = 8
filesize_not_allowed = 9
header_too_long = 10
dp_error_create = 11
dp_error_send = 12
dp_error_write = 13
unknown_dp_error = 14
access_denied = 15
dp_out_of_memory = 16
disk_full = 17
dp_timeout = 18
file_not_found = 19
dataprovider_exception = 20
control_flush_error = 21
not_supported_by_gui = 22
error_no_gui = 23
OTHERS = 24.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
Thanks in Advance,
Suneel.Uggina.
2016 Feb 03 6:05 PM
Truncation of column names is an issue with GUI_DOWNLOAD. you can either use column names that are 10 characters or less or use a different method of downloading.
FM XXL_SIMPLE_API comes to mind.
Rob
2016 Feb 03 6:12 PM
I guess the header field name in dbf file is kind of a column name in the table and the length of that is 10. That is the reason why you were not able to create the header with more than 10 characters.
Moreover you can not have spaces in the header field, even if you give it will not take it.
-Chandra
2016 Feb 03 6:57 PM
Thank you Rob and Chandra.Could you please suggest any other alternative way to download excel including header to my presentation server.
Regards,
Suneel.uggina
2016 Feb 03 7:01 PM
2016 Feb 03 7:02 PM
I guess the approach you are following is right. What is the issue if the header length is less than or equal to 10? What are you trying to do with this file once you download?
If you change the file format to 'ASC' then you will NOT have the restriction for header length of 10.
2016 Feb 04 4:47 AM
Yes Chandra. If I changed the file format to 'ASC' or 'DAT' then I am not getting any restrictions on
Header length. While opening the downloaded file getting a prompt message " your file is not in .xls format. Click on YES to open.If I opened the file I am not getting exact number of records. that is the reason I am using 'DBF' Format.
2016 Feb 04 2:29 PM
Give the file name with extension .xls (eg: C:\...\test.xls), it should solve your problem. I tried it and it is not a giving any popup message.
2016 Feb 04 4:29 AM
hi.
may be check ur alv grid field catalogs settings.
output length mentioned as 10 char?
or
u mentioned long, medium, and short descriptions.
if mentioned output length mentioned as 10 char , remove that.
if mentioned u mentioned long, medium, and short descriptions, then use only long description only.
if mentioned ref table and ref field then use long, medium, and short descriptions, and reptext_ddic description ALSO
2016 Feb 04 2:42 PM
2016 Feb 09 10:14 AM
Hi all,
Thanks everyone.. I solved the issue. I used file format 'DAT' for downloading internal table data to Excel including Header having Field length more than 10 characters..When I download internal table data to Excel sheet the fields which consists '#' causes the data corruption.
For this issue I replaced '#' with Horizontal tab. Now I am getting data in Excel sheet as expected.
Regards,
Suneel.Uggina