10-20-2010 8:44 PM
Hi All,
Hi,
I'm trying to upload data from Excel file to Internal table in ABAP (cProjects).
I used GUI_UPLOAD (tried DAT and BIN file type too) but its displaying some junk data. However this works for CSV files.
I have searched for posts regarding this but found only the following solutions which will not work in this scenario.
1) TEXT_CONVERT_XLS_TO_SAP - This is not available in cProjects
2) ALSM_EXCEL_TO_INTERNAL_TABLE - This is not available in cProjects
3) Saving it to CSV and using it - This is not an option as we need direct upload from excel
I would like to know if there are some other FMs/Classes available for achieving this.
Appreciate your help.
Thanks,
Sri
10-20-2010 11:12 PM
Hi,
try to read these blogs
[abap2xlsx - Generate your professional Excel spreadsheet from ABAP|http://www.sdn.sap.com/irj/scn/weblogs?blog=/pub/wlg/20046] [original link is broken] [original link is broken] [original link is broken];
[xlsx2abap - Read and edit your Excel files from ABAP|http://www.sdn.sap.com/irj/scn/weblogs?blog=/pub/wlg/20791] [original link is broken] [original link is broken] [original link is broken];
Code of this SCN Community project is shared on [Code Exchange|https://cw.sdn.sap.com/cw/groups/abap2xlsx]
Regards
Ivan
10-21-2010 3:50 AM
Dear Sri,
Some days ago I have some problem to upload data from excel to Ztable.
I ask SDN forum then i found solution using FM TEXT_CONVERT_XLS_TO_SAP.
Data upload from excel file to internal table and after that append to ztable.
This my trial syntax may help you:
REPORT ZWIL_IMPORT_EXCEL_TO_ZTABLE.
TYPE-POOLS TRUXS.
tables zwilharga.
PARAMETER P_FILE TYPE RLGRAP-FILENAME DEFAULT
'D:\SAPBELAJAR\coba1.xls'.
DATA : IT_RAW TYPE truxs_t_text_data,wa type zwilharga,IT_ITAB TYPE TABLE OF zwilharga.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_FILE.
CALL FUNCTION 'F4_FILENAME'
EXPORTING
PROGRAM_NAME = SYST-CPROG
DYNPRO_NUMBER = SYST-DYNNR
FIELD_NAME = 'P_FILE'
IMPORTING
FILE_NAME = P_FILE.
start-of-selection.
CALL FUNCTION 'TEXT_CONVERT_XLS_TO_SAP'
EXPORTING
I_FIELD_SEPERATOR =
I_LINE_HEADER = 'X'
I_TAB_RAW_DATA = IT_RAW
I_FILENAME = P_FILE
TABLES
I_TAB_CONVERTED_DATA = it_itab[]
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.
loop at it_itab into wa.
insert zwilharga client specified from wa.
endloop.
Thanx
Wili