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.

Dig Deeper on SAP ABAP

Start the conversation

Send me notifications when other members comment.

Please create a username to comment.

-ADS BY GOOGLE

SearchERP

SearchOracle

SearchDataManagement

SearchAWS

SearchBusinessAnalytics

SearchContentManagement

SearchHRSoftware

Close