‎2005 Oct 26 7:59 AM
Hi folks,
Iam facing a peculiar problem when using GUI_DOWNLOAD.
TO download a header, iam using a MACRO which is as follows:
DEFINE add_field_header.
clear &1.
&1-field = &2.
append &1.
END-OF-DEFINITION.
Before calling GUI_DOWNLOAD, iam filling the header as follows:
add_field_header lt_fieldnames 'Record.No'.
add_field_header lt_fieldnames 'Lic.Type'.
add_field_header lt_fieldnames 'Ext.Lic.No'.
add_field_header lt_fieldnames 'Lic.Text'.
add_field_header lt_fieldnames 'Valid.From'.
add_field_header lt_fieldnames 'Valid.to'.
add_field_header lt_fieldnames 'Customer'.
add_field_header lt_fieldnames 'Vendor'.
add_field_header lt_fieldnames 'Cust.Grp'.
add_field_header lt_fieldnames 'Material'.
add_field_header lt_fieldnames 'Mat.Grp'.
add_field_header lt_fieldnames 'Country'.
add_field_header lt_fieldnames 'Region'.
add_field_header lt_fieldnames 'County'.
add_field_header lt_fieldnames 'City'.
add_field_header lt_fieldnames 'Mode.of.Transport'.
add_field_header lt_fieldnames 'Jurisdiction'.
Then, iam calling the Funcrtion module as follows:
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
FILENAME = lw_filepath
FILETYPE = 'DBF'
WRITE_FIELD_SEPARATOR = gc_x
TABLES
DATA_TAB = GT_OIHL_ERROR_AS
FIELDNAMES = lt_fieldnames
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
OTHERS = 22.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
But, the output excel file has header which is only 10 characters long... Ex:'Jurisdiction' is getting truncated to 'Jurisdicti'...
Moreover, any spaces between the words are getting removed. Example: If i give 'Record Number' it is printing it as 'RecordNumber' in the excel file in the header.
Is there any way by which i can avoid the truncation as well as retain the spaces ?
Thanks and Regards,
Vijay
‎2005 Oct 26 8:12 AM
try this approach.
lets say your itab has 5 fields.
then create a structure like below.
data: begin of wa_header occurs 0,
col1(100),
col2(100),
col3(100 ,
col4(100) ,
col5(100) ,
end of wa_header .
now fill wa_header with header text.
move: 'Column1 heading' to wa_header-col1 ,
'Column2 heading' to wa_header-col2 ,
....
'Column5 heading' to wa_header-col5 .
append wa_header .
now download wa_header using GUI_DOWNLOAD
then download the actual itab (with data) using GUI_DOWNLOAD with APPEND = 'X' .
Hope this helps.
Regards
Raja
‎2005 Oct 26 9:41 AM
Hi Raja,
I had tried this before, but since i am downloading in DBF format, it is giving an header F1, F2, ....
Any other way out?
‎2005 Oct 26 11:18 AM
hi,
Using GUI_download you can't solve your problem because it is condensing the fieldnames and it is also fixing the size to 10 if it is greater then 10 in fm it is reset to 10.
try seeing other fm .
regards
manohar.