2009 Oct 20 2:11 PM
Hi Friends,
I have gone thro the forum threads a lot , but could not find solution to my problem.
I have data in excel sheet and I have to get this into an internal table.
PLEASE NOTE THAT I AM USING ECC6.0 (syatem data: SAP EHP 1 for SAP NetWeaver 7.0).
Hence, options of using ALSM_EXCEL_TO_INTERNAL_TABLE and KCD_EXCEL_OLE_TO_INT_CONVERT are ruled out. I am getting error that these function modules do not exist. Also, type-pool TRUXS does not exist.
And, GUI_UPLOAD is giving me junk data into internal table.
So, please help me by giving any other function modules so that I can upload my data in excel file to internal table.
Thanks in Advance.
Regards,
Krish.
Hi,
Save the excel file as tab delimited file and then refer to the given snippet:
DATA: lv_filetype(10) TYPE c,
lv_gui_sep TYPE c,
lv_file_name TYPE string.
lv_filetype = 'ASC'.
lv_gui_sep = 'X'.
lv_file_name = pa_dfile. >> file path
FM call to upload file
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename = lv_file_name
filetype = lv_filetype
has_field_separator = lv_gui_sep
TABLES
data_tab = gi_zhralcon_file > internal table
Hope it helps.
Regards,
Rajesh Kumar
2009 Oct 20 2:19 PM
Hi,
Try this
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename = filename
FILETYPE = 'DBF' ----->use this type will work
Regards,
Anil
Edited by: M Srinivasa Anil Kumar on Oct 20, 2009 6:55 PM
Edited by: M Srinivasa Anil Kumar on Oct 20, 2009 6:56 PM
2009 Oct 21 6:04 AM
Hi Anil,
I have tried using filetype DBF, but I am getting error 'Wrong value of the parameter FILETYPE'.
So, i guess i cannot use this filetype.
Regards,
Krish.
2009 Oct 21 7:49 AM
null
Edited by: M Srinivasa Anil Kumar on Oct 21, 2009 12:24 PM
Edited by: M Srinivasa Anil Kumar on Oct 21, 2009 12:24 PM
2009 Oct 20 2:36 PM
type-pools : truxs.
Internal table declaartion for excel file
data : it_raw type truxs_t_text_data.
call function 'TEXT_CONVERT_XLS_TO_SAP'
exporting
i_line_header = 'X'
i_tab_raw_data = it_raw
i_filename = p_fILE "" Excel file
tables
i_tab_converted_data = iN_FILE " our Internal table
exceptions
conversion_failed = 1
others = 2
2009 Oct 21 5:54 AM
hi PBS..
pls dont mind me saying this..
pls read the query completely and answer..
i have already mentioned in my request that , in the version which i am using, type-pool TRUXS is not available and hence i cannot use the FM..
regards,
krish
2009 Oct 20 2:45 PM
2009 Oct 21 8:32 AM
Hi,
Save the excel file as tab delimited file and then refer to the given snippet:
DATA: lv_filetype(10) TYPE c,
lv_gui_sep TYPE c,
lv_file_name TYPE string.
lv_filetype = 'ASC'.
lv_gui_sep = 'X'.
lv_file_name = pa_dfile. >> file path
FM call to upload file
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename = lv_file_name
filetype = lv_filetype
has_field_separator = lv_gui_sep
TABLES
data_tab = gi_zhralcon_file > internal table
Hope it helps.
Regards,
Rajesh Kumar
2009 Oct 21 8:38 AM
Hi Rajesh,
Yes!!!! i have saved the excel file as a tab delimited txt file and then used the FM..
it is working fine now.
thanks a lot!!!
regards,
krish
2009 Oct 21 8:36 AM
HI,
Try doing like the sample code below:
DATA: it_raw TYPE truxs_t_text_data.
&----
*&Start-of-selection
&----
START-OF-SELECTION.
&----
*&Function module called to upload xls data into an internal table
&----
CALL FUNCTION 'TEXT_CONVERT_XLS_TO_SAP'
EXPORTING
i_field_seperator = 'X'
i_line_header = 'X'
i_tab_raw_data = it_raw
i_filename = p_file "file path browsed
TABLES
i_tab_converted_data = it_upload[] "int table populated
EXCEPTIONS
conversion_failed = 1 "browsed file's data
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.
Hope it helps
Regards
Mansi
| User | Count |
|---|---|
| 4 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |