cancel
Showing results for 
Search instead for 
Did you mean: 

Excel Upload in SRM System

former_member205842
Participant
0 Kudos

Dear Experts,

                     Am trying to upload excel file(xls) in SRM system using below code but am getting data in Chinese format don't know how to convert into normal format and i used other format like .CSV(Comma del..) but in this am getting data but getting with special characters like (, #) , please help me to upload excel file(xls format) file to internal table.

CALL METHOD CL_GUI_FRONTEND_SERVICES=>GUI_UPLOAD

     EXPORTING

       FILENAME                = L_FHEAD01

       FILETYPE                = 'ASC'

*     HAS_FIELD_SEPARATOR     = '|'

*     HEADER_LENGTH           = 0

*     READ_BY_LINE            = 'X'

       DAT_MODE                = 'X' "SPACE

*     CODEPAGE                = SPACE

*     IGNORE_CERR             = ABAP_TRUE

       REPLACEMENT             = '#'

*     VIRUS_SCAN_PROFILE      =

*  IMPORTING

*     FILELENGTH              =

*     HEADER                  =

     CHANGING

       DATA_TAB                = LT_TRAN

*     ISSCANPERFORMED         = SPACE

     EXCEPTIONS

       FILE_OPEN_ERROR         = 1

       FILE_READ_ERROR         = 2

       NO_BATCH                = 3

       GUI_REFUSE_FILETRANSFER = 4

       INVALID_TYPE            = 5

Accepted Solutions (0)

Answers (3)

Answers (3)

0 Kudos

Hi,

Use the function module ALSM_EXCEL_TO_INTERNAL_TABLE or use the class CL_FDT_XL_SPREADSHEET to upload excel file.

Please check the following links:

For FM: http://wiki.scn.sap.com/wiki/display/Snippets/How+to+use++FM+ALSM_EXCEL_TO_INTERNAL_TABLE

For the class: http://zevolving.com/2013/11/abap-webdynpro-upload-excel-file-using-class-cl_fdt_xl_spreadsheet/

Regard,

Taiyeb

vinita_kasliwal
Active Contributor
0 Kudos

Hi Sarmath

PLease try using this standard classes which may do the trick for you .

DATA : oref_container TYPE REF TO cl_gui_custom_container,

        iref_control     TYPE REF TO i_oi_container_control,

        iref_document    TYPE REF TO i_oi_document_proxy,

        iref_spreadsheet TYPE REF TO i_oi_spreadsheet,

        iref_error       TYPE REF TO i_oi_error.

Check the attached on how I used it ..

Also try using these FM

cl_gui_frontend_services=>file_open_dialog


* CALL: FM to upload excel data into internal table
CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
 

Check this note as well

790860 - Frequently asked questions for Excel upload and download

regards

Vinita

former_member197475
Active Contributor
0 Kudos

Hi Sarmat,

I don't think that the class you are using for upload will work well in Web Dynpro.

Please see some below blogs for better approach.

Excel File Upload And Display Data Using Web DynPro ABAP - Web Dynpro ABAP - SCN Wiki

For delimiting the garbage value, you can follow the below thread.

BR,

RAM.

former_member205842
Participant
0 Kudos

HI Rama,

               Thanks for your quick reply, am not uploading in webdynpro, am uploading in normal ABAP(SE38)  only but using SRM server  . Please help