2010 Dec 28 3:16 AM
when i download excel with funtion 'EXCEL_OLE_STANDARD_DAT' like below:
CALL FUNCTION 'EXCEL_OLE_STANDARD_DAT'
EXPORTING
FILE_NAME = 'E:\johnson.XLS'
DATA_SHEET_NAME = 'johnson'
TABLES
DATA_TAB = johnson
FIELDNAMES = johnson
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.
but i get the returned value: sy-subrc = 4 (instead of OLE_OBJECT_METHOD_ERROR = 4),
and the message type sy-msgty is space.
i don't konw the reason about it. i didn't find anything which can caused this.
some one can help me?
Edited by: Rio Chang on Dec 28, 2010 4:17 AM
when i download excel with funtion 'EXCEL_OLE_STANDARD_DAT' like below:
CALL FUNCTION 'EXCEL_OLE_STANDARD_DAT'
EXPORTING
FILE_NAME = 'E:\johnson.XLS'
DATA_SHEET_NAME = 'johnson'
TABLES
DATA_TAB = johnson
FIELDNAMES = johnson
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.
but i get the returned value: sy-subrc = 4 (instead of OLE_OBJECT_METHOD_ERROR = 4),
and the message type sy-msgty is space.
i don't konw the reason about it. i didn't find anything which can caused this.
some one can help me?
Edited by: Rio Chang on Dec 28, 2010 4:17 AM
2010 Dec 28 3:23 AM
Hi Rio,
Please be sur that you are passing the following values to the FM
CALL FUNCTION 'EXCEL_OLE_STANDARD_DAT' "
EXPORTING
file_name = " rlgrap-filename Name of download file
TABLES
data_tab = " Data table
fieldnames = " Table with column headers
2010 Dec 28 4:04 AM
Hi,
Please check if your data tab and fieldnames internal table are the same.
Please check if the fieldnames is declared as ..
DATA: BEGIN OF fieldnames OCCURS 0,
field(60),
END OF fieldnames.
CALL FUNCTION 'EXCEL_OLE_STANDARD_DAT'
EXPORTING
FILE_NAME = 'E:\johnson.XLS'
DATA_SHEET_NAME = 'johnson'
TABLES
DATA_TAB = johnson
FIELDNAMES = johnson
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.
Regards,
Srini.
2010 Dec 28 4:36 AM
Hi Chang,
There are two errors in the code you have posted.
1. The Data_tab and Fieldnames are using the same table johnson. (Logical error)
2. IF SY-SUBRC 0. ( No comparison operator)
Assuming that your actual code is correct,
1) Check if the 'E' drive exists.
2) Make sure that the table johnson is not initial.
Kindly let me know if this works.
If the error message doesnt automatically populate,
Go to SM91 and enter the Message Class as sy-msgid and Message Number as sy-msgno.
Regards,
Jovito.
2010 Dec 30 10:44 AM
REPORT zr_and_d.
DATA: K_LST LIKE ABAPLIST OCCURS 0 WITH HEADER LINE.
DATA: BEGIN OF k_L,
LINE(120),
END OF k_L.
DATA: TLX LIKE k_L OCCURS 0 WITH HEADER LINE.
DATA V_SHEET_NAME LIKE RLGRAP-FILENAME.
PARAMETERS: P_FNAME LIKE RLGRAP-FILENAME,
P_DATUM LIKE SY-DATUM.
SUBMIT ZTEST
WITH DATUM EQ P_DATUM
EXPORTING LIST TO MEMORY AND RETURN.
CALL FUNCTION 'LIST_FROM_MEMORY'
TABLES
LISTOBJECT = k_LST.
CALL FUNCTION 'LIST_TO_ASCI'
TABLES
LISTASCI = TLX
LISTOBJECT = k_LST
EXCEPTIONS
EMPTY_LIST = 1
LIST_INDEX_INVALID = 2
OTHERS = 3.
IF SY-SUBRC EQ 0 AND NOT k_LST IS INITIAL.
CONCATENATE 'ZTEST' P_DATUM INTO V_SHEET_NAME.
CALL FUNCTION 'EXCEL_OLE_STANDARD_DAT'
EXPORTING
FILE_NAME = P_FNAME
DATA_SHEET_NAME = V_SHEET_NAME
TABLES
DATA_TAB = TLX
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 NE 0.
WRITE:/ 'ERROR OPENING EXCEL'.
ENDIF.
ELSE.
WRITE:/ 'ERROR OR NO DATA'.
ENDIF.
| User | Count |
|---|---|
| 3 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |