5 Replies Latest reply: Sep 25, 2013 3:46 PM by Onur Grn RSS

How to upload excel file into internal table in sap crm

Ravi Seela
Currently Being Moderated

Hi,

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

 

 

 

Regards,

Ravi.

  • Re: How to upload excel file into internal table in sap crm
    Ravi Kumar
    Currently Being Moderated

    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...............

  • Re: How to upload excel file into internal table in sap crm
    Swadini Sujanaranjan
    Currently Being Moderated

    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.

  • Re: How to upload excel file into internal table in sap crm
    Vigneshwaran G
    Currently Being Moderated

    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

  • Re: How to upload excel file into internal table in sap crm
    Onur Grn
    Currently Being Moderated

    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.

Actions