How to upload the data from two sheets in one excel into SAP

Hi experts,
                My requirement is to upload the data from two sheets in an excel into an internal table.How can this be achieved.Is some OLE application has to be used?
Thanks
Abhishek

Hi
see this program will upload excel file to application.
*& Report  ZSD_EXCEL2
REPORT  ZSD_EXCEL2.
types: begin of ttab ,
      fld1(30) type c,
      fld2(30) type c,
      fld3(30) type c,
      fld4(30) type c,
      fld5(30) type c,
      end of ttab.
data: itab type table of ttab with header line.
selection-screen skip 1.
parameters: p_file type localfile default
            'C:\test.xls'.
selection-screen skip 1.
at selection-screen on value-request for p_file.
  call function 'KD_GET_FILENAME_ON_F4'
       exporting
            static    = 'X'
       changing
            file_name = p_file.
start-of-selection.
  clear itab. refresh itab.
  perform upload_data.
  loop at itab.
    write:/ itab-fld1, itab-fld2, itab-fld3, itab-fld4, itab-fld5.
  endloop.
* Upload_Data
form upload_data.
  data: file type  rlgrap-filename.
  data: xcel type table of alsmex_tabline with header line.
  file = p_file.
  call function 'ALSM_EXCEL_TO_INTERNAL_TABLE'
       exporting
            filename                = file
            i_begin_col             = '1'
            i_begin_row             = '1'
            i_end_col               = '200'
            i_end_row               = '5000'
       tables
            intern                  = xcel
       exceptions
            inconsistent_parameters = 1
            upload_ole              = 2
            others                  = 3.
  loop at xcel.
    case xcel-col.
      when '0001'.
        itab-fld1 = xcel-value.
      when '0002'.
        itab-fld2 = xcel-value.
      when '0003'.
        itab-fld3 = xcel-value.
      when '0004'.
        itab-fld4 = xcel-value.
      when '0005'.
        itab-fld5 = xcel-value.
    endcase.
    at end of row.
      append itab.
      clear itab.
    endat.
  endloop.
endform.

Similar Messages

  • How to upload the data from excel(3 tabs) file to sap environment

    Hi all,
    This is Mahesh.
    how to upload the data from excel(3 tabs) file to sap environment (internal tables) while doing bdc.

    Hi,
    The FM 'ALSM_EXCEL_TO_INTERNAL_TABLE' makes it possible to load a worksheet into an internal table in ABAP.
    However, if you want to get the data from several worksheets, I think you are stuck with OLE access to your Excel Workbook...
    You can find a solution for 2 worksheets in this post :
    TO UPLOAD DATA FROM 2 EXCEL SHEETS INTO TWO INTERNAL TABLES
    I think you can easily modify it to handle any number of worksheets.
    Hope it helps !
    Best regards,
    Guillaume

  • How to get the data from multiple nodes to one table

    Hi All,
    How to get the data from multiple nodes to one table.examples nodes are like  A B C D E relation also maintained
    Regards,
    Indra

    HI Indra,
    From Node A, get the values of the attributes as
    lo_NodeA->GET_STATIC_ATTRIBUTES(  IMPORTING STATIC_ATTRIBUTES = ls_attributesA  ).
    Similarily get all the node values from B, C, D and E.
    Finally append all your ls records to the table.
    Hope you are clear.
    BR,
    RAM.

  • How to extract the data from module pool program to Excel Sheet?

    Hi Guys
            I am having a requirement to transfer the data from Module pool screen to excel sheet directly.
            This is an urgent requirement.
            So plz reply me with some coding examples.
            I will give points for that.

    This report extract excel file. From that concept you can easily extract data from module pool program also by coding in PAI of the screen.
    REPORT ztest1 .
    * this report demonstrates how to send some ABAP data to an
    * EXCEL sheet using OLE automation.
    include ole2incl.
    * handles for OLE objects
    data: h_excel type ole2_object,        " Excel object
          h_mapl type ole2_object,         " list of workbooks
          h_map type ole2_object,          " workbook
          h_zl type ole2_object,           " cell
          h_f type ole2_object,            " font
          h_c type ole2_object.            " color
    DATA: FILENAME LIKE RLGRAP-FILENAME.
    tables: spfli.
    data  h type i.
    * table of flights
    data: it_spfli like spfli occurs 10 with header line.
    *&   Event START-OF-SELECTION
    start-of-selection.
    * read flights
      select * from spfli into table it_spfli.
    * display header
      uline (61).
      write: /     sy-vline no-gap,
              (3)  'Flg'(001) color col_heading no-gap, sy-vline no-gap,
              (4)  'Nr'(002) color col_heading no-gap, sy-vline no-gap,
              (20) 'Von'(003) color col_heading no-gap, sy-vline no-gap,
              (20) 'Nach'(004) color col_heading no-gap, sy-vline no-gap,
              (8)  'Zeit'(005) color col_heading no-gap, sy-vline no-gap.
      uline /(61).
    * display flights
      loop at it_spfli.
        write: / sy-vline no-gap,
                 it_spfli-carrid color col_key no-gap, sy-vline no-gap,
                 it_spfli-connid color col_normal no-gap, sy-vline no-gap,
                 it_spfli-cityfrom color col_normal no-gap, sy-vline no-gap,
                 it_spfli-cityto color col_normal no-gap, sy-vline no-gap,
                 it_spfli-deptime color col_normal no-gap, sy-vline no-gap.
      endloop.
      uline /(61).
    * tell user what is going on
      call function 'SAPGUI_PROGRESS_INDICATOR'
         exporting
    *           PERCENTAGE = 0
               text       = text-007
           exceptions
                others     = 1.
    * start Excel
      create object h_excel 'EXCEL.APPLICATION'.
    *  PERFORM ERR_HDL.
      set property of h_excel  'Visible' = 1.
    *  CALL METHOD OF H_EXCEL 'FILESAVEAS' EXPORTING #1 = 'c:kis_excel.xls'
    *  PERFORM ERR_HDL.
    * tell user what is going on
      call function 'SAPGUI_PROGRESS_INDICATOR'
         exporting
    *           PERCENTAGE = 0
               text       = text-008
           exceptions
                others     = 1.
    * get list of workbooks, initially empty
      call method of h_excel 'Workbooks' = h_mapl.
      perform err_hdl.
    * add a new workbook
      call method of h_mapl 'Add' = h_map.
      perform err_hdl.
    * tell user what is going on
      call function 'SAPGUI_PROGRESS_INDICATOR'
         exporting
    *           PERCENTAGE = 0
               text       = text-009
           exceptions
                others     = 1.
    * output column headings to active Excel sheet
      perform fill_cell using 1 1 1 200 'Carrier id'(001).
      perform fill_cell using 1 2 1 200 'Connection id'(002).
      perform fill_cell using 1 3 1 200 'City from'(003).
      perform fill_cell using 1 4 1 200 'City to'(004).
      perform fill_cell using 1 5 1 200 'Dep. Time'(005).
      loop at it_spfli.
    * copy flights to active EXCEL sheet
        h = sy-tabix + 1.
        if it_spfli-carrid cs 'AA'.
          perform fill_cell using h 1 0 000255000 it_spfli-carrid.
        elseif it_spfli-carrid cs 'AZ'.
          perform fill_cell using h 1 0 168000000 it_spfli-carrid.
        elseif it_spfli-carrid cs 'JL'.
          perform fill_cell using h 1 0 168168000 it_spfli-carrid.
        elseif it_spfli-carrid cs 'LH'.
          perform fill_cell using h 1 0 111111111 it_spfli-carrid.
        elseif it_spfli-carrid cs 'SQ'.
          perform fill_cell using h 1 0 100100100 it_spfli-carrid.
        else.
          perform fill_cell using h 1 0 000145000 it_spfli-carrid.
        endif.
        if it_spfli-connid lt 400.
          perform fill_cell using h 2 0 255000255 it_spfli-connid.
        elseif it_spfli-connid lt 800.
          perform fill_cell using h 2 0 077099088 it_spfli-connid.
        else.
          perform fill_cell using h 2 0 246156138 it_spfli-connid.
        endif.
        if it_spfli-cityfrom cp 'S*'.
          perform fill_cell using h 3 0 155155155 it_spfli-cityfrom.
        elseif it_spfli-cityfrom cp 'N*'.
          perform fill_cell using h 3 0 189111222 it_spfli-cityfrom.
        else.
          perform fill_cell using h 3 0 111230222 it_spfli-cityfrom.
        endif.
        if it_spfli-cityto cp 'S*'.
          perform fill_cell using h 4 0 200200200 it_spfli-cityto.
        elseif it_spfli-cityto cp 'N*'.
          perform fill_cell using h 4 0 000111222 it_spfli-cityto.
        else.
          perform fill_cell using h 4 0 130230230 it_spfli-cityto.
        endif.
        if it_spfli-deptime lt '020000'.
          perform fill_cell using h 5 0 145145145 it_spfli-deptime.
        elseif it_spfli-deptime lt '120000' .
          perform fill_cell using h 5 0 015215205 it_spfli-deptime.
        elseif it_spfli-deptime lt '180000' .
          perform fill_cell using h 5 0 000215205 it_spfli-deptime.
        else.
          perform fill_cell using h 5 0 115115105 it_spfli-deptime.
        endif.
      endloop.
    * EXCEL FILENAME
      CONCATENATE SY-REPID '_' SY-DATUM+6(2) '_' SY-DATUM+4(2) '_'
                  SY-DATUM(4) '_' SY-UZEIT '.XLS' INTO FILENAME.
      CALL METHOD OF H_MAP 'SAVEAS' EXPORTING #1 = FILENAME.
      free object h_excel.
      perform err_hdl.
    *       FORM FILL_CELL                                                *
    *       sets cell at coordinates i,j to value val boldtype bold       *
    form fill_cell using i j bold col val.
      call method of h_excel 'Cells' = h_zl
        exporting
          #1 = i
          #2 = j.
      perform err_hdl.
      set property of h_zl 'Value' = val .
      perform err_hdl.
      get property of h_zl 'Font' = h_f.
      perform err_hdl.
      set property of h_f 'Bold' = bold .
      perform err_hdl.
      set property of h_f 'Color' = col.
      perform err_hdl.
    endform.                    "FILL_CELL
    *&      Form  ERR_HDL
    *       outputs OLE error if any                                       *
    *  -->  p1        text
    *  <--  p2        text
    form err_hdl.
      if sy-subrc <> 0.
        write: / 'OLE-Automation Error:'(010), sy-subrc.
        stop.
      endif.
    endform.                    " ERR_HDL

  • [webdynpro] How to get the data from database and store in Excel sheet

    Hi All-
    I am developing an application in Webdynpro and I need to provide a URL ( link ) which if clicked , need to collect the data from Database ( SQL Server ) and puts in an Excel Sheet corresponding fields and opens the sheet.....
    Please look into this issue and help me out......
    Regards,
    Cris

    Hi Cris,
    Add-on to wat santosh has pointed to:
    Exporting table data to MS-Excel Sheet(enhanced Web Dynpro Binary Cache)
    (Or) If you have implemented your logic to get Database records below Blog should guide you in opening an excel with ur records.
    Exporting table data to MS-Excel Sheet(enhanced Web Dynpro Binary Cache)
    Regards,
    N.

  • How to upload the data from existing ods to new cube?

    Hi all,
    There is an existing ods and reports are been created for that ods. My task is to create a cube and pull out the data from the ods to cube.
    I have created a cube with update rule. And i want to know to how to load all the data from the existing ods to the newly created cube.
    thanxs
    haritha

    Hi haritha,
    If you've already created the update-rules, try to create cube, than make a mapping between ODS & Cube.
    If done,
    1. Right-Click on ODS, find the menu update data to data target.
    2. Choose for Init.
    If you wanna make it update data to cube automatically, then you must setup the setting in ODS.
    1. double-click on it.
    2. In setting, you'll see the option for "automatically update data to data target".
    3. Choose for it.
    Hopefully it can help you a lot.
    Regards,
    Niel.
    thanks for any points you choose to assign.

  • How to create a form which has browse option ? Then how to upload the data from the excel file to table in Oracle DB?

    Hi Everyone,
    I am new to Oracle forms. I have a requirement where user wants a form which can be used to browse a excel file from his/her system. Also after browsing the file the user should be able to load the data from the file to a table in the Oracle DB.
    Any help pointers would be appreciated.
    Thanks,
    Satya
    Message was edited by: user12098633

    Hi Marcus,
    I am using EBS (E- Business Suite) ERP and version is 11.5.10.2
    My database version is as below
    Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
    PL/SQL Release 11.2.0.3.0 - Production
    CORE
    11.2.0.3.0
    Production
    TNS for IBM/AIX RISC System/6000: Version 11.2.0.3.0 - Production
    NLSRTL Version 11.2.0.3.0 - Production
    I want to move csv file via EBS only. Average size of this will be max 600-700 bytes.
    Program should be in pl/sql package or concurrent program or custom .fmb (d2k forms) or custom .rdf (d2k report) or through alert. I am not using samba.

  • How to upload the data from legacy system database to SAP data base

    Hi.
    We are doing analysis of Legacy system and which needs to be converted to SAP system i.e. SAP implementation.
    I just want to know , how we migrate the existing whole data( from legacy system) into SAP system.
    and which method is the best method to use data migration from legacy to SAP system if data legacy data amount is huge.
    Please suggest me.
    Thanks.

    Hi
    We can either use the BDC or BAPI or LSMW  or Direct Input techiniques for the data transfers.
    The combination of both Session and Call transaction can be used to achieve this that includes the error handling also. This invloves the screen interaction.
    These days, BAPIs are used to overvome some upgrade problems. For easy upgradation, we cna go for BAPIs. Here ther is no screen intercation.
    LSMW mainly used for master data transfers using some standrad programs.
    As per your client or company desicions  we can choose any of them.
    Please refer to these links for more understanding -
    BDC Vs LSMW -
    BDC VS LSMW
    BDC Vs BAPI -
    BDC VS LSMW
    Thanks & Regards,
    Chandralekha.

  • How to merge the data from two cubes into ODS?

    Hi,
    I wan to analyze the data of both the cubes by means of merging into an ODS.
    And i want to have one of the characteristic is used as a key for the purpose which is existing in both the cubes
    Cany nay one detail me of how this can be done?
    Thanks,
    Ravi

    Hi,
    If it is very needful.
    you can create the ODS object for each infocubes and map these ODS objects to target ODS object.
    or, you can create the Export datasources from each infocube and map these to new target ODS object which is having all the char and KF of both the infocubes.
    reg.
    Vis

  • How to upload the data from XML file to SAP database using IDOC

    Hi,
    I need some steps  to upload  data from XML format file from other directory to SAP database using IDOC.
    how to approch this please if any one knows give me ans
    it will be a great help ful to me
    Thanks in Advance
    Mallik

    Thank you vijay,
    But i heard that by using this Fun modules, when we are passing IDOC in back ground schedule,  so some other depended FM not supporting, so how to approach this and how to avoid this problem. 
    Have you worked on this before if any one worked on this please help me out
    And thank you once again for your valuable information
    Best Regards
    Mallik

  • How to populate the data to second sheet tab in excel

    Hai,
    I need to populate data to the second sheet tab of excel sheet .
    Below is the code wherein I added datas to first sheet of the excel sheet.Can anyone help me in this ?
    <%
    response.setHeader("Cache-Control","max-age=0"); // HTTP 1.1
    response.setHeader("Pragma","public"); // HTTP 1.0
    response.setDateHeader ("Expires", 0); // prevents caching at the proxy server
    response.setContentType("application/ms-excel;charset=UTF-8");
    response.setHeader("Content-Disposition","attachment;filename=Test.xls");
    %>
    <html xmlns:v="urn:schemas-microsoft-com:vml"
    xmlns:o="urn:schemas-microsoft-com:office:office"
    xmlns:x="urn:schemas-microsoft-com:office:excel"
    xmlns="http://www.w3.org/TR/REC-html40">
    <xml>     
    <x:ExcelWorkbook>
    <x:ExcelWorksheets>
    <x:ExcelWorksheet>
              <x:Name>Sheet-1</x:Name>
    <x:WorksheetOptions>
    </x:WorksheetOptions>
         </x:ExcelWorksheet>
         <x:ExcelWorksheet>
              <x:Name>Sheet-2</x:Name>
         <x:WorksheetOptions>
         </x:WorksheetOptions>
    </x:ExcelWorksheet>
    </x:ExcelWorksheets>
    <x:WindowHeight>9090</x:WindowHeight>
    <x:WindowWidth>15180</x:WindowWidth>
    <x:WindowTopX>120</x:WindowTopX>
    <x:WindowTopY>15</x:WindowTopY>
    <x:ProtectStructure>False</x:ProtectStructure>
    <x:ProtectWindows>False</x:ProtectWindows>
    </x:ExcelWorkbook>
    </xml>
    <body link=blue vlink=purple>
    <table x:str border=0 cellpadding=0 cellspacing=0 width=192 style='border-collapse:collapse;table-layout:fixed;width:144pt'>
    <tr height=17 style='height:12.75pt'>
    <td height=17 align=right >HELLO</td>
    <td align=right >HI</td>
    <td align=right >GOOD BYE</td>
    </tr>
    </table>
    </body>
    </html>

    Hi,
    It's been a while since I did this stuff so I apologise if my advice is out of date.
    This is actually more of a Micro$oft question as this is their propriety SpreadSheet Markup Language so POI probably won't help. Also, you might want to look at using the default namespace of "urn:schemas-microsoft-com:office:spreadsheet" as this is the more current implementation unless you need to be backward compatible.
    On your specific question, I think that you should be able to put the table tag (SSML not HTML) inside the worksheet and then create the rows and cells in there. I've never tried mixing the 2 markup languages though so I'm not sure how to get the HTML to go into the correct sheet.
    Sorry I couldn't help more :-(

  • How to migrate the data from on version to another version in SAP

    Hai,
         Now iam working in Upgradation and Data migration Project. Iam new to this Project. My problem is we have the data of one module in 4.7e and we want that module data into upgrade verion say ECC 6.0. But we didnt want to upgrade that module. Pls guide me in this.

    hi,
    Welcome to SCN.
    if you want data of specific module to be transported to different version then you can use BDC,LSMW or BAPI for the transactions of that module according to your requirement.
    Also if you search in SCN with migrate data to different version you will get lot of posts.

  • How to upload the file from website into R/3

    Dear Experts,
              I want to post the data in r/3 using bdc.but flat file is available in some website for eg.'www.sap.com'.how to retrieve the flat file from the website and how to upload the data from website to r/3.
    It is very urgent please help me.
    Thanks & Regards,
    Ashok.

    Hi Ashok,
        We cannot directly pulled data from website. we need to activate webservices and rfcs. Better you could asked to your Basis guy that he knows or not. If not then do sdn you will get the appropriate answer. I can only say that its possible and we can download from website.
    Regds,
    Rakesh

  • Uploading the data from excel to sap R/3

    Hi Guys,
         Actually i know how to upload the data from text file to sap.when ever i come to excel file while calling 'ALSM_EXCEL_TO_INTERNAL_TABLE' FM I AM NOT ABLE TO HANDLE THE PARAMETERS .
       How can we handle this thing.Plz give me the example code.
    Regards,
    Venkat.

    HI,
    Check this code..
    DATA l_count TYPE sy-tabix.
       CONSTANTS: lc_begin_col TYPE i VALUE '1',
                  lc_begin_row TYPE i VALUE '2',
                  lc_end_col   TYPE i VALUE '2',
                  lc_end_row   TYPE i VALUE '3000'.
    * Begin of CALK912848 - Carlos Werberich - 16Sep08
      CLEAR p_i_excel_data. REFRESH p_i_excel_data.
    * End   of CALK912848 - Carlos Werberich - 16Sep08
    * Function module to read excel file and convert it into internal table
       CALL FUNCTION 'KCD_EXCEL_OLE_TO_INT_CONVERT'
         EXPORTING
           filename                = p_p_file
           i_begin_col             = lc_begin_col
           i_begin_row             = lc_begin_row
           i_end_col               = lc_end_col
           i_end_row               = lc_end_row
         TABLES
           intern                  = i_data
         EXCEPTIONS
           inconsistent_parameters = 1
           upload_ole              = 2
           OTHERS                  = 3.
    * Error in file upload
       IF sy-subrc NE 0 .
         MESSAGE text-006 TYPE 'E'.
         EXIT.
       ENDIF.
       IF i_data[] IS INITIAL .
         MESSAGE text-007 TYPE 'E'.
         EXIT.
       ELSE.
         SORT i_data BY row col .
    * Loop to fill data in Internal Table
         LOOP AT i_data .
           MOVE i_data-col TO l_count .
           ASSIGN COMPONENT l_count OF STRUCTURE p_i_excel_data TO <fs_source> .
           MOVE i_data-value TO <fs_source> .
           AT END OF row .
    * Append data into internal table
             APPEND p_i_excel_data.
             CLEAR p_i_excel_data.
           ENDAT .
         ENDLOOP .
       ENDIF .

  • How to put the data from one excel sheet in another excel sheet

    hi ,
    I want put the data from one excel sheet in another excel sheet in seq. order Eg: I have one excel sheet in which i have 3 col. Name , Sno. , Email along with data .I want to put data from this sheet to another excel sheet in the following orders of col. Sno,Name, Email .
    While loading data in another sheet , i have to perform validation like char field should n't contain numeric values and vice versa .
    Let me know on this soon ..
    regards
    Prashant

    Well, you can issue separate queries with the ordering you need from each tab in the spreadhseet. You can open an ODBC connection from a VBA macro, select a sheet, run a query, select another sheet and run another query. As for the validation, you can do this in Oracle via stored procedures or again in VBA code.

Maybe you are looking for

  • Scan to PDF - F2210

    I am wanting to scan documents and save as a PDF, however I am not seeing pdf as a file type option in the save as file type dialog box.  The help says I am able to do this.  Hope someone can help. This question was solved. View Solution.

  • Printing CD artwork

    When I print the artwork for cd cover, my entire music library is listed as songs for the album.  It does it with every album.  How do I correct this?

  • Increased battery drainage in iphone 5 after ios 7 update.

    AM using iphone 5. i hav updated it to ios7. but after the update , the battery is draining 2 times faster than normal. Is it a problem with the battery. shall i go for replacement????

  • IPod Nano 7th gen Nike  Fuelband SE support?

    Does anybody know if the Nike+ app on my iPod Nano 7 support the new Nike+ Fuelband SE?

  • Normalaization.

    Hi experts,   if i am going to create a table how to do normalaization in abap tables. wht are the steps for tht.. thanks, Gowri