Presentation is loading. Please wait.

Presentation is loading. Please wait.

1 EXCEL Interface Northern Arizona University College of Business.

Similar presentations


Presentation on theme: "1 EXCEL Interface Northern Arizona University College of Business."— Presentation transcript:

1 1 EXCEL Interface Northern Arizona University College of Business

2 2 Interfacing with Excel

3 3 Screen Interaction with Selection-Screens  The code to display the window is part of the Value- Request event.  The Value-Request event uses the File_Open_Dialog method, which is part of the cl_ugi_frontend_services Class.

4 4 Screen Interaction with Selection-Screens Selection-Screen Begin of Block block1 with Frame Title text-T01. Parameters: p_file LIKE rlgrap-filename default ‘c:\temp\demo.xls’. Selection-Screen End of Block block1.

5 5 Screen Interaction with Selection-Screens Selection-Screen Begin of Block block2 with Frame Title text-T02. Selection-Screen Begin of Line. Parameters: p_brow Type I default 2. Selection-Screen Comment 17(20) text-T03. Selection-Screen End of Line.

6 6 Excel Import Data Data: Begin of ss_data Occurs 300. Include structure alsmex_tabline. Data: End of ss_data.

7 7 Selection Event Data Data: file_operations Type REF TO cl_gui_frontend_services, file_table type filetable, rc type I, tab_idx type I value 1.

8 8 Selection Events  Create an instance of the GUI frontend services class Create Object file_operations.

9 9 Selection Events  Call the method that displays the open file dialog window. Call Method file_operations->file_open_dialog Changing file_table = file_table rc = rc.

10 10 Selection Events  Refresh the selection screen after file is selected. Read Table file_table Into p_file Index tab_idx.

11 11 Importing from Excel  The ALSM_EXCEL_TO_INTERNAL_TABLE function loads an internal table from an excel spreadsheet based on the parameters.

12 12 EXPORTING Parameters filename= p_file i_begin_col= p_bcol i_begin_row= p_brow i_end_col= p_ecol i_end_row= p_erow

13 13 TABLES Parameter Intern= ss_data

14 14 Internal Table  Data is stored in the internal table sequentially.  If a row in the Excel spreadsheet has four columns then the data is stored in the internal table in four consecutive elements. The next row in the next four elements and so on.

15 15 Processing the Internal Table  A Loop At must be set up to loop through the table controlling for the fields for each row from the spreadsheet (four in this example). Move 0 to the counter. Loop. Increment the counter. If 1move to ID If 2move to FirstName If 3move to LastName If 4move to WorkPhone &insert into the database table & move 0 to the counter.


Download ppt "1 EXCEL Interface Northern Arizona University College of Business."

Similar presentations


Ads by Google