cancel
Showing results for 
Search instead for 
Did you mean: 

How to upload excel file into internal table in sap crm

Former Member
0 Kudos

Hi,

     How to upload excel file into internal table in sap crm.

Regards,

Ravi.

Accepted Solutions (0)

Answers (4)

Answers (4)

Former Member
0 Kudos

Hi,

In addition to GUI_UPLOAD function you can use these functions to upload excel (include xls) files to internal table.

* KCD_EXCEL_OLE_TO_INT_CONVERT

* ALSM_EXCEL_TO_INTERNAL_TABLE

* TEXT_CONVERT_XLS_TO_SAP

Regards,

Onur.

former_member219209
Participant
0 Kudos

Hi,

By using the fm UPLOAD_XLS_FILE_2_ITAB directly excel file can be uploaded to internal table.

CALL FUNCTION 'UPLOAD_XLS_FILE_2_ITAB'
EXPORTING
i_filename = p_local
TABLES
e_itab     = lt_file
EXCEPTIONS
file_error = 1
OTHERS     = 2.

Regards,

Vignesh

Former Member
0 Kudos

Hi,

Try the code snippet from the below link. It will help you to upload excel file(*.xsl) into SAP CRM.

Its working fine, customize it as you need.

http://wiki.sdn.sap.com/wiki/display/Snippets/ABAP+-+Upload+data+from+Excel+to+Sap+using+OO

Thank you.

Regards,

Swadini Sujanaranjan.

Former Member
0 Kudos

Hi Ravi.

   we cannot upload data from excel to internal table.But if u save the file with .csv (comma separeated value file) extension it is easy to upload into internal table by using the functions.

  • cl_gui_frontend_services=>file_open_dialog     "For selecting the file by gui
  • TRINT_SPLIT_FILE_AND_PATH                     "For split the file name with path
  • cl_gui_frontend_services=>gui_upload             "For upload into internal table.

hope the sample code below will help you....

   DATA: lt_file_table TYPE filetable,

         ls_file LIKE LINE OF lt_file_table,

         lv_filename TYPE string,

         lv_file TYPE string,

         lv_rc TYPE sy-subrc,

         lv_path TYPE char255..

CALL FUNCTION 'TRINT_SPLIT_FILE_AND_PATH'

     EXPORTING

       full_name     = lv_filename

     IMPORTING

       stripped_name = lv_file

       file_path     = lv_path

     EXCEPTIONS

       x_error       = 1

       OTHERS        = 2.

cl_gui_frontend_services=>gui_upload(

     EXPORTING

       filename                = lv_file

*      filetype                = 'DAT'

       has_field_separator     = 'X'

     CHANGING

       data_tab                = lt_dlr_price

     EXCEPTIONS

       file_open_error         = 1

       file_read_error         = 2

       no_batch                = 3

       gui_refuse_filetransfer = 4

       invalid_type            = 5

       no_authority            = 6

       unknown_error           = 7

       bad_data_format         = 8

       header_not_allowed      = 9

       separator_not_allowed   = 10

       header_too_long         = 11

       unknown_dp_error        = 12

       access_denied           = 13

       dp_out_of_memory        = 14

       disk_full               = 15

       dp_timeout              = 16

       not_supported_by_gui    = 17

       error_no_gui            = 18

       OTHERS                  = 19

          ).


cheers...............

Former Member
0 Kudos

thanks ravi............

I used your code and its working fine.

thanks again........

Former Member
0 Kudos

This message was moderated.