02-11-2009 12:19 PM
Hi,
When the ALV output is export to excel the order of the columns changes in excel.
The columns with same header comes adjacently.
For eg: ALV output has the below columns in the order
"NAME1", "NAME2", "NAME3", "NAME2" .
When I export it to excel, the order becomes
"NAME1", "NAME2" , "NAME2", "NAME3".
How can I get the excel also in the same order as the ALV ouptut?
Regards,
Soumya.
02-11-2009 12:21 PM
hi,
you ca do it by using function module: 'GUI_DOWNLOAD'
DATA: l_file TYPE string.
l_file = p_file.
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
filename = l_file
filetype = 'ASC'
TABLES
data_tab = t_itab1
EXCEPTIONS
file_write_error = 1
no_batch = 2
gui_refuse_filetransfer = 3
invalid_type = 4
no_authority = 5
unknown_error = 6.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDFORM. " download
regards
rahul
02-11-2009 12:53 PM
hi!
you can explicitly provide the column positions with each field as:
DATA :
t_cat TYPE lvc_t_fcat,
w_cat TYPE lvc_s_fcat.
w_cat-col_pos = 1 (for a field in your program.)
APPEND w_cat TO t_cat.
Let the rest of the program be as it is.
02-12-2009 6:06 AM
Hi Richa,
I am concerned about the order of the columns in the excel and not in the ALV output.
In excel the order is not the same as that coming in the ALV output.
Regards,
Soumya.