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

Hello All ,

I want to upload excel file into internal table .

Which FM I have to use for F4 Search Help and for file upload ?

Regards ,

Rasika

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hello Premanand ,


Please prefer Following code for the same .



*&---------------------------------------------------------------------*

*& Report  ZFILE_CREATE

*&

*&---------------------------------------------------------------------*

*&

*&

*&---------------------------------------------------------------------*

REPORT  ZFILE_CREATE.

types: begin of ttab,

        rec(1000) type c,

        end of ttab.

types: begin of tdat,

        fld1(10) type c,

        fld2(10) type c,

        fld3(10) type c,

        end of tdat.

data: itab  type STANDARD TABLE OF ttab .

data: w_tab type  ttab .

data: idat  type STANDARD TABLE OF tdat .

data: w_dat type tdat .

data: file_str type string.

parameters: p_file type localfile.

at selection-screen on value-request for p_file.

   call function 'KD_GET_FILENAME_ON_F4'

        exporting

             static    = 'X'

        changing

             file_name = p_file.

start-of-selection.

   file_str = p_file.

CALL FUNCTION 'UPLOAD_XLS_FILE_2_ITAB'

   EXPORTING

     i_filename       = p_file

   tables

     e_itab           = idat

  EXCEPTIONS

    FILE_ERROR       = 1

    OTHERS           = 2

           .

IF sy-subrc <> 0.

* Implement suitable error handling here

ENDIF.

LOOP AT idat INTO w_dat .

   WRITE :/1(10w_dat-fld1 ,

           12(5w_dat-fld2 ,

           20(5) w_dat-fld3 .

ENDLOOP.






Regards ,

Rasika

Answers (0)