Direct Excel Upload

Upload data directly from Excel sheets!

Uploading data into SAP used to be done by first converting Excel data into text format and then uploading the

text format. The routine given below will upload the data directly from the Excel sheet. So, no need for column width adjustments and saving into text file!


form f_excel_upload tables   p_download
                    using    p_filename  like rlgrap-filename
                    changing p_text type natxt.

  data : if_intern type  kcde_cells occurs 0 with header line.
  data : vf_index type i.
  data : vf_start_col type i value '1',
         vf_start_row type i value '1',
         vf_end_col   type i value '256',
         vf_end_row   type i value '65536'.
  field-symbols : <fs>.
  call function 'KCD_EXCEL_OLE_TO_INT_CONVERT'
       exporting
            filename    = p_filename
            i_begin_col = vf_start_col
            i_begin_row = vf_start_row
            i_end_col   = vf_end_col
            i_end_row   = vf_end_row
       tables
            intern      = if_intern.
  if if_intern[] is initial.
    p_text = 'No Data Uploaded'.
  else.
    sort if_intern by row col.
    loop at if_intern.
      move : if_intern-col to vf_index.
      assign component vf_index of structure p_download to <fs>.
      move : if_intern-value to <fs>.
      at end of row.
        append p_download.
        clear p_download.
      endat.
    endloop.
  endif.

endform.
This was first published in June 2002

Dig deeper on SAP application integration

Pro+

Features

Enjoy the benefits of Pro+ membership, learn more and join.

0 comments

Oldest 

Forgot Password?

No problem! Submit your e-mail address below. We'll send you an email containing your password.

Your password has been sent to:

SearchManufacturingERP

SearchOracle

SearchDataManagement

SearchAWS

SearchBusinessAnalytics

SearchCRM

SearchContentManagement

SearchFinancialApplications

Close