How to Upload Excel sheet in DB or internal table using SAP NetWeaver ABAP

Dear All experts,
Pls provide guidance  to Upload Excel sheet in DB or internal table using ABAP in  ( SAP NetWeaver stack  )
Regards
Machindra
Edited by: Machindra Patade on Apr 8, 2010 3:07 PM

Please search before posting.
Thread locked.
Thomas

Similar Messages

  • How to prepare excels  based on records of internal table.

    Hi abapers,
    I have a scenario as follows:
    In my internal table the records are as follows.
    col1   col2        col3
    1        a1          b1
    2        a2          b1
    3        a3          b2
    4        a4          b3.
    Now want i need is i have to break the records on the basis of  col3 . All b1 rows  are to be taken and dumped in a excel. b2 rows are to be taken and dumped in an excel and similarly for b3. And the name of excel will should be b1, b2 , b3 respectively.
    How do i go for the case?
    Help would be appreciated..
    Regards,
    Navin C
    Edited by: navin.c on Jun 12, 2009 7:41 AM

    put col3 as the first field in your itab.
    TYPES:BEGIN OF ty3,
    col3(3) TYPE c,
    col2(3) TYPE c,
    col1(3) TYPE c,
    END OF ty3.
    DATA:itab3 TYPE TABLE OF ty3.
    DATA:it_xl TYPE TABLE OF ty3.
    DATA:wa3 TYPE ty3.
    DATA:file_name TYPE string.
    SORT itab3 BY col3.
    LOOP AT itab3 INTO wa3.
      APPEND wa3 TO it_xl.
      AT END OF col3.
        READ TABLE itab3 INTO wa3 INDEX sy-tabix.
        CHECK sy-subrc = 0.
        file_name  = wa3-col3.
        PERFORM download_xl USING file_name.
        REFRESH it_xl.
      ENDAT.
    ENDLOOP.
    *&      Form  download_xl
    *       text
    *      -->P_FILE     text
    FORM download_xl USING p_file type any.
      DATA:lv_path TYPE string VALUE 'c:\'.
      CONCATENATE lv_path  p_file '.xls' INTO p_file.
      CONDENSE p_file NO-GAPS.
      CALL FUNCTION 'GUI_DOWNLOAD'
        EXPORTING
          filename              = p_file
          filetype              = 'DAT'
          write_field_separator = '#'
        TABLES
          data_tab              = it_xl.
    ENDFORM.                    "download_xl

  • How to upload the flat file records into internal table by position?

    Hi
    I have a flat file which has 7 records in each row and they are NOT provided with CSV or Tab demilited...
    They are continous text without spaces....
    but i know the fixed length of each field Eg : 1st field 7 char and seconc field 3 char and so on...
    How can i upload this file into internal table by reading positions of each field...I know we can use GUI_UPLOAD and Read dataset and Open dataset...
    But please let me know to read the file with the fixed postions and load into internal table...
    Thanks in advance
    MM

    Hi
    As per my knowledge i dont think thr is some function module or so to read with a fixed positions.
    You can use the below method if you think this is the best way.
    Suppose your file has
    types : begin of ty_itab,
                field1 type char7,
                field2 type char3,
                field3 type chat3,
                field4 type char3,
                end of ty_itab.
    types : begin of ty_upload,
                 str type string,
                end of ty_upload.
    data : it_itab type standatd table of ty_itab,
              it_upload type standard table ot ty_upload,
              wa_itab type ty_itab,
              wa_upload type ty_upload.
    use gui_upload.get the data in it_upload.
    here you know that u have first 16 charcters makes a first row n then next 16 charcters next row
      Loop at it_upload into wa_upload.
       v_len =  strlen ( wa_upload ).
       v_len = v_len / 16.
        You get number of rows per record ,if it is decimal value make it final value if 3.9 make to 4.
        do v_len times.
          wa_itab = wa_upload.
          By this only first 16 characters are moved and respective fields will get a value.or else u can use offset
           wa_upload+0(16).
          append wa_itab to it_itab.
          Now shift 16 characters using shift command in wa_upload.
        enddo.
      endloop.
    Hope this syntax help you to resolve your issue.May be something i have missed .Right now i don't have sap system to send you the full correct syntax code.
    Cheers
    Joginder

  • How to upload an excel to a dynamically generated internal table?

    Hi,
    I have an excel sheet. I have to create an internal table dynamically according to the fields of the excel sheet. The internal table i have created successfully, the fields are exactly coming as the excel sheet. I need to upload the excel sheet directly to my Internal table.
    Similar to the FM GUI_UPLOAD, which directly uploads the text document into the internal table
    I am not able to pass my dynamic internal table to the GUI_UPLOAD, The tables parameter in the GUI_UPLOAD is accepting only the standard tables.
    How to do?
    -Sudheer

    Hi,
    Use TEXT_CONVERT_XLS_TO_SAP  Function  Module.
    AWARD POINTS IF USEFUL

  • Regarding uploading excel sheet in eCATT

    Hi,
    I would like to know how to upload excel sheet in ecatt.I am using 6.4 version.I have created a test script and test configuration.It would be great if anyone suggests me the procedure or path how to upload excel sheet to test the scripts.
    Thanks,
    Aparna.

    Hi
    See the links
    check these link,
    eCATT- An Introduction
    /people/sumeet.kaul/blog/2005/07/26/ecatt-an-introduction
    Creating Test Scripts
    /people/sumeet.kaul/blog/2005/08/10/ecatt-creating-test-scripts
    eCATT Logs
    /people/sapna.modi/blog/2006/04/18/ecatt-logs-part-vi
    eCATT Scripts Creation – TCD Mode
    /people/sapna.modi/blog/2006/04/10/ecatt-scripts-creation-150-tcd-mode-part-ii
    Creation of Test Data Container
    /people/sumeet.kaul/blog/2005/08/24/ecatt-creation-of-test-data-container
    eCATT Scripts Creation - SAPGUI Mode
    /people/sapna.modi/blog/2006/04/10/ecatt-scripts-creation--sapgui-mode-part-iii
    Integrating ECATT & MERCURY QTP Part -1
    /people/community.user/blog/2007/01/02/integrating-ecatt-mercury-qtp-part-1
    Using eCatt to Test Web Dynpro ABAP
    /people/thomas.jung/blog/2006/03/21/using-ecatt-to-test-web-dynpro-abap
    and
    -command reference
    http://help.sap.com/saphelp_nw04/helpdata/en/c6/3c333b40389c46e10000000a114084/content.htm
    /people/sapna.modi/blog/2006/04/10/ecatt--an-introduction-part-i
    http://prasadbabu.blogspot.com
    https://www.sdn.sap.com/sdn/developerareas/was.sdn?page=test_tool_integration_for_sap_e-catt.htm
    http://help.sap.com/saphelp_nw04/helpdata/en/1b/e81c3b84e65e7be10000000a11402f/frameset.htm
    http://www.erpgenie.com/ecatt/index.htm
    hope this helps.
    Reward points if useful
    Regards
    Anji

  • Uploading excel sheet in BDC

    Hi Abapers,
          I had  doubt regarding uploading excel sheet using BDC.
    I dont know how to upload excel sheet,after executing the BDC program in a go, i.e.. after executing the program i have to press ENTER for each & every record to upload(this s the way i know).
          I dont know how to upload directly, without pressing ENTER for every record.
    I m getting error while saving in xls format.Give me an idea, in which format i want to save the flatfile for  uploading in BDC.
    So, clarify me about this doubt....

    Hi BDK,
         Try this Function Module to get from excel to internal table,
    CALL FUNCTION 'TEXT_CONVERT_XLS_TO_SAP'
         EXPORTING
      I_FIELD_SEPERATOR          = ','
          i_line_header              = p_head
           i_tab_raw_data             = it_raw
           i_filename                 = p_upl
         TABLES
           i_tab_converted_data       = t_indata
        EXCEPTIONS
          conversion_failed          = 1
          OTHERS                     = 2
    if you are using call transaction then select the Processing Mode as N.it will upload in one go.

  • Function module to upload excel to internal table in SAP 7.0 version system

    <<Question has been asked and answered many times - please search before asking for function modules for common tasks>>
    currently i am using SAP Netweaver7.0 version, i need a Funtion Module to upload an Excel sheet data to an internal table.
    please let me know this ASAP.
    thanks,
    Edited by: Matt on Aug 24, 2009 7:25 AM

    hi,
    the FM you have suggested does not exist in the *version 7.0*
    added the FM "ALSM_....",also does not exist
    pls suggest a FM for SAP7.0 version

  • Upload an XML file into the Internal table

    Hi Guys,
    I want to know, how to upload an xml file into the Internal table through ABAP programming

    you just wanted to load the xml file into internal table (as a table of binary strings)or load the xml data mapped to itab row columns
    for the first one you can simply use gui_upload
    and for the second one you need to load the xml file using gui_upload and use XLST program to transform into an itab
    Regards
    Raja

  • How to upload Excel data in Ztables fastly & easily.

    Dear ALL,
    I  want to compare material codes in 2 different excel sheets.
    I have downloaded output from 2 different SQVI into 2 different excel sheets.
    Now I want to compare these 2 sheets to get matching codes or unmatching codes.
    I can use VLOOKUP in excel also. But How can I make use of ABAP by downloading these excel data in 2 different Ztables and compare these 2 tables with some user defined TC (transaction code) ?
    For this activity How to upload Excel data(2 sheets) in 2 Ztables fastly & easily ?
    Is there any method other than SCAT , BDC and LSMW  ???
    Or which is best method in above ?
    Pl' reply.
    Thanks.

    Have a look at the program
    *: Description                                                :
    *: This is a simple example program to get data from an excel :
    *: file and store it in an internal table.                    :
    *: Author : www.sapdev.co.uk, based on code from Jayanta      :
    *: SAP Version : 4.7                                          :
    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.
    Message was edited by:
            K N  REDDY

  • Upload Excel sheet using Data Integrator 6.1?

    hi all ,
    Upload Excel sheet using Data Integrator? and how to create ODBC for the PC and jobserver i am using version 6.1? i am using excel as my one of the data source and tell me how to use different types of data sources in DI . after uploading the xl file if i apply any transform on the excel data i will give error like
    Posted: 25 Sep 2008 04:30
    Post subject: Re: Upload Excel sheet using Data Integrator? 
    I am getting the error like
    3128 292 CON-120302 09-25-08 09:59:40 ODBC call <SQLDriverConnect> for data source <sas> failed: <[Microsoft][ODBC Driver Manager] Data source name not found and no
    3128 292 CON-120302 09-25-08 09:59:40 default driver specified>. Notify Customer Support.
    1512 2992 CON-120302 09-25-08 09:59:41 ODBC call <SQLDriverConnect> for data source <sas> failed: <[Microsoft][ODBC Driver Manager] Data source name not found and no
    1512 2992 CON-120302 09-25-08 09:59:41 default driver specified>. Notify Customer Support.
    Please help me out
    Thank u

    Hi Shonti,
    The DI 11.7 installer can be used to upgrade a DI 6.1 local repository (e.g. the upgrade is supported).  This will migrate all jobs and flows.  They will remain intact, however, this is always a major migration effort and should not be taken lightly.  If you do upgrade, please make sure this is a planned effort with rigorous testing and validation.  You should also ensure that you consult the release notes and [supported platforms documentation|https://websmp110.sap-ag.de/~form/sapnet?_SHORTKEY=01100035870000712240&_SCENARIO=01100035870000000202] for the 11.7 package you intend to install.  The DI 11.7 documentation also contains info about how to install and configure the Excel Adapter, and what functionality it provides.
    Thanks,
    ~Scott

  • Upload excel sheet data through sqlloader into oracle tables

    hi everyone,
    i am working with excel sheet with following records
    8501      Jacob Marshall      15000      21/10/2009      Finance
    8502      Chris Campell      50000      13/06/2008      R&D
    8503      Simon Dough      50000      3/07/2008      Engineering
    8504      Mark Haggai      75000      9/3/2006      Product Management
    8505      Verica Beverley      45000      7/2/2008      HR
    and i saved it in emp_details.csv
    after that when i write following code to make control file
    load data
    infile 'C:\Documents and Settings\prashant_dabral\Desktop\a.txt'
    into table tmp
    field terminated by','optionally enclosed by" "
    (emp_no,emp_name,salary,doj,dept_name)
    after this pl\sqldev returning me error message that ORA-00900:invalid sql statement
    can anybody tell me how to resolve issue
    or
    another method to Upload excel sheet data through sqlloader into oracle tables

    A control file is a file located on the operating system, not some SQL or PL/SQL code you try and execute.
    Create the control file as a file and then use that to load your data with SQL*Loader from the command line.
    http://www.morganslibrary.org/reference/sqlloader.html
    Or better still, create it as an external table and then you don't need a seperate control file or need to use sql loader from the command line...
    http://www.morganslibrary.org/reference/externaltab.html

  • How to upload Excel file in BI using function module in abap program

    How to upload Excel file in BI using function module in abap program?

    Hi Anuj,
    To upload the file , you can try a standard program "RSEPSFTP" .
    while you execute the program , a selection screen appears in which the inputs should be give as
    RFC destination - The target server name
    FTP command- PUT
    local file - your file name
    local directory - path of your local file
    remote file - your target file name
    remote directory - where it has to be stored
    Hope this is useful for you
    Thanks & regards
    Anju

  • Uploading Excel sheet in LSMW

    I am facing problem with uploading Excel sheet in LSMW. However, when I try to upload same data through tabulated file, its working perfectly fine.
    Please suggest the required solution.

    Thanks a lot !!! Your solution really helped. However, one correction :- When we use "No Delimiter" option.. data gets populated erroneously. I tried using "Comma Separated" and it is working.
    If there is any deviation please tell.

  • Can I upload excel sheets to BC for other admins to see?

    Can I upload excel sheets to BC for other admins to see?  Like inventory sheets...

    Currently you cannot upload folders. You can upload multiple files at once as long as you are not using the IE browser, which by Microsoft's design does not allow multiple file upload. Improved sharing and collaboration is coming. You can read more here http://blogs.adobe.com/creativecloud/coming-soon-to-creative-cloud/.

  • How to Upload Excel file to Application Server

    Hi Friends,
    ALSM_EXCEL_TO_INTERNAL_TABLE this F.M is to upload the excel format into internal table , The problem here is after uploading the excel file the format has been changed according to the F.M ... so Im not able to compare the value with my final internal table because the structure is different ... even if I could match with the values Im not able to  upload it to my application server ... is there any F.M which doesn't change the excel format and upload it to the internal table ? ... Or is there any other way of doing it other than using at new , case endcase. ? ...
    Thanks in advance ...
    Cheers

    Hi friend,
    Simply use GUI_UPLOAD function to get data from excel, txt etc.., into internal table in program.
    Try this program.. It performs downloading and uploading functions in both excel and .txt format.
    *& Report  ZAWI_DEMODOWNLOAD                                           *
    REPORT  zawi_demodownload                       .
    *Types
    TYPES: BEGIN OF g_r_mara,
           matnr LIKE mara-matnr,
           ersda LIKE mara-ersda,
           laeda LIKE mara-laeda,
           mtart LIKE mara-mtart,
           mbrsh LIKE mara-mbrsh,
           END OF g_r_mara.
    TYPES: BEGIN OF g_r_mara1,
           matnr TYPE string,
           ersda TYPE string,
           laeda TYPE string,
           mtart TYPE string,
           mbrsh TYPE string,
           END OF g_r_mara1.
    *Data
    DATA: g_t_mara TYPE TABLE OF g_r_mara,
          g_t_mara1 TYPE TABLE OF g_r_mara,
          g_t_mara2 TYPE TABLE OF g_r_mara1,
          filename TYPE string,
          f1 TYPE string,
          f2 TYPE string,
          x TYPE string,
          x1 TYPE string,
          x2 TYPE string,
          x3 TYPE strng,
          c TYPE string,
          g_r_wa TYPE g_r_mara,
          g_r_wa1 TYPE g_r_mara1,
          g_r_wa2 TYPE g_r_mara1,
         g_t_mara2 TYPE TABLE OF g_r_mara1,
          str TYPE string.
    *Tables
    TABLES: mara.
    *Selection Screen
    SELECT-OPTIONS: s_matnr FOR mara-matnr.
    SELECTION-SCREEN BEGIN OF LINE.
    SELECTION-SCREEN COMMENT 10(20) text-001 FOR FIELD p1.
    PARAMETERS:p1 RADIOBUTTON GROUP g1.
    SELECTION-SCREEN END OF LINE.
    SELECTION-SCREEN BEGIN OF LINE.
    SELECTION-SCREEN COMMENT 10(20) text-002 FOR FIELD p2.
    PARAMETERS p2 RADIOBUTTON GROUP g1.
    SELECTION-SCREEN END OF LINE.
    *Input validation.
    DATA: s_high TYPE mara-matnr,
          s_low TYPE mara-matnr.
    AT SELECTION-SCREEN ON s_matnr.
      IF NOT s_matnr-high IS INITIAL.
        s_high = s_matnr-high.
        SELECT SINGLE * FROM mara WHERE matnr = s_high.
        IF sy-subrc <> 0.
         IF NOT s_matnr-low IS INITIAL.
          s_low = s_matnr-low.
          SELECT SINGLE * FROM mara WHERE matnr = s_low.
          IF sy-subrc <> 0.
            MESSAGE e012(zawi_demo).
          ELSE.
            MESSAGE e011(zawi_demo).
          ENDIF.
        ENDIF.
      ENDIF.
    AT SELECTION-SCREEN.
      SELECT SINGLE * FROM mara WHERE matnr IN s_matnr.
      IF sy-subrc <> 0.
        IF s_matnr-low IS INITIAL.
          str = s_matnr-high.
        ELSE.
          str = s_matnr-low.
        ENDIF.
        MESSAGE e010(zawi_demo) WITH str..
      ENDIF.
    START-OF-SELECTION.
    *Data retrival
      SELECT matnr ersda laeda mtart mbrsh
        INTO  CORRESPONDING FIELDS OF TABLE g_t_mara
        FROM mara
        WHERE matnr IN s_matnr.
      IF p1 = 'X'.
        filename = 'C:\Testing.xls'.
       Downloading data from internal table to excel or txt
        f1 = filename.
        CALL FUNCTION 'GUI_DOWNLOAD'
          EXPORTING
            filename              = filename
            filetype              = 'ASC'
         append                = 'X'
            write_field_separator = 'X'
         col_select = 'X'
          TABLES
            data_tab              = g_t_mara.
      ELSE.
        filename = 'C:\Testing.txt'.
        f2 = filename.
        LOOP AT g_t_mara INTO g_r_wa.
          CONCATENATE g_r_wa-matnr ';'  INTO g_r_wa1-matnr.
          CONCATENATE g_r_wa-ersda ';'  INTO g_r_wa1-ersda.
          CONCATENATE g_r_wa-laeda ';'  INTO g_r_wa1-laeda.
          CONCATENATE g_r_wa-mtart ';'  INTO g_r_wa1-mtart.
          CONCATENATE g_r_wa-mbrsh ';'  INTO g_r_wa1-mbrsh.
          APPEND g_r_wa1 TO g_t_mara2.
        ENDLOOP.
        CALL FUNCTION 'GUI_DOWNLOAD'
          EXPORTING
            filename              = filename
            filetype              = 'ASC'
         append                = 'X'
         write_field_separator = 'X'
         col_select = 'X'
          TABLES
            data_tab              = g_t_mara2.
      ENDIF.
       Uploading data from excel to internal table 1
      IF filename = f1.
        CALL FUNCTION 'GUI_UPLOAD'
          EXPORTING
            filename            = filename
            filetype            = 'ASC'
            has_field_separator = 'X'
          TABLES
            data_tab            = g_t_mara1.
        WRITE: / 'Uploaded data' COLOR = 1.
        WRITE:/.
        CLEAR g_r_wa.
        LOOP AT g_t_mara1 INTO g_r_wa.
          WRITE:/ g_r_wa-matnr, g_r_wa-ersda, g_r_wa-laeda, g_r_wa-mtart, g_r_wa-mbrsh.
        ENDLOOP.
      ELSE.
        IF filename = f2.
                           IF sy-subrc <> 0.
                           ENDIF.
          CALL FUNCTION 'GUI_UPLOAD'
            EXPORTING
              filename            = filename
              filetype            = 'ASC'
              has_field_separator = 'X'
              replacement         = ''
            TABLES
              data_tab            = g_t_mara2.
          WRITE: / 'Uploaded data' COLOR = 1.
          WRITE:/.
          CLEAR g_r_wa1.
          LOOP AT g_t_mara2 INTO g_r_wa1.
            g_r_wa2-matnr = g_r_wa1-matnr.
            TRANSLATE g_r_wa2-matnr USING '; ' .
            WRITE:/ g_r_wa2-matnr, g_r_wa2-ersda, g_r_wa2-laeda, g_r_wa2-mtart, g_r_wa2-mbrsh.
            CLEAR g_r_wa2.
          ENDLOOP.
        ENDIF.
      ENDIF.
                                                                                    OR
    Use T-codes:
    CG3Y - Download file               - Download file from Application server
    CG3Z - Upload file                    - Upload file to Application server

Maybe you are looking for

  • Why does microsoft 2011 keep on crashing on macair

    Hello, Microsoft 2011 suddenly started crashing on macair. I have OS X 10.8.5, havent upgraded Mavericks. Do you think that might help! Please HELP!!

  • Using constructor

    i want to know how to use constructors to send variables from one class(in file)to another class(in another file) please i want code example for that

  • How do I read from a file and store the information in an array?

    Here is my problem: I am going to have to use a bufferedReader to read a file containing information on 10 vehicles. And after I read that file I want to store the info in Vehicle [] V. Where should I start? Thanks Steve

  • Risk Analysis for 2 open request in CUP

    Hi Team, If in CUP i have 2 open request by same user which individually may not give any Risk but collectively may have some risk assosiated with it how do i address this real time. (I iunderstand that this risks can be discovered in RAR but i want

  • RAC + Data Guard setup

    In high-level terms, if you are running a 2-node RAC and get asked to create a 2-node disaster recovery site, how would I go about doing that? (The cluster in the disaster recovery site has already been created and the Oracle 11.2.0.1 software instal