‎2009 Jul 25 7:22 AM
Hi all
I hav created a bdc to upload data . My program is working well with txt flat file
but when i try to execute it with a xl file it colect garbage value instead of values
from flat file.
what should i do so that i can upload data from both xl and txt file.
plz help me.
thanx in advance.
‎2009 Jul 25 9:34 AM
Hi,
Check this link for upload the date from excel file into internal table..it is not possible to upload the excel file using the GUI_UPLOAD
Check this link for other FM's
[KCD_EXCEL_OLE_TO_INT_CONVERT|http://docs.google.com/Doc?docid=0AZqwnQpzX9wBZGZ2MmhtZ3NfMTFjZzRqZmRw&hl=en]
‎2009 Jul 25 9:34 AM
Hi,
Check this link for upload the date from excel file into internal table..it is not possible to upload the excel file using the GUI_UPLOAD
Check this link for other FM's
[KCD_EXCEL_OLE_TO_INT_CONVERT|http://docs.google.com/Doc?docid=0AZqwnQpzX9wBZGZ2MmhtZ3NfMTFjZzRqZmRw&hl=en]
‎2009 Jul 25 9:44 AM
Hi,
Try this way.
<li>We can use the Function module TEXT_CONVERT_XLS_TO_SAP to read the Excel file into the internal table. From this internal table you can fill the target internal table.
Thanks
Venkat.OREPORT ztest_notepad.
DATA: BEGIN OF it_data OCCURS 0,
bukrs TYPE t001-bukrs,
butxt TYPE t001-butxt,
ort01 TYPE t001-ort01,
END OF it_data.
TYPE-POOLS:truxs.
DATA:it_tab_raw_data TYPE truxs_t_text_data.
"Call TEXT_CONVERT_XLS_TO_SAP fm
CALL FUNCTION 'TEXT_CONVERT_XLS_TO_SAP'
EXPORTING
i_tab_raw_data = it_tab_raw_data
i_filename = 'C:\test.xls'
TABLES
i_tab_converted_data = it_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.
ELSE.
"Loop the data table
LOOP AT it_data.
WRITE:/ it_data-bukrs,it_data-butxt, it_data-ort01.
ENDLOOP.
ENDIF.