report z. parameter p_file like rlgrap-filename. data: w_text type natxt, "message * this internal table should have the same structure * as *.xls file to be uploaded. E.g.: begin of it_data occurs 0, s1(10), "text field 1 s2(20), "text field 2 n1 type i, "integer number field end of it_data. start-of-selection. perform f_excel_upload tables it_data using p_file changing w_text. write: / 'Result =', w_text. end-of-selection. loop at it_data. write: / it_data-s1, it_data-s2, it_data-n1. endloop. form f_excel_upload tables p_download using value(p_filename) like rlgrap-filename changing p_text type natxt. data: w_start_col type i value '1', w_start_row type i value '1', w_end_col type i value '3', w_end_row type i value '5', w_rows like sy-fdpos, w_cols like sy-fdpos, w_curr_row like sy-fdpos, w_curr_col like sy-fdpos, w_index type i, w_value(99) type c. data: h_appl like obj_record, h_work like obj_record, h_cell like obj_record. field-symbols: . * start excel if h_appl-header = space or h_appl-handle = -1. create object h_appl 'excel.application'. if sy-subrc <> 0. p_text = 'Start Excel Error:'. write sy-subrc to p_text+19 left-justified. message i002(sy) with sy-msgli. endif. set property of h_appl 'visible' = 0. endif. * open file call method of h_appl 'workbooks' = h_work. call method of h_work 'open' exporting #1 = p_filename. * get data cell by cell w_rows = w_end_row - w_start_row + 1. w_cols = w_end_col - w_start_col + 1. w_curr_row = w_start_row. do w_rows times. w_curr_col = w_start_col. w_index = 1. do w_cols times. call method of h_appl 'cells' = h_cell exporting #1 = w_curr_row #2 = w_curr_col. get property of h_cell 'value' = w_value. assign component w_index of structure p_download to . if sy-subrc = 0. move : w_value to . unassign . endif. add 1 to: w_curr_col, w_index. enddo. add 1 to w_curr_row. append p_download. clear p_download. enddo. * release excel call method of h_appl 'quit'. free object h_appl. h_appl-handle = -1. if p_download[] is initial. p_text = 'No Data Uploaded.'. else. describe table p_download lines w_rows. p_text = 'Uploaded Rows:'. write w_rows to p_text+15 left-justified. endif. endform. * end of source code *