‎2009 May 11 12:38 PM
Dear All,
I have used a standard FM MS_EXCEL_OLE_STANDARD_DAT to get the data from internal table directly into excel.
But the issue is if the length of Header field and Respective Item field is not equal then i am getting short dump.
I should have the item table field data should be independent of Header data field length.
eg:
Project Status Start Date
NOCH 4/1/2008
in the above given eg header of 1st field Project Status is 14 char, where as NOCH is only 4 char,
but when i give the same i am getting Short dump when i give NOCH also of 14 char then it is not giving any short dump.
Appreciate for any replys
Thanks & Regards
NSK
‎2009 May 11 12:43 PM
Hello,
For all the fields take the largest value i.e if the header is 14chars then take NOCH value has 14 dont take 4char.
Example:
Check this 4programes they are using same FM
LKKBLF90
LRPPCU06
LSLFBF1H
RPTLEA00.
‎2009 May 11 12:49 PM
Kindly Refer ...
TABLES: USR03,DD02L.
DATA: YX030L LIKE X030L.
DATA BEGIN OF YDFIES OCCURS 0.
INCLUDE STRUCTURE DFIES.
DATA END OF YDFIES.
DATA: BEGIN OF FLDITAB OCCURS 0,
FLDNAME(11) TYPE C,
END OF FLDITAB.
DATA ITABUSR03 LIKE USR03 OCCURS 0 WITH HEADER LINE.
DATA TNAME LIKE DD02L-TABNAME.
SELECT * FROM USR03 INTO TABLE ITABUSR03.
TNAME = 'USR03'.
PERFORM GETFIELEDS.
PERFORM SHOW123.
********************************************
FORM GETFIELEDS.
CALL FUNCTION 'GET_FIELDTAB'
EXPORTING
LANGU = SY-LANGU
ONLY = SPACE
TABNAME = TNAME
WITHTEXT = 'X'
IMPORTING
HEADER = YX030L
TABLES
FIELDTAB = YDFIES
EXCEPTIONS
INTERNAL_ERROR = 01
NO_TEXTS_FOUND = 02
TABLE_HAS_NO_FIELDS = 03
TABLE_NOT_ACTIV = 04.
CASE SY-SUBRC.
WHEN 0.
LOOP AT YDFIES.
FLDITAB-FLDNAME = YDFIES-FIELDNAME.
APPEND FLDITAB.
ENDLOOP.
WHEN OTHERS.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
with SY-SUBRC.
ENDCASE.
ENDFORM.
***********************************
FORM SHOW123.
CALL FUNCTION 'MS_EXCEL_OLE_STANDARD_DAT'
EXPORTING
FILE_NAME = 'C:USR03.XLS'
DATA_SHEET_NAME = 'USER LIST'
TABLES
DATA_TAB = ITABUSR03
FIELDNAMES = FLDITAB
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.
ENDFORM.
Regards
Renu
‎2009 May 11 12:51 PM
HI,
Try using GUI_DOWNLOAD FM...you will not face this problem.
l_fullpath = p_fullpath.
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
filename = l_fullpath
filetype = 'DAT' "---> File type for Excel
TABLES
data_tab = i_final[]
fieldnames = i_fieldnames "--> Field names
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.
‎2009 May 11 1:45 PM
Hi Avinash,
Although i am using GUI_DOWNLOAD, when i am taking a dump i am getting the file in Unconverted format instead of in Excel format. Again i need to open it with Excel.
Are there any setting more to be made in FM.
Thanks for ur valuable reply.
Thanks & Regards
NSK