Uploading Excel file to SAP

Hi Friends,
Iam trying to Upload Excel file into SAP using the FM
ALSM_EXCEL_TO_INTERNAL_TABLE. But it is going to dump n the error is                                                                             
The call to the function module "ALSM_EXCEL_TO_INTERNAL_TABLE" is incorrect:                                                                               
In the function module interface, you can specify only                          
fields of a specific type and length under "INTERN".                            
Although the currently specified field                                          
"ITAB" is the correct type, its length is incorrect.                            
I have attached the code also.
Please let me know where iam getting the error.
Code :
Tables : mara,
         ztable.
parameters : p_infile like rlgrap-filename.
data : begin of itab occurs 0,
       matnr like mara-matnr,
       mbrsh like mara-mbrsh,
       matkl like mara-matkl,
       end of itab.
       CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
         EXPORTING
           FILENAME                      = p_infile
           I_BEGIN_COL                   = 1
           I_BEGIN_ROW                   = 1
           I_END_COL                     = 100
           I_END_ROW                     = 100
         TABLES
           INTERN                        = itab
       EXCEPTIONS
         INCONSISTENT_PARAMETERS       = 1
         UPLOAD_OLE                    = 2
         OTHERS                        = 3
       IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
        WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
       ENDIF.
sort itab by matnr.
loop at itab.
write:/ itab.
*modify ztable from table itab.
endloop.

hi check this code:
DATA : BEGIN OF TYP_INPUT ,
           MATNR LIKE MARA-MATNR,
           WERKS LIKE MARC-WERKS,
           LGORT LIKE MARD-LGORT,
           LGNUM LIKE MLGN-LGNUM,
           LGTYP LIKE MLGT-LGTYP,
           LTKZA LIKE MLGN-LTKZA,
           LTKZE LIKE MLGN-LTKZE,
           LGBKZ LIKE MLGN-LGBKZ,
           LGPLA LIKE MLGT-LGPLA,
        END OF TYP_INPUT.
*Input File Data
DATA : IT_FILE LIKE TYP_INPUT OCCURS 0 WITH HEADER LINE.
*"INTERNAL TAB TO TAKE EXCEL SHEET.
DATA : IT_EXCEL    LIKE ALSMEX_TABLINE OCCURS 0 WITH HEADER LINE.
       CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
        EXPORTING
             FILENAME                = P_PFILE
             I_BEGIN_COL             = 1
             I_BEGIN_ROW             = 2
             I_END_COL               = 9
             I_END_ROW               = 6000
        TABLES
             INTERN                  = IT_EXCEL
        EXCEPTIONS
             INCONSISTENT_PARAMETERS = 1
             UPLOAD_OLE              = 2
             OTHERS                  = 3.
* IT_EXCEL CONTAINS DATA IN THE FORM OF ROW, COL, VALUE       *
* CONVERTING THAT INTERNAL TABLE TO FORMAT THAT OF EXCEL SHEET *
   IF NOT IT_EXCEL[] IS INITIAL.
     SORT IT_EXCEL BY ROW COL.
     LOOP AT IT_EXCEL.
       CASE IT_EXCEL-COL.
        WHEN 1.
              IT_FILE-MATNR = IT_EXCEL-VALUE.
        WHEN 2.
              IT_FILE-WERKS = IT_EXCEL-VALUE.
        WHEN 3.
              IT_FILE-LGORT = IT_EXCEL-VALUE.
        WHEN 4.
              IT_FILE-LGNUM = IT_EXCEL-VALUE.
        WHEN 5.
              IT_FILE-LGTYP = IT_EXCEL-VALUE.
        WHEN 6.
              IT_FILE-LTKZA = IT_EXCEL-VALUE.
        WHEN 7.
              IT_FILE-LTKZE = IT_EXCEL-VALUE.
        WHEN 8.
              IT_FILE-LGBKZ = IT_EXCEL-VALUE.
        WHEN 9.
              IT_FILE-LGPLA = IT_EXCEL-VALUE.
       ENDCASE.
       AT END OF ROW.
         APPEND IT_FILE.
         CLEAR IT_FILE.
       ENDAT.
     ENDLOOP.
   ELSE.
     MESSAGE I000  WITH 'The input file is empty'.
     STOP.
   ENDIF.

Similar Messages

  • Upload excel file in SAP BI-7.0

    Hi ,
    i  need to  upload an excel  file in SAP BI 7.0 where the standard r/3 fm are not available.
    Currently we uploading a file in CSV format but now we want to upload using XLS also.
    ia way to upload excel  file in SAP BI 7.0
    Best Regards,
    Sharad
    Edited by: sharad narayan on Jan 7, 2011 10:58 AM
    while searching the forum i  found the fm MS_EXCEL_OLE_STANDARD_DAT .
    but while using this FM i  am getting the exception file not exist.
    Kindlu  suggest what  to  do
    i  even tried the FM TMP_GUI_GET_FILE_EXIST' to  check  the existence of the file.
    even then same problem.
    Please suggest
    Edited by: sharad narayan on Jan 10, 2011 2:51 PM

    Hi,
    Scheduled jobs are the jobs for which we have scheduled for a time, may be daily so that each day the scheduled jobs will trigger at the time given.So that every time u need not to trigger the job manully urself as the schedule time will hit the job will trigger itself.
    Released job means the job which is in between Sheduled state and active state.say For eg: 10 jobs are Scheduled in a queue Job no 1 is released from the queue that means any moment it will be in active state.So it is the state between Schedule and Active state of a job.
    Thanks
    Varun

  • Error Raised while uploading Excel file to SAP

    Hi All,
    I am getting error while uploading excel file into SAP using the function module 'TEXT_CONVERT_XLS_TO_SAP'.
    Error Message is UX(893) -  'Excel file & cannot be processed' .
    Please let me know what went wrong.
    Regards,
    Deepthi

    Hi,
    1 .TEXT_CONVERT_XLS_TO_SAP  Funtion module will work if you have installed Microsoft Excel at front end.
    2. Whenyou declare internal table for upload, specify the char only in the strcture ,don't specify any data element or dictionary reference.    If the data element and dictionaly reference is character field then its ok.
    eg.
    types:begin of st_data,
               field1 type char15,
               field2 type char23,
              endif.
    3. Close the excel before you upload
    Hope this might solve your issue.
    Regards
    Aromal R

  • Uploading Excel File in SAP In Background Mode

    Dear All,
    We require to upload Excel File in SAP in Background Mode.
    Could anyone suggest me the Function Module for this?
    Or any other method..........please.
    Thanks in advance for ur kind help.
    Best Regards,
    Prasad

    hi check this..
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/9831750a-0801-0010-1d9e-f8c64efb2bd2
    Download in Background
    http://sapabap.iespana.es/sap/info/rfcexec/rfcexec_e.htm
    Reward if find useful

  • Uploading Excel file into SAP Database table?

    I built a table in the SAP Data Dictionary, and i need to write a program that uploads the Excel table, into the SAP Database table.  Does anybody have a sample program that may help me?  Thanks!

    TYPES:
         BEGIN OF ty_upload,
         matnr like mara-matnr,
         meins like mara-meins,
         mtart like mara-mtart,
         mbrsh like mara-mbrsh,
         END OF ty_upload.
      DATA it_upload TYPE STANDARD TABLE OF ty_upload WITH header line.
      DATA wa_upload TYPE ty_upload.
      DATA: itab TYPE STANDARD TABLE OF alsmex_tabline WITH header line.
      CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
        EXPORTING
          filename    = 'C:\Documents and Settings\venkatapp\Desktop\venkat.xls'
          i_begin_col = 1
          i_begin_row = 1
          i_end_col   = 4
          i_end_row   = 65535
          TABLES
          intern      = itab.
    if not itab[] is initial.
    loop at itab .
    case itab-col.
    when '0001'.
    it_upload-matnr = itab-value.
    when '0002'.
    it_upload-meins = itab-value.
    when '0003'.
    it_upload-mtart = itab-value.
    when '0004'.
    it_upload-mbrsh = itab-value.
    append it_upload.
    clear it_upload.
    clear itab.
    endcase.
    endloop.
    endif.
    loop at it_upload into wa_upload.
    ztable-matnr = wa_upload-matnr.
    ztable-meins = wa_upload-meins.
    ztable-mtart = wa_upload-mtart.
    ztable-mbrsh = wa_upload-mbrsh.
    insert ztable.
    endloop.

  • Error message while upload excel file (with macro) to sap (iw28)

    While upload excel file to sap through iw28, i get error message (vb)
    u2022     i have to say that the excel file contain macro , with out the macro , work fine .
    u2022     The error display just in refresh command.
    the error message :
    Public Sub ALV_CUS_Exit()
    Dim objs As ChartObjects
    Dim obj As ChartObject
    Dim sheet As Worksheet
    Dim r As Range
    For Each sheet In Sheets
    Set objs = sheet.ChartObjects
    For Each obj In objs
    Set r = Sheets("RawData").UsedRange
    obj.Chart.SetSourceData Source:=r
    Next obj
    Next sheet
    End Sub

    hi,
    This is releated to the ABAP coding...There might be some ouput problem in the Abap list viewer...Pls check it with the ABAP consultant...
    Regards
    Priyanka.P

  • Need help in uploading an excel file into SAP

    Hi All,
    I got a requirement to upload an excel file to SAP.
    But When i tried with the FM "ALSM_EXCEL_TO_INTERNAL_TABLE" , file  not getting uploaded to internal table.
    Getting expection 2, UPLOAD_OLE...
    I think the problem is with the file... the following the sample text of the file...
    Technical IdentNo.     Line No.     Text                                 Location
    BS-PZ-180                   1     035-05 EXZENTER-SCHNECKENPUMPE             0026
    BS-PZ-180                   2          LIEFERANT : SOCSIL-INTER SA  ECUBLENS     0026
    BS-PZ-180                   3          HERSTELLER : MONO PUMPS LIMITED  MANCH     0026
    BS-PZ-180                   4          MODELL/TYP : SH 60                             0026
    But when I tried with only one Column..its getting successfully uploaded...
    Pls suggest me how to upload the file? ( May be with sample code)
    Also pls let me know hw to handle the file..which contains 5 differnt sheets of texts.. ( May be with sample code)
    Your suggestion will be highly appreciated...
    Thanks,
    Priya

    Hi,
    Use the FM: TEXT_CONVERT_XLS_TO_SAP.  It will work perfectly.  I used this function module and uploaded data from xls to sap.  check the following code:
    TYPE-POOLS: truxs.
    PARAMETERS: p_file TYPE  rlgrap-filename.
    TYPES: BEGIN OF t_datatab,
          PROP_NAME like SDOKPROP-PROP_NAME,
          PROP_CHECK like SDOKPROP-PROP_CHECK,
          TABNAME like SDOKPROP-TABNAME,
          FIELDNAME like SDOKPROP-FIELDNAME,
          DESCRIPT(30) type c,
          END OF t_datatab.
    DATA: it_datatab type standard table of t_datatab,
          itab  TYPE STANDARD TABLE OF t_datatab,
          wa_itab TYPE t_datatab,
          wa_datatab type t_datatab.
    DATA: it_raw TYPE truxs_t_text_data.
    At selection screen
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.
      CALL FUNCTION 'F4_FILENAME'
        EXPORTING
          field_name = 'P_FILE'
        IMPORTING
          file_name  = p_file.
    *START-OF-SELECTION.
    START-OF-SELECTION.
    SELECT * FROM sdokprop INTO CORRESPONDING FIELDS OF TABLE itab
    WHERE PROP_NAME LIKE 'DMS%'.
    WRITE / 'Before Modification'.
      LOOP AT itab INTO wa_itab.
        WRITE:/1 wa_itab-PROP_NAME, 27 wa_itab-PROP_CHECK, 31 wa_itab-TABNAME, 65 wa_itab-FIELDNAME, 96 wa_itab-DESCRIPT.
        CLEAR wa_itab.
      ENDLOOP.
      CALL FUNCTION 'TEXT_CONVERT_XLS_TO_SAP'
        EXPORTING
        I_FIELD_SEPERATOR        =
          i_line_header            =  'X'
          i_tab_raw_data           =  it_raw       " WORK TABLE
          i_filename               =  p_file
        TABLES
          i_tab_converted_data     = it_datatab[]    "ACTUAL DATA
       EXCEPTIONS
          conversion_failed        = 1
          OTHERS                   = 2.
      IF sy-subrc <> 0.
        MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
      ENDIF.
    END-OF-SELECTION.
    END-OF-SELECTION.
      WRITE / 'After Modification'.
    MODIFY sdokprop FROM TABLE it_datatab.
      LOOP AT it_datatab INTO wa_datatab.
        WRITE:/1 wa_datatab-PROP_NAME, 27 wa_datatab-PROP_CHECK, 31 wa_datatab-TABNAME, 65 wa_datatab-FIELDNAME, 96 wa_datatab-DESCRIPT.
        CLEAR wa_datatab.
      ENDLOOP.
      IF sy-subrc = 0.
        MESSAGE 'successfull' TYPE 'S'.
      ELSE.
        MESSAGE 'failed' TYPE 'E'.
      ENDIF.
    Regards,
    Bhaskar

  • Can anybody help how to upload an excel file into sap-crm urgent

    hi guys,
    i need the right function module to upload the excel file from the presentation server in to sap-crm.
    1) I know we use the function module 'ALSM_EXCEL_TO_INT_TABLE' in sap-r/3 but this function module is not exist in sap-crm.
    2) i tried with the function moduel 'GUI_UPLOAD' but its not uploading correctly i am gettting hases(#).
    Please can any one provide the right function module to upload the excel into sap-crm with an sample code.
    thanks
    viswa guntha

    Hi Visma,
    Please check this link for sample custom FM.
    Re: function mudule for MS excel file to sap crm
    Hope this will help.
    Regards,
    Ferry Lianto
    Please reward points if helpful as away to say thanks.

  • Uploading excel files from ITS to sap

    Hi all,
    I want to upload excel files from ITS to sap system ECC 6.0 .I am using standalone ITS.Someone please help me find a solution for this.What are the steps involved in it?
    Thanks in advance
    Shinu

    Hi Shinu,
    this seems to be a misunderstanding. The ITS does not have excel files.
    Did you mean to say that you have an application which allows to upload
    files? This application might work using the webgui service of the ITS.
    Try it out!
    best regards
    Tobias

  • Upload Excel File from Portal (R/3 working fine)

    Hi Experts!!
    We have a report in which we are uploading an excel file from presentation server into an itab. When F4 clicked for file path, browser will open for choosing the path. Now, we have created an iView in Portal for this t-code. However, F4 is not working from Portal, rather giving an error 'Please wait. You will be forwarded automatically. This page had to be included for technical reasons.'.
    We need to upload excel file even from Portal too. Can somebody please give me some inputs or suggestions?

    Hi Jigar,
    Now I am able to get into SAP screen. However it's not opening the t-code that I mentioned. I gave some Z t-code ZTEST. Once I check the iView, it is showing SAP screen with the below things:
    Service Type:
    Service ID:
    TCode: ZTEST
    Object Type:
    Key:
    Field 1:
    Val. 1:
    Field 2:
    Val.2:
    Field 3:
    Val 3:
    And at the bottom it's giivng a warning message:
    Object type or object does not exist
    Message no. 1W001
    In iView properties I can see Object Type as com.sapportals.portal.iview. Is this the same Object Type that the message is talkign about? Can you please help me out?

  • Uploading Excel file  using 'ALSM_EXCEL_TO_INTERNAL_TABLE'

    Hi,
    I am uploading excel file into an internal table using 'ALSM_EXCEL_TO_INTERNAL_TABLE' FM.
    but I'm getting a popup with the message
    'There is a large amount of the information on the clipboard. Do you want to be able to paste this information into another programme later.' and there are three buttons in the popup 'YES', 'CANCEL' and 'NO'. but for any choice there is no data in the internal table. 
    the progrsm is working in other systems but giving problem in customer laptop, can you please tell me is there any settings need to set for EXCEL or SAP.
    system details are as below
    OS: windows 7
    MS-Office - 2007
    SAP : ECC06

    Looks like there was an intention to clear the clipboard in the code, but this does not seem to work.
    I copied the function module to my own version and added the following code, which seems to work :
    * clear clipboard
      refresh excel_tab.
      call method cl_gui_frontend_services=>clipboard_export
         importing
            data                 = excel_tab
         changing
            rc                   = ld_rc
         exceptions
            cntl_error           = 1
    *       ERROR_NO_GUI         = 2
    *       NOT_SUPPORTED_BY_GUI = 3
            others               = 4
    * Copy only one cell to prevent the clipboard data message.
      call method of worksheet 'Cells' = h_cell
          exporting #1 = 1 #2 = 1.
      m_message.
      call method of worksheet 'Cells' = h_cell1
          exporting #1 = 1 #2 = 1.
      m_message.
      call method  of worksheet 'RANGE' = range
                     exporting #1 = h_cell #2 = h_cell1.
      m_message.
      call method of range 'SELECT'.
      m_message.
    * copy marked area (whole spread sheet) into Clippboard
      call method of range 'COPY'.
      m_message.
    * quit Excel and free ABAP Object - unfortunately, this does not kill
    * the Excel process
      call method of application 'QUIT'.
      m_message.

  • Upload Excel Files to ITable

    Hi... maybe someone of you have been reading about how to upload excel files to an internal table using function module ALSM_EXCEL_TO_INTERNAL_TABLE.
    The problem that I found with this technique is that it is not possible to use this FM with the SAP WAS because it gives a runtime dump (it only works if the file is on the client machine and if the function module is called from SAPGUI.
    Then I have found the topic
    Re: BSP and Excel
    And one guy puts something interesting like this:
    1. In the application use file upload to upload the file.
    2. caputure the content and length
    DATA: data TYPE REF TO CL_HTMLB_FILEUPLOAD.
    data ?= CL_HTMLB_MANAGER=>GET_DATA(
    request = runtime->server->request
    name = 'fileUpload'
    id = 'xx').
    name = data->file_name.
    content = data->file_content.
    length = data->file_length.
    content_type = data->file_content_type.
    3. Then read the data using the class
    DATA: conv TYPE REF TO CL_ABAP_CONV_IN_CE.
    conv = CL_ABAP_CONV_IN_CE=>CREATE( input = CONTENT ).
    conv->READ( importing data = Variable len = length ).
    Now... has anyone continued with this sample? has anyone put the contents into an internal table (with the READ method)...
    If someone did it please show me how to..
    Thanks
    Ariel

    Hi Craig,
    Ok, I was reading the Thomas's Blog and the thread about excel. The blog talks about encoding and the thread is about how to "download" the table. I want to upload the excel to an internal table.
    So, I am almost finishing the code.. But I have a problem (named DUMP) when I create the "conv" object (check the code) the problem is because I dont know how to call the create method indicating 'UFT-16' as encoding.
    I show you my "OnInputProcessing" code:
    IF button_event->id = 'btnUpload'.
      fileUpload ?= CL_HTMLB_MANAGER=>GET_DATA(
                           request = request
                           id      = 'txtFile'
                           name    = 'fileUpload' ).
      IF ( fileUpload->file_name  NE '' ) AND
         ( fileUpload->file_length GT 0 ).
         IF fileUpload->file_content_type
            = 'application/vnd.ms-excel'.
            DATA: content   TYPE ZMTVEMAT,
                  conv      TYPE REF TO CL_ABAP_CONV_IN_CE,
                  viewoff   TYPE REF TO CL_ABAP_VIEW_OFFLEN,
                  it_off    TYPE ABAPOFFLENTAB,
                  wa_off    TYPE ABAPOFFLEN,
                  dd_fields TYPE DDFIELDS,
                  wa_fields TYPE DFIES,
                  len       TYPE I.
            conv = CL_ABAP_CONV_IN_CE=>CREATE(
                      encoding = 'UTF-16'
                      endian   = 'L'
                      input    = fileUpload->file_content ).
            CALL FUNCTION 'TR_NAMETAB_GET'
               EXPORTING
                IV_TABNAME                   = 'ZMTVMAT'
                IV_GET_LENGTHS_IN_CHARMODE   = 'X'
                IV_GET_TEXTS                 = ' '
               IMPORTING
                ET_DFIES                     = dd_fields.
                LOOP AT dd_fields INTO wa_fields.
                  MOVE wa_fields-offset TO wa_off-ioff.
                  MOVE wa_fields-intlen TO wa_off-ilen.
                  APPEND wa_off TO it_off.
                ENDLOOP.
       viewoff = CL_ABAP_VIEW_OFFLEN=>CREATE( tab = it_off ).
                conv->READ(
                            exporting
                              view = viewoff
                            importing
                              data = content
                              len = len ).
    This is the DUMP
    Runtime Errors         CONVT_CODEPAGE_INIT                               
    Exception              CX_SY_CODEPAGE_CONVERTER_INIT                     
           Occurred on     30.11.2004 at 13:20:47                                                                               
    The conversion of some code pages is not supported.                                                                               
    What happened?                                                                               
    The conversion of texts in code page 'UTF-' to code page '1100' is not   
    supported.                                                               
    Thanks
    Ariel

  • Uploading excel files into Web UI

    We are following the blog http://wiki.sdn.sap.com/wiki/display/CRM/CRMWebUI-UploadingdatafromExcelfiles
    to upload excel files into Web UI.
    The  problem which we are facing is that the values are not getting populated in the text are and in the
    event handler EH_ONSERVEREVENT, no values are being populated in lt_items table.
    It would be great if someone could help us with this.

    Hi Nidhi,
    I have tried the blog but due to some reason, could not get it worked out.
    But, If U are ok to use CSV input files, instead of excel, U can use the standard component "GS_FILE_UPLOAD" as a popup and upload the files into the required assignment blocks.

  • Upload excel file to internal table in web dynpro program

    Hi friend's
    In web dynpro program how to upload excel file into  internal table and finally data will be save Y table.

    hi,
    See the properties of File Upload UI element..
    Link: [http://help.sap.com/saphelp_nw70ehp1/helpdata/en/48/732f0510d83ff6e10000000a42189c/frameset.htm]
    Goto References -> User Interface Elements -> Integration Category -> File upload..
    After creating the 'FILE UPLOAD' element in a view.. Bind a datasource(a context attribute with STRING) with the data property..
    Double click on ONACTION_UPLOAD method. Write a code as given below.
    METHOD onactionon_upload .
    TYPES :   BEGIN OF str_itab,
           name(10) TYPE c,
           age(10) TYPE c,
           END OF str_itab.  DATA : t_table1 TYPE STANDARD TABLE OF str_itab,
             i_data TYPE STANDARD TABLE OF string,
             l_string TYPE string,
             fs_table TYPE str_itab,
             l_xstring TYPE xstring,
             fields TYPE string_table,
             lv_field TYPE string.
    DATA : t_table TYPE if_main=>elements_data_tab,
             data_table TYPE if_main=>elements_data_tab.
    * get single attribute 
    wd_context->get_attribute(  
    EXPORTING    
    name =  `DATASOURCE`  
    IMPORTING    
    value = l_xstring ).
      CALL FUNCTION 'HR_KR_XSTRING_TO_STRING'
        EXPORTING
          in_xstring = l_xstring
        IMPORTING
          out_string = l_string. 
    SPLIT l_string  AT cl_abap_char_utilities=>newline INTO TABLE i_data.
    * Bind With table Element.
    LOOP AT i_data INTO l_string.
        SPLIT l_string AT cl_abap_char_utilities=>horizontal_tab INTO TABLE fields.
       READ TABLE fields INTO lv_field INDEX 1.
        fs_table-name = lv_field.  
    READ TABLE fields INTO lv_field INDEX 2.
        fs_table-age = lv_field.   
    APPEND fs_table TO t_table1.     "Append to  the internal  table
      ENDLOOP.
    Edited by: Rameshkumar Raamasamy on Feb 9, 2010 9:39 AM

  • Can 'GUI_UPLOAD'  to be used to upload excel file lonely?

    Hi experts,
    I wonder that can 'GUI_UPLOAD'  to be used to upload excel file lonely. I tried and use 'asc' as the L_FILETYPE, but the data uploaded contain many '###yyy'. But if I save the excel file as a txt file,
    the data can be uploaded by 'GUI_UPLOAD' correctly. So what is the problem?

    Excel files be can't uploaded using "GUI_UPLOAD".
    Use the FM "ALSM_EXCEL_TO_INTERNAL_TABLE"
    Try this code:
    * Upload data direct from excel.xls file to SAP
    REPORT ZEXCELUPLOAD.
    PARAMETERS: filename LIKE rlgrap-filename MEMORY ID M01,
                begcol TYPE i DEFAULT 1 NO-DISPLAY,
                begrow TYPE i DEFAULT 1 NO-DISPLAY,
                endcol TYPE i DEFAULT 100 NO-DISPLAY,
                endrow TYPE i DEFAULT 32000 NO-DISPLAY.
    * Tick don't append header
    PARAMETERS: kzheader AS CHECKBOX.
    DATA: BEGIN OF intern OCCURS 0.
            INCLUDE STRUCTURE  alsmex_tabline.
    DATA: END OF intern.
    DATA: BEGIN OF intern1 OCCURS 0.
            INCLUDE STRUCTURE  alsmex_tabline.
    DATA: END OF intern1.
    DATA: BEGIN OF t_col OCCURS 0,
           col LIKE alsmex_tabline-col,
           size TYPE i.
    DATA: END OF t_col.
    DATA: zwlen TYPE i,
          zwlines TYPE i.
    DATA: BEGIN OF fieldnames OCCURS 3,
            title(60),
            table(6),
            field(10),
            kz(1),
          END OF fieldnames.
    * No of columns
    DATA: BEGIN OF data_tab OCCURS 0,
           value_0001(50),
           value_0002(50),
           value_0003(50),
           value_0004(50),
           value_0005(50),
           value_0006(50),
           value_0007(50),
           value_0008(50),
           value_0009(50),
           value_0010(50),
           value_0011(50),
           value_0012(50),
           value_0013(50),
           value_0014(50),
           value_0015(50),
           value_0016(50),
           value_0017(50),
           value_0018(50),
           value_0019(50),
           value_0020(50),
           value_0021(50),
           value_0022(50),
           value_0023(50),
           value_0024(50),
           value_0025(50),
           value_0026(50),
           value_0027(50),
           value_0028(50),
           value_0029(50),
           value_0030(50),
           value_0031(50),
           value_0032(50),
           value_0033(50),
           value_0034(50),
           value_0035(50),
           value_0036(50),
           value_0037(50),
           value_0038(50),
           value_0039(50),
           value_0040(50),
           value_0041(50),
           value_0042(50),
           value_0043(50),
           value_0044(50),
           value_0045(50),
           value_0046(50),
           value_0047(50),
           value_0048(50),
           value_0049(50),
           value_0050(50),
           value_0051(50),
           value_0052(50),
           value_0053(50),
           value_0054(50),
           value_0055(50),
           value_0056(50),
           value_0057(50),
           value_0058(50),
           value_0059(50),
           value_0060(50),
           value_0061(50),
           value_0062(50),
           value_0063(50),
           value_0064(50),
           value_0065(50),
           value_0066(50),
           value_0067(50),
           value_0068(50),
           value_0069(50),
           value_0070(50),
           value_0071(50),
           value_0072(50),
           value_0073(50),
           value_0074(50),
           value_0075(50),
           value_0076(50),
           value_0077(50),
           value_0078(50),
           value_0079(50),
           value_0080(50),
           value_0081(50),
           value_0082(50),
           value_0083(50),
           value_0084(50),
           value_0085(50),
           value_0086(50),
           value_0087(50),
           value_0088(50),
           value_0089(50),
           value_0090(50),
           value_0091(50),
           value_0092(50),
           value_0093(50),
           value_0094(50),
           value_0095(50),
           value_0096(50),
           value_0097(50),
           value_0098(50),
           value_0099(50),
           value_0100(50).
    DATA: END OF data_tab.
    DATA: tind(4) TYPE n.
    DATA: zwfeld(19).
    FIELD-SYMBOLS: <fs1>.
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR filename.
      CALL FUNCTION 'KD_GET_FILENAME_ON_F4'
           EXPORTING
                mask      = '*.xls'
                static    = 'X'
           CHANGING
                file_name = filename.
    START-OF-SELECTION.
      CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
           EXPORTING
                filename                = filename
                i_begin_col             = begcol
                i_begin_row             = begrow
                i_end_col               = endcol
                i_end_row               = endrow
           TABLES
                intern                  = intern
           EXCEPTIONS
                inconsistent_parameters = 1
                upload_ole              = 2
                OTHERS                  = 3.
      IF sy-subrc <> 0.
        WRITE:/ 'Upload Error ', SY-SUBRC.
      ENDIF.
    END-OF-SELECTION.
      LOOP AT intern.
        intern1 = intern.
        CLEAR intern1-row.
        APPEND intern1.
      ENDLOOP.
      SORT intern1 BY col.
      LOOP AT intern1.
        AT NEW col.
          t_col-col = intern1-col.
          APPEND t_col.
        ENDAT.
        zwlen = strlen( intern1-value ).
        READ TABLE t_col WITH KEY col = intern1-col.
        IF sy-subrc EQ 0.
          IF zwlen > t_col-size.
            t_col-size = zwlen.
    *                          Internal Table, Current Row Index
            MODIFY t_col INDEX sy-tabix.
          ENDIF.
        ENDIF.
      ENDLOOP.
      DESCRIBE TABLE t_col LINES zwlines.
      SORT intern BY row col.
      IF kzheader = 'X'.
        LOOP AT intern.
          fieldnames-title = intern-value.
          APPEND fieldnames.
          AT END OF row.
            EXIT.
          ENDAT.
        ENDLOOP.
      ELSE.
        DO zwlines TIMES.
          WRITE sy-index TO fieldnames-title.
          APPEND fieldnames.
        ENDDO.
      ENDIF.
      SORT intern BY row col.
      LOOP AT intern.
        IF kzheader = 'X'
        AND intern-row = 1.
          CONTINUE.
        ENDIF.
        tind = intern-col.
        CONCATENATE 'DATA_TAB-VALUE_' tind INTO zwfeld.
        ASSIGN (zwfeld) TO <fs1>.
        <fs1> = intern-value.
        AT END OF row.
          APPEND data_tab.
          CLEAR data_tab.
        ENDAT.
      ENDLOOP.
      CALL FUNCTION 'DISPLAY_BASIC_LIST'
           EXPORTING
                file_name     = filename
           TABLES
                data_tab      = data_tab
                fieldname_tab = fieldnames.
    *-- End of Program

Maybe you are looking for