‎2007 Feb 23 8:21 PM
Hello All,
I am trying to export data to Excel from a report output. Its a simple report. I have tried the below FM
CALL FUNCTION 'RH_START_EXCEL_WITH_DATA'
EXPORTING
DATA_FILENAME =
DATA_PATH_FLAG = 'W'
DATA_ENVIRONMENT =
DATA_TABLE =
MACRO_FILENAME =
MACRO_PATH_FLAG = 'E'
MACRO_ENVIRONMENT =
WAIT = 'X'
DELETE_FILE = 'X'
EXCEPTIONS
NO_BATCH = 1
EXCEL_NOT_INSTALLED = 2
INTERNAL_ERROR = 3
CANCELLED = 4
DOWNLOAD_ERROR = 5
NO_AUTHORITY = 6
FILE_NOT_DELETED = 7
OTHERS = 8
.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
This FM when executed without passing any data is able to open an empty excel sheet but when I try to pass an internal table to DATA_TABLE its giving a dump. The run time error is CALL_FUNCTION_CONFLICT_TYPE.
Error:
**"The function module interface allows you to specify only fields
of a particular type under "TABNAME". The field "ITAB1" specified here
has a different field type."**
Please let me know if Im missing something.
Thanks in advance.
‎2007 Feb 23 8:26 PM
Hi SAP,
Simply List -> Save -> File -> spreadsheet -> file.xls
Or check this weblog..
<a href="/people/dennis.vandenbroek/blog/2007/02/14/simple-function-module-to-export-any-internal-table-to-ms-excel:///people/dennis.vandenbroek/blog/2007/02/14/simple-function-module-to-export-any-internal-table-to-ms-excel
or
try this code..
DATA : file_name TYPE ibipparms-path,
lc_filename TYPE string.
CALL FUNCTION 'F4_FILENAME'
EXPORTING
PROGRAM_NAME = SYST-CPROG
DYNPRO_NUMBER = SYST-DYNNR
FIELD_NAME = ' '
IMPORTING
file_name = file_name .
lc_filename = file_name.
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
BIN_FILESIZE =
filename = lc_filename
filetype = 'DAT'
TABLES
data_tab = gt_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.
Revert back for more help
Reward points if helpful
Regards
Naresh
‎2007 Feb 23 8:27 PM
Hi,
Check if the data type of the interface parameter matches your data type declaration in your program..
Looks like the ITAB1 declaration is not matching the FM parameter data type..
Thanks,
Naren
‎2007 Feb 23 8:29 PM
Hi,
I used hi FM but dont remember exactly right now but you may take a look at this standard report -
RHVERI_EXCEL_DOWNLOAD
I think call to that class is must.
Regards,
Amit
Reward all helpful replies.
‎2007 Feb 23 8:36 PM