2008 Nov 04 6:21 AM
hi ,
I am using this function module for exporting my data of internal table into excel sheet. but when
data is export into excel sheet header means heading is not coming. please help me for that.
CALL METHOD CL_GUI_FRONTEND_SERVICES=>FILE_SAVE_DIALOG
EXPORTING
DEFAULT_EXTENSION = 'xls'
DEFAULT_FILE_NAME = L_FILE
CHANGING
FILENAME = L_FILE
PATH = L_PATH
FULLPATH = L_FULLPATH
USER_ACTION = L_ACT
EXCEPTIONS
CNTL_ERROR = 1
ERROR_NO_GUI = 2
OTHERS = 3.
FILENAME1 = L_FULLPATH.
IF NOT FILENAME1 IS INITIAL.
REFRESH field_head.
field_head-name = 'Process Name'. APPEND field_head.
field_head-name = 'Designation'. APPEND field_head.
field_head-name = 'EMP ID'. APPEND field_head.
field_head-name = 'First Name'. APPEND field_head.
field_head-name = 'Last Name'. APPEND field_head.
**refresh fieldnames.
*fieldnames-name = 'Process'. append fieldnames. clear fieldnames.
*fieldnames-name = 'degs'. append fieldnames. clear fieldnames.
*fieldnames-name = 'empid'. append fieldnames. clear fieldnames.
*
CALL FUNCTION 'MS_EXCEL_OLE_STANDARD_DAT'
EXPORTING
FILE_NAME = FILENAME1
TABLES
DATA_TAB = ITAB
FIELDNAMES = fieldnames
EXCEPTIONS
FILE_NOT_EXIST = 1
FILENAME_EXPECTED = 2
COMMUNICATION_ERROR = 3
OLE_OBJECT_METHOD_ERROR = 4
OLE_OBJECT_PROPERTY_ERROR = 5
INVALID_FILENAME = 6
INVALID_PIVOT_FIELDS = 7
DOWNLOAD_PROBLEM = 8
OTHERS = 9.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
ENDIF.
2008 Nov 04 12:00 PM