Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

OLE concept to upload excel file

0 Kudos

Hi All,

I am using OLE concept to upload excel file but I am facing an error. If the excel file has no formatting, it works fine. But if the excel file is aligned to the left, then the data fethced into the internal table will be appended with hashes '#' to the right side. Hence at the time of updating the material master with this kind of data obtained from the file, it is going for a dump. Please let me know what I need to do to overcome this alignment issue.

Thanks

8 REPLIES 8

former_member491621
Contributor
0 Kudos

Hi Jean,

Can you show me the screenshot of the dump??

0 Kudos

Above are the screenshots. The data type of the line in the internal table used to get the data from excel file is of characters 65000

0 Kudos

Hi Jean,

Is there any specific reason for using OLE to upload excel data?

The FM ALSM_EXCEL_TO_INTERNAL_TABLE also uses OLE for uploading and works without any problems.

0 Kudos

I am new to OLE concept. I am not sure what to do to rectify this issue. I am not using ALSM_EXCEL_TO_INTERNAL_TABLE as i have a requirement to fetch high number of records.

0 Kudos

Hi Jean,

Using OLE, performance would be a problem. You can upload any amount data using this FM(you just have to write a small logic to divide the file data upload).

It may not be correct to ask this but what is the expected number of records??

0 Kudos

It can go more than 65000 records. Also the excel file will have a text which can be on any length. But this FM has file of fixed length.

0 Kudos

Hi Jean,

yes the FM has fixed length of 65536.

You can try using the below code for splitting the data.

data : i_beg_row type i.

  

Do.

  

    i_beg_row = 2.               " This tells the FM to skip the header

   CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
    EXPORTING
      filename                = p_file
      i_begin_col             = 1
      i_begin_row             = i_beg_row

      i_end_col               = <number of columns in your excel>
      i_end_row               = 65536
    TABLES
      intern                  = i_data
    EXCEPTIONS
      inconsistent_parameters = 1
      upload_ole              = 2
      OTHERS                  = 3.
  IF sy-subrc NE 0.
    EXIT.

  ELSE.

     .....you code to append data into required internal table

     i_beg_row = i_beg_row + 65536.

  ENDIF.

ENDDO.

Former Member
0 Kudos

Hi Jean,

Please check this FM .

"KCD_EXCEL_OLE_TO_INT_CONVERT"

Regard's

Smruti