Problem solve Get help with specific problems with your technologies, process and projects.

Excel Upload

Upload data directly from excel using this routine.

Here is a routine for uploading data directly from Excel. The code was written in v.4.6.


*======================================================================*
* Subroutine to upload data from excel file from local PC              *
*----------------------------------------------------------------------*
*  --->  P_TAB        Internal table for data to be uploaded           *
*  --->  P_FILENAME   File to be uploaded                              *
*  <---  P_RC         Return Code                                      *
*======================================================================*
form f_excel_upload  tables   p_tab
                     using    p_filename  like rlgrap-filename
                              p_rc        like sy-subrc.
  data : $i_intern type  kcde_cells occurs 0 with header line.
  data : $v_index type i.
  data : $v_start_col type i value '1',
         $v_start_row type i value '1',
         $v_end_col   type i value '256',
         $v_end_row   type i value '65536'.
  field-symbols : <$fs>.
  call function 'KCD_EXCEL_OLE_TO_INT_CONVERT'
       exporting
            filename                = p_filename
            i_begin_col             = $v_start_col
            i_begin_row             = $v_start_row
            i_end_col               = $v_end_col
            i_end_row               = $v_end_row
       tables
            intern                  = $i_intern
       exceptions
            inconsistent_parameters = 1
            upload_ole              = 2.
  move : sy-subrc to p_rc.
  check not $i_intern[] is initial.
  sort $i_intern by row col.
  loop at $i_intern.
    move : $i_intern-col to $v_index.
    assign component $v_index of structure p_tab to <$fs>.
    move : $i_intern-value to <$fs>.
    at end of row.
      append p_tab.
      clear p_tab.
    endat.
  endloop.
endform.

This was last published in September 2002

Dig Deeper on SAP ABAP

PRO+

Content

Find more PRO+ content and other member only offers, here.

Start the conversation

Send me notifications when other members comment.

By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Please create a username to comment.

-ADS BY GOOGLE

SearchManufacturingERP

SearchOracle

SearchDataManagement

SearchAWS

SearchBusinessAnalytics

SearchCRM

SearchContentManagement

SearchFinancialApplications

Close