Direct Excel Upload

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'
            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
            intern      = if_intern.
  if if_intern[] is initial.
    p_text = 'No Data Uploaded'.
    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.


    Requires Free Membership to View

This was first published in June 2002

There are Comments. Add yours.

TIP: Want to include a code block in your comment? Use <pre> or <code> tags around the desired text. Ex: <code>insert code</code>

REGISTER or login:

Forgot Password?
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
Sort by: OldestNewest

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:

Disclaimer: Our Tips Exchange is a forum for you to share technical advice and expertise with your peers and to learn from other enterprise IT professionals. TechTarget provides the infrastructure to facilitate this sharing of information. However, we cannot guarantee the accuracy or validity of the material submitted. You agree that your use of the Ask The Expert services and your reliance on any questions, answers, information or other materials received through this Web site is at your own risk.