2007 Mar 16 5:40 PM
Hi, all,
I am using ALSM_EXCEL_TO_INTERNAL_TABLE to move data from excel to a internal table. I got following errors. Please anyone can tell me where is wrong. Thanks. (the excel file does not have header line).
An exception occurred that is explained in detail below.
The exception, which is assigned to class 'CX_SY_DYN_CALL_ILLEGAL_TYPE', was
not caught in
procedure "ALSM_EXCEL_TO_INTERNAL_TABLE" "(FUNCTION)", nor was it propagated by
a RAISING clause.
Since the caller of the procedure could not have anticipated that the
exception would occur, the current program is terminated.
The reason for the exception is:
The FORM "SEPARATED_TO_INTERN_CONVERT" was called incorrectly.
The call of the FORM is incorrect for parameter nr. 2:
The internal table that is transferred to the formal table parameter has
a type that is not compatible with the type of the formal parameter.
The FORM "SEPARATED_TO_INTERN_CONVERT" is defined in the program "SAPLALSMEX".
The conditions flagged below have been violated:
(" ") The access types specified for the table are not compatible. The
compatibility rules are defined by the following hierarchy:
ANY_TABLE (INDEX_TABLE (STANDARD_TABLE, SORTED_TABLE), HASHED_TABLE)
A fixed access type is only compatible with its predecessors in
the hierarchy (example: STANDARD_TABLE is compatible with
INDEX_TABLE and ANY_TABLE, but is not compatible with HASHED_TABLE).
("X") The row types of the two tables are not compatible.
("X") The table keys of the two tables do not match.
(" ") One of the two tables is defined with a unique key (UNIQUE); the
other is defined with a non-unique key (NON-UNIQUE).
2007 Mar 16 6:53 PM
May be you can try with this.
data : wa_raw type truxs_t_text_data.
call function 'TEXT_CONVERT_XLS_TO_SAP'
exporting
i_tab_raw_data = wa_raw
i_filename = p_filename
tables
i_tab_converted_data = i_etab[]
exceptions
conversion_failed = 1
others = 2.
aRs
Hi, all,
I am using ALSM_EXCEL_TO_INTERNAL_TABLE to move data from excel to a internal table. I got following errors. Please anyone can tell me where is wrong. Thanks. (the excel file does not have header line).
An exception occurred that is explained in detail below.
The exception, which is assigned to class 'CX_SY_DYN_CALL_ILLEGAL_TYPE', was
not caught in
procedure "ALSM_EXCEL_TO_INTERNAL_TABLE" "(FUNCTION)", nor was it propagated by
a RAISING clause.
Since the caller of the procedure could not have anticipated that the
exception would occur, the current program is terminated.
The reason for the exception is:
The FORM "SEPARATED_TO_INTERN_CONVERT" was called incorrectly.
The call of the FORM is incorrect for parameter nr. 2:
The internal table that is transferred to the formal table parameter has
a type that is not compatible with the type of the formal parameter.
The FORM "SEPARATED_TO_INTERN_CONVERT" is defined in the program "SAPLALSMEX".
The conditions flagged below have been violated:
(" ") The access types specified for the table are not compatible. The
compatibility rules are defined by the following hierarchy:
ANY_TABLE (INDEX_TABLE (STANDARD_TABLE, SORTED_TABLE), HASHED_TABLE)
A fixed access type is only compatible with its predecessors in
the hierarchy (example: STANDARD_TABLE is compatible with
INDEX_TABLE and ANY_TABLE, but is not compatible with HASHED_TABLE).
("X") The row types of the two tables are not compatible.
("X") The table keys of the two tables do not match.
(" ") One of the two tables is defined with a unique key (UNIQUE); the
other is defined with a non-unique key (NON-UNIQUE).
2007 Mar 16 5:43 PM
This error is due to the error in table format used for passing data from the FM.
Check your table declarations for the FM & for final table for moving the data.
Also, if you have declared you file fields as-
PARAMETERS : P_FILE LIKE RLGRAP-FILENAME.
then pass it to string before passing it to Function module for upload.
Regards,
Amit
2007 Mar 16 5:56 PM
Hi, Amit,
What I am doing is, I downloaded the table A's contents from PRD to my PC as excel file using GUI_DOWNLOAD. And then I want to put the data from that excel into the same table A in QA for my program testing. I declared the table for FM with "type table of A with header line". Do you think it is wrong? Thank you!
Meiying
2007 Mar 16 5:59 PM
You have downloaded using GUI_DOWNLOAD.
Do check the downloaded file as if it is not formatted then all the data is actually downloaded in a single cell only, which is creating problem while uploading.
Regards,
Amit
2007 Mar 16 6:44 PM
I checked the the downloaded file. It is well formartted. But I am wandering if I need to delete the collum mandt (client) field? Thank you!
Meiying
2007 Mar 16 6:53 PM
Yes that field need to be deleted.
And if still error persis can you poset your code here for uploading the excel.
Regards,
Amit
2007 Mar 16 7:14 PM
Hi, Amit,
I see where is my problem now. I got the answer from thread
I declared my int_excel as "type table of A(my database table) with header line. I should declare it as " LIKE alsmex_tabline OCCURS 0 WITH HEADER LINE."
Then when I put int_excel to my actual inter table, do I HAVE TO do like the thread said go thru each column? I have over 10000 rows and 54 columns. Thank you!
LOOP AT int_excel.
CASE int_excel-col. "go thru each column.
WHEN 1.
record-name = int_excel-value.
WHEN 2.
record-age = int_excel-value.
ENDCASE.
AT END OF row.
APPEND record.
CLEAR record.
ENDAT.
ENDLOOP.
2007 Mar 16 6:53 PM
May be you can try with this.
data : wa_raw type truxs_t_text_data.
call function 'TEXT_CONVERT_XLS_TO_SAP'
exporting
i_tab_raw_data = wa_raw
i_filename = p_filename
tables
i_tab_converted_data = i_etab[]
exceptions
conversion_failed = 1
others = 2.
aRs
2007 Mar 16 7:49 PM
Hi,
I think there will be a limitation for this fm ALSM_EXCEL_TO_INTERNAL_TABLE
less than equal 50 character length field only can upload.
aRs
2007 Mar 16 7:56 PM
Hi, aRs,
Thanks for the reply. I tried your FM 'TEXT_CONVERT_XLS_TO_SAP'. But I got error says " conversion_failed ". Would you please provide sample program for how to use this FM? Thanks. I am trying to save my excel to txt, and then use FM "GUI_UPLOAD". Still give me error says " BAD_DATA_FORMAT".
2007 Mar 16 8:26 PM
Hi,
Example u asked for
REPORT zupload_excel_to_itab.
TYPE-POOLS: truxs.
PARAMETERS: p_file TYPE rlgrap-filename.
TYPES: BEGIN OF t_datatab,
col1(30) TYPE c,
col2(30) TYPE c,
col3(30) TYPE c,
END OF t_datatab.
DATA: it_datatab type standard table of t_datatab,
wa_datatab type t_datatab.
DATA: it_raw TYPE truxs_t_text_data.
* At selection screen
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.
CALL FUNCTION 'F4_FILENAME'
EXPORTING
field_name = 'P_FILE'
IMPORTING
file_name = p_file.
***********************************************************************
*START-OF-SELECTION.
START-OF-SELECTION.
CALL FUNCTION 'TEXT_CONVERT_XLS_TO_SAP'
EXPORTING
* I_FIELD_SEPERATOR =
i_line_header = 'X'
i_tab_raw_data = it_raw " WORK TABLE
i_filename = p_file
TABLES
i_tab_converted_data = it_datatab[] "ACTUAL DATA
EXCEPTIONS
conversion_failed = 1
OTHERS = 2.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
***********************************************************************
* END-OF-SELECTION.
END-OF-SELECTION.
LOOP AT it_datatab INTO wa_datatab.
WRITE:/ wa_datatab-col1,
wa_datatab-col2,
wa_datatab-col3.
ENDLOOP.
2007 Mar 16 9:32 PM
Thank you very much, aRs! But still saying conversion_failed. I am out of enage.
2007 Mar 16 11:46 PM
Please give your email id, i will send u the excel format and program
aRs
2007 Mar 20 2:08 PM
I will get back to this one later. I have an urgent task right now. Thanks all. I will certainly award useful answer.
Meiying
2007 Mar 21 6:00 PM
The problem has been solved by myself. I successful did it using FM GUI_UPLOAD.
Meiying
| User | Count |
|---|---|
| 3 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |