Wednesday, December 22, 2010
& Upload and excel file into an internal table using the following function module: ALSM_EXCEL_TO_INTERNAL_TABLE REPORT upload_excel NO STANDARD PAGE HEADING. DATA: itab LIKE alsmex_tabline OCCURS 0 WITH HEADER LINE. TYPES: BEGIN OF t_record, name1 LIKE itab-value, name2 LIKE itab-value, age LIKE itab-value, END OF t_record. DATA: it_record TYPE STANDARD TABLE OF t_record INITIAL SIZE 0, wa_record TYPE t_record. DATA: gd_currentrow TYPE i. PARAMETER p_infile LIKE rlgrap-filename. START-OF-SELECTION. CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE' EXPORTING filename = p_infile i_begin_col = '1' i_begin_row = '2' "Do not require headings i_end_col = '14' i_end_row = '31' TABLES intern = itab EXCEPTIONS inconsistent_parameters = 1 upload_ole = 2 OTHERS = 3. IF sy-subrc <> 0. MESSAGE e010(zz) WITH text-001. "Problem uploading Excel Spreadsheet ENDIF. SORT itab BY row col. READ TABLE itab INDEX 1. gd_currentrow = itab-row. LOOP AT itab. IF itab-row NE gd_currentrow. APPEND wa_record TO it_record. CLEAR wa_record. gd_currentrow = itab-row. ENDIF. CASE itab-col. WHEN '0001'. "First name wa_record-name1 = itab-value. WHEN '0002'. "Surname wa_record-name2 = itab-value. WHEN '0003'. "Age wa_record-age = itab-value. ENDCASE. ENDLOOP. APPEND wa_record TO it_record. * Display report data for illustration purposes LOOP AT it_record INTO wa_record. WRITE:/ sy-vline, (10) wa_record-name1, sy-vline, (10) wa_record-name2, sy-vline, (10) wa_record-age, sy-vline. ENDLOOP.
Followers
Popular Posts
- ABAP - ALV Report example with steps
- ABAP - Step by step tutorial on Smart Forms - Template Node
- ABAP - Sending email with pdf attachment
- SAP Adobe Form - Steps to create simple ADOBE Form and calling it from ABAP Program
- SAP ABAP - CL_ABAP_CHAR_UTILITIES class usage
- ABAP - Multiple value selection from F4 help for SELECT-OPTIONS
- Execute ABAP Report using SUBMIT statement
- ABAP - Select all or Deselect all in ALV or Check box handling in ALV
- Web Dynpro ABAP ALV - ON_CLICK event
- ABAP - Dynamic WHERE clause
0 comments:
Post a Comment
Your useful comments, suggestions are appreciated.Your comments are moderated.