Uploading of Excel data in Internal Table in WebUI

Hello All ,
I have Requirment to Upload the .xls or .xlxs file into Excel . Can any one explain me me how to do i have followed
i have used the following code
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 ).
Here in Read its throughing some junk data which is not in a readable format.
Done this with reference to the link below
Upload Excel Files to ITable
Regards,
Kiran Posanapalli
Edited by: posanapalli kiran on Jan 6, 2010 8:27 AM
Edited by: posanapalli kiran on Jan 6, 2010 8:32 AM

this is a trial method and right now i am trying to read only the first cell of the excel sheet and return that value and show it in the UI when the user presses the button but this code is not returning any value.
METHOD read_excel.
  INCLUDE ole2incl.
  DATA: filename(128) TYPE c,
            excel TYPE ole2_object,
            cell TYPE ole2_object,
            workbook TYPE ole2_object,
           pfile TYPE localfile VALUE
           'C:\Documents and Settings\I047323\Desktop\new.xls',
            name TYPE string.
  CREATE OBJECT excel 'EXCEL.APPLICATION'.
  SET PROPERTY OF excel 'VISIBLE' = 0.
  CALL METHOD OF excel 'WORKBOOKS' = workbook.
  CALL METHOD OF workbook 'OPEN'
    EXPORTING  #1       = pfile.
    CALL METHOD OF excel  'CELLS' = cell
      EXPORTING
        #1      = 1
        #2      = 1
    GET PROPERTY OF cell 'VALUE' = value.
  CALL METHOD OF workbook 'SAVE'.
  CALL METHOD OF workbook 'CLOSE'.
  CALL METHOD OF excel 'QUIT'.
  FREE OBJECT excel.
ENDMETHOD.
Edited by: neelima v on Jan 14, 2008 4:06 PM

Similar Messages

  • Upload excel data into Internal table

    Hi,
    I'm trying to upload excel data into internal table, well the excel file layout will be different on each run of the report.
    Excel file will have 60 columns and 500 record limit. I can upload the excel data using 'ALSM_EXCEL_TO_INTERNAL_TABLE' and 'KCD_EXCEL_OLE_TO_INT_CONVERT' but the output table is generates 60 lines for each record i.e.., 60 * 500 = 30,000 which could cause performance.
    I try with the FM 'TEXT_CONVERT_XLS_TO_SAP', but this will only work if the file structure is static. It didn't work for dynamic file layout. Even GUI_UPLOAD doesn't work to upload excel file, it will work if I convert the file to Tab delimited file.
    Please advise if you know any alternate procedure to upload excel data into internal table.
    Thanks,
    Kumar.

    Moderator message - Cross post locked
    Rob

  • FM to upload the Excel file to internal table

    Hi
    Is any FM available to upload the Excel file to internal table.
    Thanks
    Anbu

    Hi
    se this code
    EXCEL to INTERNAL TABLE and then to APPLICATION SERVER
    *& Report  ZSD_EXCEL_INT_APP
    REPORT  ZSD_EXCEL_INT_APP.
    parameter: file_nm type localfile.
    types : begin of it_tab1,
            f1(20),
            f2(40),
            f3(20),
           end of it_tab1.
    data : it_tab type table of ALSMEX_TABLINE with header line,
           file type rlgrap-filename.
    data : it_tab2 type it_tab1 occurs 1,
           wa_tab2 type it_tab1,
           w_message(100)  TYPE c.
    at selection-screen on value-request for file_nm.
    CALL FUNCTION 'KD_GET_FILENAME_ON_F4'
    EXPORTING
      PROGRAM_NAME        = SYST-REPID
      DYNPRO_NUMBER       = SYST-DYNNR
      FIELD_NAME          = ' '
       STATIC              = 'X'
      MASK                = ' '
      CHANGING
       file_name           = file_nm
    EXCEPTIONS
       MASK_TOO_LONG       = 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.
    start-of-selection.
    refresh it_tab2[].clear wa_tab2.
    file = file_nm.
    CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
      EXPORTING
        filename                      = file
        i_begin_col                   = '1'
        i_begin_row                   =  '1'
        i_end_col                     = '10'
        i_end_row                     = '35'
      tables
        intern                        = it_tab
    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.
    loop at it_tab.
      case it_tab-col.
       when '002'.
        wa_tab2-f1 = it_tab-value.
       when '004'.
        wa_tab2-f2 = it_tab-value.
      when '008'.
        wa_tab2-f3 = it_tab-value.
    endcase.
    at end of row.
      append wa_tab2 to it_tab2.
    clear wa_tab2.
      endat.
    endloop.
    data : p_file TYPE  rlgrap-filename value 'TEST3.txt'.
    OPEN DATASET p_file FOR OUTPUT IN TEXT MODE ENCODING DEFAULT.
    *--- Display error messages if any.
      IF sy-subrc NE 0.
        MESSAGE e001(zsd_mes).
        EXIT.
      ELSE.
    *---Data is downloaded to the application server file path
        LOOP AT it_tab2 INTO wa_tab2.
          TRANSFER wa_tab2 TO p_file.
        ENDLOOP.
      ENDIF.
    *--Close the Application server file (Mandatory).
      CLOSE DATASET p_file.
    loop at it_tab2 into wa_tab2.
      write : / wa_tab2-f1,wa_tab2-f2,wa_tab2-f3.
    endloop.

  • Upload excel data into Internal table dynamically

    Hi all,
    I have a excel file, in this file there are fixed columns but I don't know, at run time, how many rows will come up.
    Now I want to fetch the data from file to internal table, I used
    GUI_UPLOAD and ALSM_EXCEL_TO_INTERNAL_TABLE.
    But it is not working for me.
    Please suggest how to get it.
    Thanks
    Sanket sethi

    HI,
    go through this code:
    Upload data from Excel to internal table.
    CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
        EXPORTING
          filename                = p_pfile
          i_begin_col             = 1
          i_begin_row             = 2
          i_end_col               = 45
          i_end_row               = 8
        TABLES
          intern                  = it_excel
        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.                               " IF sy-subrc  0
    *Populate data to internal tables and structructures
      SORT it_excel BY row col.
      LOOP AT it_excel INTO ls_excel.
        CASE ls_excel-col.
          WHEN 1.
            ls_data-doc_type = ls_excel-value.
          WHEN 2.
            ls_data-rec_no = ls_excel-value.
          WHEN 3.
            ls_data-doc_ver = ls_excel-value.
          endcase.
    endloop.
    Hope it will help you
    Thanks and Regards
    Rahul Sharma

  • Upload Excel data to internal table

    Hello,
    Any idea how to import a HUGE Excel .xlsx file (> 150K rows) into an internal table?
    I have explored the following FMs but it seems like none of them can handle more than 65K rows.
    ALSM_EXCEL_TO_INTERNAL_TABLE
    KCD_EXCEL_OLE_TO_INT_CONVERT
    TEXT_CONVERT_XLS_TO_SAP
    GUI_UPLOAD
    Thanks in advance.
    Regards

    Hi,
    Try this below code
    Note
    you should change the program based on your number of fields of excel sheet. if you have five fields
    then you can adjust structure to 5 fields
    * Here based on excell sheet fileds we can create number of fields
    TYPES:
    BEGIN OF ty_upload,
    F1 TYPE c length 15,
    F2 TYPE c length 15,
    F3 TYPE c length 15,
    END OF ty_upload.
    DATA it_upload TYPE STANDARD TABLE OF ty_upload WITH DEFAULT KEY.
    DATA wa_upload TYPE ty_upload.
    DATA itab TYPE STANDARD TABLE OF alsmex_tabline WITH DEFAULT KEY.
    FIELD-SYMBOLS: <wa> type alsmex_tabline.
    * create variable to hold the file name of presentation server
    PARAMETERS: p_file TYPE  rlgrap-filename.
    * 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.
    CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
    EXPORTING
    **filename = filename
    filename = p_file
    i_begin_col = 1
    i_begin_row = 1
    i_end_col = 3
    i_end_row = 65535
    TABLES
    intern = itab.
    LOOP AT itab ASSIGNING <wa>.
    CASE <wa>-col.
    WHEN '0001'.
    wa_upload-F1 = <wa>-value.
    WRITE:<wa>-value.
    WHEN '0002'.
    wa_upload-F2 = <wa>-value.
    WRITE:<wa>-value.
    WHEN '0003'.
    wa_upload-F3 = <wa>-value.
    WRITE:<wa>-value.
    ENDCASE.
    APPEND wa_upload TO it_upload.
    CLEAR wa_upload.
    ENDLOOP.
    or
    and also try the  function module : TEXT_CONVERT_XLS_TO_SAP

  • Upload openoffice excel file into internal table

    Hi Everyone,
    I have a requirement where in we need to upload vendor master data into SAP.
    The data is available in excel format. But the excel sheet was created in openoffice s/w and client is not allowing
    us to install MS-Office so that we cut and paste the data by creating anexcel file.
    Now there is an option of saving the excel file in openoffice s/w as MS-Excel 95 format with .xls extension.
    But since we are saving this in openoffice enivoronment   the FM ALSM_EXCEL..... data is not improting this excel file into
    Did somebody faced this issue before. Pls share the approach to solve this issue.
    Regards,
    Vinay

    Hi !
    you can use the Function module TEXT_CONVERT_XLS_TO_SAP to upload xcel file to internal table
    please go through the code below.
    REPORT zupload_excel_to_itab.
    TYPE-POOLS: truxs.
    PARAMETERS: p_file TYPE rlgrap-filename.
    TYPES: BEGIN OF t_datatab,
    col1(30) TYPE c,
    col2(30) TYPE c,
    col3(30) TYPE c,
    END OF t_datatab.
    DATA: it_datatab type standard table of 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.
    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.
    LOOP AT it_datatab INTO wa_datatab.
    WRITE:/ wa_datatab-col1,
    wa_datatab-col2,
    wa_datatab-col3.
    ENDLOOP.
    hope this will help you.
    Regards,
    Kiran

  • Problems in uploading from excel sheet to internal table

    hi experts,
    i got one problem regarding uploading data from excel sheet to int.table. I used FM ALSM_EXCEL_TO_INTERNAL_TABLE but in that the value is char of 50. but i need a case where i have to send value more than 50 characters. please suggest me any other FM to overcome this problem.
    advanced thanks
    vijay

    Hi,
    >
    Vijay Krishna Arvapalli wrote:
    > hi tarun,
    >
    > thank you for your reply
    >
    > but when i tried to use FM TEXT_CONVERT_XLS_TO_SAP it is giving error actually that 'Error generating the test frame'.
    >
    > so can you suggest me with some other option where i can upload the field with more than 50 character length.
    >
    > thank you
    > regards
    > vijay
    Yes, when you execute the FM from SE37, then it displays a message.
    Just copy the below code and paste it in a report (SE38) and execute.
    Create a file in C:/ with name test.xls and execute it will display the records even with more than 50 characters of length.
    I have tested and its working.
    I have taken three fields in the excel file empid, name and doj.
    TYPE-POOLS : truxs.
    PARAMETERS : p_file TYPE rlgrap-filename DEFAULT 'C:\TEST.XLS'.
    DATA : BEGIN OF itab OCCURS 0,
             empid(150) TYPE c,
             name(150) TYPE c,
             doj(150) TYPE c,
           END OF itab.
    DATA: it_raw TYPE truxs_t_text_data.
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.
      PERFORM f4_file_process USING p_file.
    AT SELECTION-SCREEN.
      PERFORM validate_file_path USING p_file.
    START-OF-SELECTION.
      PERFORM upload_data.
    END-OF-SELECTION.
      PERFORM display_data.
    *&      Form  F4_FILE_PROCESS
    *       text
    *      -->P_FILE_PATH  text
    FORM f4_file_process USING p_file.
      CALL FUNCTION 'F4_FILENAME'
        EXPORTING
          program_name  = syst-cprog
          dynpro_number = syst-dynnr
          field_name    = 'P_FILE'
        IMPORTING
          file_name     = p_file.
      IF sy-subrc NE 0.
        MESSAGE e000(zsd).
      ENDIF.
    ENDFORM.                    " F4_FILE_PROCESS
    *&      Form  VALIDATE_FILE_PATH
    *       text
    *      -->P_FILE  text
    FORM validate_file_path USING p_file.
      DATA : lv_dir TYPE string,
             lv_file TYPE string,
             lv_result(1) TYPE c.
      DATA : lv_filename TYPE string.
      lv_filename = p_file.
      CALL FUNCTION 'SO_SPLIT_FILE_AND_PATH'
        EXPORTING
          full_name     = p_file
        IMPORTING
          stripped_name = lv_file
          file_path     = lv_dir
        EXCEPTIONS
          x_error       = 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.
      CALL METHOD cl_gui_frontend_services=>directory_exist
        EXPORTING
          directory            = lv_dir
        RECEIVING
          result               = lv_result
        EXCEPTIONS
          cntl_error           = 1
          error_no_gui         = 2
          wrong_parameter      = 3
          not_supported_by_gui = 4
          OTHERS               = 5.
      IF lv_result IS INITIAL.
        MESSAGE 'Invalid Directory' TYPE 'E'.
      ENDIF.
      CLEAR lv_result.
      CALL METHOD cl_gui_frontend_services=>file_exist
        EXPORTING
          file                 = lv_filename
        RECEIVING
          result               = lv_result
        EXCEPTIONS
          cntl_error           = 1
          error_no_gui         = 2
          wrong_parameter      = 3
          not_supported_by_gui = 4
          OTHERS               = 5.
      IF lv_result IS INITIAL.
        MESSAGE 'Invalid File' TYPE 'E'.
      ENDIF.
    ENDFORM.                    " VALIDATE_FILE_PATH
    *&      Form  UPLOAD_DATA
    *       text
    *  -->  p1        text
    *  <--  p2        text
    FORM upload_data .
      CALL FUNCTION 'TEXT_CONVERT_XLS_TO_SAP'
        EXPORTING
          i_field_seperator    = 'X'
          i_line_header        = 'X'
          i_tab_raw_data       = it_raw
          i_filename           = p_file
        TABLES
          i_tab_converted_data = itab[]
        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.
    ENDFORM.                    " UPLOAD_DATA
    *&      Form  DISPLAY_DATA
    *       text
    *  -->  p1        text
    *  <--  p2        text
    FORM display_data .
      LOOP AT itab.
        WRITE : / itab-empid, itab-name, itab-doj.
      ENDLOOP.
    ENDFORM.                    " DISPLAY_DATA
    Hope this helps you.
    Regards,
    Tarun

  • Upload XML file data into internal table

    Hi,
    I need help from you.
    I am uploading XML file from Application server.
    1.In application server under directory it may have several XML files and i need to upload all the XML files  when we gave only directory name. So, what is the function module for that logic . If possible code also.
    2.Once we get the files into some internal table we need to upload data from that files to internal table.
    So what is the logic for that , if possible code also.
    I am giving sample directory:    
    For example in this directory assume 3 xml files are there.
    I need to upload those files and data from that in to internal table.
    Thanks & Regards
    VSR

    Below code will give you an idea.
    TYPE-POOLS: ixml. "iXML Library Types
    *TABLES : rbkp.
    TYPE DECLERATIION
    TYPES: BEGIN OF type_tabpo,
    ebeln TYPE ekko-ebeln, "PO document number
    ebelp TYPE ekpo-ebelp, "PO line item
    END OF type_tabpo.
    TYPES: BEGIN OF type_ekbe,
    belnr TYPE rbkp-belnr, "Invoice document
    gjahr TYPE rbkp-gjahr, "fiscal year
    END OF type_ekbe.
    TYPES: BEGIN OF type_invoice,
    belnr TYPE rbkp-belnr, "PO document number
    gjahr TYPE rbkp-gjahr, "Fiscal Year
    rbstat TYPE rbkp-rbstat, "invoice status
    END OF type_invoice.
    TYPES: BEGIN OF t_xml_line, "Structure for holding XML data
    data(256) TYPE x,
    END OF t_xml_line.
    INTERNAL TABLE DECLERATIION
    DATA: gi_tabpo TYPE STANDARD TABLE OF type_tabpo,
    gi_ekbe TYPE STANDARD TABLE OF type_ekbe,
    gi_invoice TYPE STANDARD TABLE OF type_invoice,
    gi_bapiret2 TYPE STANDARD TABLE OF bapiret2.
    DATA: l_ixml TYPE REF TO if_ixml,
    l_streamfactory TYPE REF TO if_ixml_stream_factory.
    DATA: l_xml_table TYPE TABLE OF t_xml_line, " XML Table of the structure
    l_xml_line TYPE t_xml_line, " Record of structure t_xml_line
    l_xml_table_size TYPE i. " XML table size
    DATA: l_filename TYPE string.
    WORK AREA DECLARATION
    DATA: gw_tabpo TYPE type_tabpo,
    gw_ekbe TYPE type_ekbe,
    gw_invoice TYPE type_invoice,
    gw_bapiret2 TYPE bapiret2.
    BEGIN OF SELECTION SCREEN
    SELECTION-SCREEN BEGIN OF BLOCK blk1 WITH FRAME TITLE text-001.
    PARAMETERS: p_file TYPE pathintern LOWER CASE DEFAULT '/usr/sap/tmp/'.
    Validation of XML file: Only DTD included in XML document is supported
    SELECTION-SCREEN END OF BLOCK blk1.
    SELECTION SCREEN VALIDATION
    AT SELECTION-SCREEN.
    To validate p_file is not initial
    PERFORM sub_validate_file.
    PERFORM sub_validate_path.
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.
    Request for filename for xml file from the application server
    PERFORM sub_get_filename_appl USING p_file.
    START OF SELECTION SCREEN
    START-OF-SELECTION.
    PERFORM sub_fetch_po_details.
    PERFORM sub_get_invoice.
    PERFORM sub_rel_invoice.
    END OF SELECTION SCREEN
    END-OF-SELECTION.
    *& Form sub_validate_file
    To Validate the file
    FORM sub_validate_file .
    IF p_file IS INITIAL.
    MESSAGE e000. "specify the file path
    ENDIF.
    ENDFORM. " sub_validate_file
    *& Form sub_get_filename_appl
    form sub_get_filename_appl USING l_fname TYPE any.
    DATA: l_fname TYPE filename-fileintern. " File name
    *GET THE FILENAME FROM THE APPLICATION SERVER
    CALL FUNCTION '/SAPDMC/LSM_F4_SERVER_FILE'
    EXPORTING
    directory = l_fname
    filemask = '*'
    IMPORTING
    serverfile = l_fname
    EXCEPTIONS
    canceled_by_user = 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.
    ENDFORM. " sub_get_filename_appl
    *& Form sub_fetch_po_details
    To fetch the PO details from the application server
    Format of file is XML
    FORM sub_fetch_po_details .
    TYPE DECLERATIION
    l_ixml = cl_ixml=>create( ).
    Creating a stream factory
    l_streamfactory = l_ixml->create_stream_factory( ).
    PERFORM get_xml_table.
    LOOP AT gi_tabpo INTO gw_tabpo.
    WRITE:/ gw_tabpo.
    ENDLOOP.
    ENDFORM. " sub_fetch_po_details
    *& Form get_xml_table
    Read from the xml file
    FORM get_xml_table .
    Local variable declarations
    DATA: l_len TYPE i,
    l_len2 TYPE i,
    l_tab TYPE tsfixml,
    l_content TYPE string,
    l_str1 TYPE string,
    c_conv TYPE REF TO cl_abap_conv_in_ce,
    l_itab TYPE TABLE OF string.
    l_filename = p_file.
    code to upload data from application server
    OPEN DATASET l_filename FOR INPUT IN BINARY MODE.
    IF sy-subrc 0.
    WRITE:/ 'invalid file path'.
    ENDIF.
    DO.
    READ DATASET l_filename INTO l_xml_line.
    IF sy-subrc EQ 0.
    APPEND l_xml_line TO l_xml_table.
    ELSE.
    EXIT.
    ENDIF.
    ENDDO.
    CLOSE DATASET l_filename.
    code to find the table size
    DESCRIBE TABLE l_xml_table.
    l_xml_table_size = ( sy-tleng ) * ( sy-tfill ).
    *code to convert hexadecimal to XML
    LOOP AT l_xml_table INTO l_xml_line.
    c_conv = cl_abap_conv_in_ce=>create( input = l_xml_line-data
    replacement
    = space ).
    c_conv->read( IMPORTING data = l_content len = l_len ).
    CONCATENATE l_str1 l_content INTO l_str1.
    ENDLOOP.
    l_str1 = l_str1+0(l_xml_table_size).
    SPLIT l_str1 AT cl_abap_char_utilities=>cr_lf INTO TABLE l_itab.
    LOOP AT l_itab INTO l_str1.
    REPLACE ALL OCCURRENCES OF cl_abap_char_utilities=>horizontal_tab IN
    l_str1 WITH space.
    ENDLOOP.
    CALL TRANSFORMATION ('ID') " code to put in internal table
    SOURCE XML l_str1
    RESULT tab = gi_tabpo[].
    ENDFORM. " get_xml_table

  • Data to upload for excel into the internal table

    Hi Friends,
    iam getting the run error when i wrote this code,
    can any one help me please.
    data : begin of itab occurs 3,
           a type i,
           b type i,
           end of itab.
           CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
             EXPORTING
               FILENAME  = 'D:\Siemens\asd.xls'
               I_BEGIN_COL                   = 1
               I_BEGIN_ROW                   = 1
               I_END_COL                     = 2
               I_END_ROW                     = 3
             TABLES
               INTERN                        = itab
            EXCEPTIONS
              INCONSISTENT_PARAMETERS       = 1
              UPLOAD_OLE                    = 2
              OTHERS                        = 3
           IF SY-SUBRC <> 0.
    write : / 'this is not executed'.
    exit.
           ENDIF.
           loop at itab.
           write : / itab-a,itab-b.
           endloop.
    and the data in the excel sheet  is
    1   2
    3   4
    5   5

    Check the following ex:
    REPORT ZFI_EXCEL .
    *Read the data from the locally held spreadsheet
    *Once read using this FM, the data will be held like:-
    *ROW  |COL  |VALUE
    *---|-|---
    *0001 |0001 |2
    *0001 |0002 |00000000001
    *0001 |0003 |1
    *0001 |0004 |
    *0001 |0005 |2
    *0001 |00010|SHORT TEXT for a/c
    *0001 |00011|LONG TEXT a/c 0000000001
    *0002 |0001 |2
    *0002 |0002 |00000000002
    *0002 |0003 |1
    *0002 |0004 |
    *0002 |0005 |2
    *0002 |00010|SHORT TEXT for a/c
    *0001 |00011|LONG TEXT a/c 0000000002
    *etc........
    data: begin of excel_tab occurs 0.
            include structure alsmex_tabline.
    data: end of excel_tab .
    data: begin of itab occurs 0,
            bldat like bkpf-bldat,
            blart like bkpf-blart,
            bukrs like bkpf-bukrs,
            budat like bkpf-budat,
            waers like bkpf-waers,
            bschl like bseg-bschl,
            hkont like bseg-hkont,
            sgtxt like bseg-sgtxt,
          end of itab.
    data: process_tab_struct_tmp like itab.
    field-symbols: <fs1>.
    selection-screen: begin of block blk.
    parameters: fname type rlgrap-filename.
    selection-screen: end of block blk.
    at selection-screen on value-request for fname.
          CALL FUNCTION 'F4_FILENAME'
           EXPORTING
             PROGRAM_NAME        = 'ZFI_EXCEL'
             DYNPRO_NUMBER       = '1000'
             FIELD_NAME          = 'FNAME'
           IMPORTING
             FILE_NAME           = FNAME.
    START-OF-SELECTION.
      CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
        EXPORTING
          filename                      = FNAME
          i_begin_col                   = 1
          i_begin_row                   = 1
          i_end_col                     = 24
          i_end_row                     = 60000
        tables
          intern                        = EXCEL_TAB
    LOOP AT EXCEL_TAB.
    assign component excel_tab-col of structure
                                          process_tab_struct_tmp to <fs1>.
      <fs1> = excel_tab-value.
    at end of row.
    move-corresponding: process_tab_struct_tmp to itab.  “Move values to itab
    append itab.
    endat.
    ENDLOOP.
    LOOP AT ITAB.
      WRITE:/2 ITAB-BLDAT,14(8) ITAB-BLART,20(10) ITAB-BUDAT.
    ENDLOOP.

  • Uploading excel file into internal table

    Hi,
    Any function module is there to upload an excel file into internal table in CRM 7.0 system?
    Thanks.

    Hi Ginger,
    If u have access to ECC R/3 make use FM 'TEXT_CONVERT_XLS_TO_SAP' source code which is existing to convert to Excel to Internal table.  It will work in CRM also.
    As of Now I don't have access to SAP S/m. Mean while u can try as above said.
    Regards,
    Lokesh B

  • Help with uploading an excel file to a table using an application

    Hello,
    Can anyone please help me out with this issue. I have apex application where in the end users upload an excel file to a table. For this I have followed the solution provided in this link
    http://avdeo.com/2008/05/21/uploading-excel-sheet-using-oracle-application-express-apex/
    Using the above solution, I was able to upload the excel data to a table "sample_tbl1" successfully with fields Id,acct_no,owner_name,process_dt. But the thing is I want accomdate a particular condition while uploading the file data, to check see if the acct_no already exists in another table say "sample_tbl2" or not. If acct_nos already exists in sample_tbl2 then give out an error displaying the list of account numbers that already exists in the database. Below is the code which I am using to upload file data to a table.
    DECLARE
    v_blob_data       BLOB; 
    v_blob_len        NUMBER; 
    v_position        NUMBER; 
    v_raw_chunk       RAW(10000); 
    v_char            CHAR(1); 
    c_chunk_len       number       := 1; 
    v_line            VARCHAR2 (32767)        := NULL; 
    v_data_array      wwv_flow_global.vc_arr2; 
    v_rows            number; 
    v_sr_no           number         := 1; 
    l_cnt             BINARY_INTEGER := 0;
    l_stepid          NUMBER := 10;
    BEGIN
    --Read data from wwv_flow_files</span> 
    select blob_content into v_blob_data 
    from wwv_flow_files 
    where last_updated = (select max(last_updated) from wwv_flow_files where UPDATED_BY = :APP_USER) 
    and id = (select max(id) from wwv_flow_files where updated_by = :APP_USER); 
    v_blob_len := dbms_lob.getlength(v_blob_data); 
    v_position := 1; 
    /* Evaluate and skip first line of data
    WHILE (v_position <= v_blob_len ) LOOP
    v_raw_chunk := dbms_lob.substr(v_blob_data,c_chunk_len,v_position);
    v_char :=  chr(hex_to_decimal(rawtohex(v_raw_chunk)));
    v_line := v_line || v_char;
    v_position := v_position + c_chunk_len;
    -- When a whole line is retrieved
    IF v_char = CHR(10) THEN
    -- Clear out 
    v_line := NULL;
    EXIT;
    END IF;
    END LOOP;
    -- Read and convert binary to char</span> 
    WHILE ( v_position <= v_blob_len ) LOOP 
    v_raw_chunk := dbms_lob.substr(v_blob_data,c_chunk_len,v_position); 
    v_char :=  chr(hex_to_decimal(rawtohex(v_raw_chunk))); 
    v_line := v_line || v_char; 
    v_position := v_position + c_chunk_len; 
    -- When a whole line is retrieved </span> 
    IF v_char = CHR(10) THEN
    -- Convert comma to : to use wwv_flow_utilities </span> 
    v_line := REPLACE (v_line, ',', ':'); 
    -- Convert each column separated by : into array of data </span> 
    v_data_array := wwv_flow_utilities.string_to_table (v_line); 
    -- Insert data into target table
    EXECUTE IMMEDIATE 'insert into sample_tbl1(ID,ACCT_NO,OWNER_NAME,PROCESS_DT) 
    values (:1,:2,:3,:4)'
    USING 
    v_sr_no, 
    v_data_array(1), 
    v_data_array(2),
    to_date(v_data_array(3),'MM/DD/YYYY');
    -- Clear out 
    v_line := NULL; 
    v_sr_no := v_sr_no + 1; 
    l_cnt := l_cnt + SQL%ROWCOUNT;
    END IF; 
    END LOOP;
    delete from wwv_flow_files
    where last_updated = (select max(last_updated) from wwv_flow_files where UPDATED_BY = :APP_USER)
    and id = (select max(id) from wwv_flow_files where updated_by = :APP_USER);
    l_stepid  := 20;
    IF l_cnt = 0 THEN
    apex_application.g_print_success_message := apex_application.g_print_success_message || '<p><span style="font-size:14;font-weight:bold">Please select a file to upload.</span></p>' ;
    ELSE
    apex_application.g_print_success_message := apex_application.g_print_success_message || '<p><span style="font-size:14;font-weight:bold;color:green">File uploaded and processed ' || l_cnt || ' record(s) successfully.</span></p>';
    END IF;
    l_stepid  := 30;
    EXCEPTION WHEN OTHERS THEN
    ROLLBACK;
    apex_application.g_print_success_message := apex_application.g_print_success_message || '<p><span style="font-size:14;font-weight:bold;color:red">Failed to upload the file. '||REGEXP_REPLACE(SQLERRM,'[('')(<)(>)(,)(;)(:)(")('')]{1,}', '') ||'</span></p>';
    END;
    {code}
    Can anyone please help me, how do i accomdate the condition within my existing code.
    thanks,
    Orton                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

    Orton,
    From your code it appears that the account No comes in the second column of the file = > v_data_array(1)
    So You can put a conditional block around the execute immediate code that inserts the records
    For instance
      SELECT count(1) INTO ln_account_no_exists from <"sample_tbl2> where account_no = v_data_array(1);
      IF (  ln_account_no_exists > 0 ) THEN
         --Account No: already exists
        <Do what you want to do here >
      ELSE
        EXECUTE IMMEDIATE ...
      END IF:
    {code}
    Inorder to handle the account no records which exists you can
      <li>Raise an exception
      <li> Write record to table or insert into collection and then use a report region in the page based on this table/collection to show error records
      <li> Append errored account No:s to the Success Message Variable programmatically(this variable is used by PLSQL process success/error message )
       {code}
        IF ( record exists)
          apex_application.g_print_success_message := apex_application.g_print_success_message||','|| v_data_array(1) ; -- Comma separated list of errored account no:s
        ELSE ...
       {code}
    Hope it helps                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • Error in uploading excel sheet data into internal table

    Dear all,
    i am facing problem when uploading data from excel. i used KD_GET_FILENAME_ON_F4.i select the file and pass on to ALSM_EXCEL_INTO_INTERNAL_TABLE.and i get the ERROR....
      Illegal type when transferring an internal table to a FORM. this is my code .
    types : begin of ty_mm01,
            matnr like rmmg1-matnr,
            mbrsh like rmmg1-mbrsh,
            mtart like rmmg1-mtart,
            maktx like makt-maktx,
            meins like mara-meins,
            matkl like mara-matkl,
            bismt like mara-bismt,
            spart like mara-spart,
            mtpos like mara-mtpos_mara,
            end of ty_mm01.
    data :  tt_mm01 type standard table of ty_mm01,
            wa_mm01 like TT_MM01.
    data : t_bdcdata like standard table of bdcdata,
           t_bdcmsgcoll like standard table of bdcmsgcoll.
    constants:  begcol TYPE i value 1 ,
                begrow TYPE i value 1,
                endcol TYPE i value 100,
                endrow TYPE i value 32000.
    selection-screen : begin of block bdc with frame.
    parameter : tfile like rlgrap-filename obligatory.
    selection-screen : end of block bdc.
    at selection-screen on value-request for tfile.
    CALL FUNCTION 'KD_GET_FILENAME_ON_F4'
    EXPORTING
       PROGRAM_NAME        = 'ZMM_MAT_MAS_BASIC_DATA'
       DYNPRO_NUMBER       = '1000'
       FIELD_NAME          = 'TFILE'
       STATIC              = 'X'
      MASK                = ',*.xls,'
      CHANGING
        FILE_NAME           = tfile
    start-of-selection.
    CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
      EXPORTING
        FILENAME                      = tfile
        I_BEGIN_COL                   = begcol
        I_BEGIN_ROW                   = begrow
        I_END_COL                     = endcol
        I_END_ROW                     = endrow
      TABLES
        INTERN                        = tt_mm01
    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.
    Thanks in advance

    Hi,
    Check these FM : KCD_EXCEL_OLE_TO_INT_CONVERT
    Report ZPSP_TEST.
    data: bdc_DATA like bdcdata occurs 0 with header line,
    mess_tab like bdcmsgcoll occurs 0 with header line.
    DATA: BEGIN OF ITAB OCCURS 0 ,
    tcnt TYPE i, "Table Counter &H0D
    WERKS LIKE T001W-WERKS,
    BNFPO LIKE EBAN-BNFPO,
    MATNR LIKE MARA-MATNR,
    MENGE LIKE EBAN-MENGE,
    END OF ITAB.
    start-of-selection.
    PERFORM upload_data.
    loop at itab.
    perform bdc_dynpro using 'SAPMM06B' '0100'.
    perform bdc_field using 'BDC_CURSOR'
    'EBAN-BSART'.
    perform bdc_field using 'BDC_OKCODE'
    '/00'.
    perform bdc_field using 'EBAN-BSART'
    'NB'.
    perform bdc_field using 'RM06B-LPEIN'
    'T'.
    perform bdc_field using 'EBAN-WERKS'
    ITAB-WERKS.
    perform bdc_dynpro using 'SAPMM06B' '0106'.
    perform bdc_field using 'BDC_CURSOR'
    'RM06B-EKGRP'.
    perform bdc_field using 'BDC_OKCODE'
    '/00'.
    perform bdc_field using 'RM06B-BNFPO'
    ITAB-BNFPO.
    perform bdc_dynpro using 'SAPMM06B' '0106'.
    perform bdc_field using 'BDC_CURSOR'
    'EBAN-MENGE(01)'.
    perform bdc_field using 'BDC_OKCODE'
    '/00'.
    perform bdc_field using 'EBAN-MATNR(01)'
    ITAB-MATNR.
    perform bdc_field using 'EBAN-MENGE(01)'
    ITAB-MENGE.
    perform bdc_dynpro using 'SAPMM06B' '0102'.
    perform bdc_field using 'BDC_CURSOR'
    'EBAN-MENGE'.
    perform bdc_field using 'BDC_OKCODE'
    '/00'.
    *perform bdc_field using 'RM06B-EEIND'
    record-EEIND_010.
    *perform bdc_field using 'RM06B-LPEIN'
    record-LPEIN_011.
    *perform bdc_field using 'EBAN-EKGRP'
    record-EKGRP_012.
    *perform bdc_field using 'EBAN-BADAT'
    record-BADAT_013.
    *perform bdc_field using 'EBAN-FRGDT'
    record-FRGDT_014.
    *perform bdc_field using 'EBAN-PREIS'
    record-PREIS_015.
    *perform bdc_field using 'EBAN-WAERS'
    record-WAERS_016.
    *perform bdc_field using 'EBAN-PEINH'
    record-PEINH_017.
    *perform bdc_field using 'EBAN-REPOS'
    record-REPOS_018.
    perform bdc_dynpro using 'SAPMM06B' '0106'.
    perform bdc_field using 'BDC_CURSOR'
    'EBAN-MENGE(02)'.
    perform bdc_field using 'BDC_OKCODE'
    '/00'.
    *perform bdc_field using 'RM06B-BNFPO'
    record-BNFPO_019.
    *perform bdc_field using 'EBAN-MATNR(02)'
    record-MATNR_02_020.
    *perform bdc_field using 'EBAN-MENGE(02)'
    record-MENGE_02_021.
    perform bdc_dynpro using 'SAPMM06B' '0102'.
    perform bdc_field using 'BDC_CURSOR'
    'EBAN-MENGE'.
    perform bdc_field using 'BDC_OKCODE'
    '/00'.
    *perform bdc_field using 'EBAN-MENGE'
    ITAB-MENGE_023.
    *perform bdc_field using 'RM06B-EEIND'
    record-EEIND_024.
    *perform bdc_field using 'RM06B-LPEIN'
    record-LPEIN_025.
    *perform bdc_field using 'EBAN-EKGRP'
    record-EKGRP_026.
    *perform bdc_field using 'EBAN-BADAT'
    record-BADAT_027.
    *perform bdc_field using 'EBAN-FRGDT'
    record-FRGDT_028.
    *perform bdc_field using 'EBAN-PREIS'
    record-PREIS_029.
    *perform bdc_field using 'EBAN-WAERS'
    record-WAERS_030.
    *perform bdc_field using 'EBAN-PEINH'
    record-PEINH_031.
    *perform bdc_field using 'EBAN-REPOS'
    record-REPOS_032.
    perform bdc_field using 'EBAN-TXZ01'
    'BEARING 2"X2"'.
    perform bdc_field using 'EBAN-MENGE'
    '65'.
    perform bdc_field using 'RM06B-EEIND'
    '2005/01/03'.
    perform bdc_field using 'RM06B-LPEIN'
    'D'.
    perform bdc_field using 'EBAN-EKGRP'
    'M11'.
    perform bdc_field using 'EBAN-BADAT'
    '2005/01/03'.
    perform bdc_field using 'EBAN-FRGDT'
    '2005/01/03'.
    perform bdc_field using 'EBAN-PREIS'
    ' 1,120.00'.
    perform bdc_field using 'EBAN-WAERS'
    'EUR'.
    perform bdc_field using 'EBAN-PEINH'
    '1'.
    perform bdc_field using 'EBAN-REPOS'
    'X'.
    perform bdc_dynpro using 'SAPMM06B' '0102'.
    perform bdc_field using 'BDC_CURSOR'
    'EBAN-MENGE'.
    perform bdc_field using 'BDC_OKCODE'
    '/00'.
    perform bdc_field using 'EBAN-TXZ01'
    'DRILLING PIPE 10"'.
    perform bdc_field using 'EBAN-MENGE'
    '75'.
    perform bdc_field using 'RM06B-EEIND'
    '2005/01/03'.
    perform bdc_field using 'RM06B-LPEIN'
    'D'.
    perform bdc_field using 'EBAN-EKGRP'
    'M11'.
    perform bdc_field using 'EBAN-BADAT'
    '2005/01/03'.
    perform bdc_field using 'EBAN-FRGDT'
    '2005/01/03'.
    perform bdc_field using 'EBAN-PREIS'
    ' 0.53'.
    perform bdc_field using 'EBAN-WAERS'
    'EUR'.
    perform bdc_field using 'EBAN-PEINH'
    '1'.
    perform bdc_field using 'EBAN-REPOS'
    'X'.
    perform bdc_dynpro using 'SAPMM06B' '0106'.
    perform bdc_field using 'BDC_CURSOR'
    'RM06B-BNFPO'
    perform bdc_field using 'BDC_OKCODE'
    '&H3DBU'.
    *perform bdc_field using 'RM06B-BNFPO'
    CALL TRANSACTION 'ME51' USING BDC_DATA MODE 'A'.
    endLOOP.
    FORM upload_data.
    *local variable declaration
    DATA : lv_index TYPE i,
    l_count TYPE i.
    *local constants declaration
    CONSTANTS:
    lc_start_col TYPE i VALUE '1' ,
    lc_start_row TYPE i VALUE '2' ,
    lc_end_col TYPE i VALUE '256' ,
    lc_end_row TYPE i VALUE '65536'.
    *local field symbol declaration
    FIELD-SYMBOLS : <lf_s>.
    *loacal internal table declaration
    DATA : li_intern TYPE kcde_cells OCCURS 0 WITH HEADER LINE.
    *refresh internal table for each loop
    CLEAR: li_intern,
    l_count .
    REFRESH li_intern.
    to upload the data in excel on the presentation server this function
    module converts the data from excel file into an internal table
    containing row no col no and value
    CALL FUNCTION 'KCD_EXCEL_OLE_TO_INT_CONVERT'
    EXPORTING
    filename &H3D 'Give file location here'
    i_begin_col &H3D lc_start_col
    i_begin_row &H3D lc_start_row
    i_end_col &H3D lc_end_col
    i_end_row &H3D lc_end_row
    TABLES
    intern &H3D li_intern
    EXCEPTIONS
    inconsistent_parameters &H3D 1
    upload_ole &H3D 2.
    checking for data in internal table
    CHECK NOT li_intern[] IS INITIAL.
    sorting internal table
    SORT li_intern BY row col.
    collecting data into an internal table
    LOOP AT li_intern.
    MOVE: li_intern-col TO lv_index.
    lv_index &H3D lv_index + 1.
    ASSIGN COMPONENT lv_index OF STRUCTURE itab TO <lf_s>.
    MOVE : li_intern-value TO <lf_s>.
    AT END OF row.
    l_count &H3D l_count + 1.
    itab &H3D l_count.
    APPEND itab.
    ENDAT. " at end of row
    ENDLOOP. " loop at li_intern
    Reg,
    Siva
    Edited by: Siva Prasad on Jun 1, 2009 8:41 AM
    Edited by: Siva Prasad on Jun 1, 2009 4:25 PM

  • Uploading  Excel sheet  data into internal table

    Hi All,
    I want to upload Excel file data into internal table. My problem is that my excel file  having more than one sheets. I want to upload  the data of particula Excel sheet..
    Please suggest me how can I upload particulat Excel sheet data .
    Thanks and regards
    Praveen

    check this link
    Uploading multiple excel sheets
    You can check Satish's answer in the above link
    Re: uploading data from excel sheets through BDC's into sap system
    <b>Award points if found helpful</b>

  • Upload long text from excel file into internal table

    I need to upload service master(T-code : AC02) data alongwith long text.Now i have data in excel as: Service no(ASMD-ASNUM) and corresponding long text for it.
    I am facing problem in getting entire lontext from excel into my internal table.It only takes till 255 characters i think.Any help in this regard woulg be highly appreciable.

    hi,
    what is the maximum length of your long text.
    and you can try with more than 255 chars. in the internal table it will take , if you want check it.
    i'm in 4.7 ,5.0 version, what about you ..
    please check , you can upload even more than 255.
    try
    regards
    vijay

  • Function module to get data into internal table from Excel file sheets

    Hi,
    I have to upload customers from excel file.
    we are donloading customer data excel file sheets.
    Customer data in 1 sheet, tax data the other sheet of same excel file, Customer master-Credit data in other sheet of same excel file.
    so i have 3-4 sheet in one excel file.
    now my requirement is to get the data from excel file into internal table.
    is there any function module.
    Thanks & Regards

    I am sending you the idea with an example how you can upload data from an EXCEL file into an internal table. I am not sure if you can take data from different sheet in the same EXCEL file. I think that this is not possible (try it )
    Upload the data into an internal table, like the way that I am describing in the above:
      DATA: L_MAX_COL_NB TYPE I.
      DATA: l_file_name LIKE RLGRAP-FILENAME.
    Just to be sure that is the correct type for the FM.
      l_file_name = P_FILE_NAME.
      L_MAX_COL_NB = 58.  "Maximum nb of colums that the FM can read.
      CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
           EXPORTING
                FILENAME                = l_file_name
                I_BEGIN_COL             = 1
                I_BEGIN_ROW             = 2
                I_END_COL               = L_MAX_COL_NB
                I_END_ROW               = 9999
           TABLES
                INTERN                  = PT_EXCEL
           EXCEPTIONS
                INCONSISTENT_PARAMETERS = 1
                UPLOAD_OLE              = 2
                OTHERS                  = 3.
      IF SY-SUBRC <> 0.
      ENDIF.
    Now you should upload the data into your own itab. The Function Module will return to you all the an itab
    from all fields and columns. Define the structure of the uploading file into SE11 - Data Dictionary. Then read the fieldcatalog of this structure. In the code that I am sending to you, I am insearting an empty line into the internal table and then I am assigning this line into a corresponding field-symbol. Then I am able to change the working area - so and the line of the itab. Propably you could you the statement APPEND INITIAL LINE TO (your_table_name) ASSIGNING <your_field_symbol>, but the example was written in an old SAP version.
      FIELD-SYMBOLS:
                     <F_REC> LIKE WA_UPLOAD_FILE,      "working are of the uploading file
                     <F_FIELD> TYPE ANY.
      DATA: COLUMN_INT TYPE I,
            C_FIELDNAME(30) TYPE C.
      PERFORM GET_FIELDCATOLG TABLES FIELDCAT
                               USING 'ZECO_CHARALAMBOUS_FILE'.
      LOOP AT PT_EXCEL.
        AT NEW ROW.
          ASSIGN WA_UPLOAD_FILE TO <F_REC>.
        ENDAT.
        COLUMN_INT = PT_EXCEL-COL.
        READ TABLE FIELDCAT INTO WA_FIELDCAT INDEX COLUMN_INT.
        CONCATENATE '<F_REC>-' WA_FIELDCAT-FIELDNAME INTO C_FIELDNAME.
        ASSIGN (C_FIELDNAME) TO <F_FIELD>.
        <F_FIELD> = PT_EXCEL-VALUE.
        AT END OF ROW.
          APPEND WA_UPLOAD_FILE TO GT_UPLOAD_FILE.
          CLEAR WA_UPLOAD_FILE.
        ENDAT.
      ENDLOOP.
    With Regards
    George
    Edited by: giorgos michaelaris on Mar 4, 2010 3:44 PM

Maybe you are looking for

  • Cannot delete music from ipod nano if not connected!

    I couldn´t believe it´s not possible to delete files from my ipod nano 4G when not connected to my PC !! I use it to record talks (w/ XtremeMac´s MicroMemo) and I needed to make some room to record important talks in a seminar and I found it´s imposs

  • My iMac is no longer visible on my local network after upgrade to lion

    Prior to upgrading from Snow Leopard to Lion, my iMac and it's shared folders were visible under the "Network" folder of my Windows 7 PC. After upgrading to Lion, I can't see my iMac from my Windows 7 PC or, obviously it's shared folders...  I suspec

  • SCCM collection query to create ESX host machines

    Hello Everyone I am looking SCCM collection query to create  ESX host collection. Any one can share the query to create EST host machines collection please

  • Unidentified Error when connecting DW with MySql

    Hi I am trying to connect to Mysql Database which is hosted by a hosting company on their server.  I have been given a static IP address and port to access this database remotely. I have add the information below to DW 8 in an attempt to gain access

  • Which Is the Right Power Pack?

    My mother's thumb was amputated due to bone cancer a few months ago. At Christmas, I bought her an iPhone 4S with a Morphie Juice Pack. It's a nice piece of equipment with a few glaring problems. It has no AC adapter. One has to separate it into the