How to Loop the Import of Excel Worksheets

The following code goes to SharePoint, downloads a worksheet from the SharePoint, copies the worksheet to an existing workbook, then renames the downloaded worksheet.
Public Sub ImportFileName()
   ' Define Workbook and Worksheet Variables
   Dim wkbMyWorkbook As Workbook
   Dim wkbWebWorkbook As Workbook
   Dim wksWebWorkSheet As Worksheet
   Set wkbMyWorkbook = ActiveWorkbook
   ' Open The Web Workbook
   Workbooks.Open (webaddress_filename_ext)
   ' Set the Web Workbook and Worksheet Variables
   Set wkbWebWorkbook = ActiveWorkbook
   Set wksWebWorkSheet = ActiveSheet
   ' Copy The Web Worksheet, delete if already exists in this Workbook the Insert and ename
   wksWebWorkSheet.Copy after:=wkbMyWorkbook.Sheets(Sheets.Count)
   wkbMyWorkbook.Activate
   Call DeleteFileName
   wkbMyWorkbook.Sheets(ActiveSheet.Name).Name = "NewWorksheetsName"
   ' Close the Web Workbook
   wkbMyWorkbook.Activate
   wkbWebWorkbook.Close False
End Sub
I use "Call ImportFileName" to run the code.  Because I have several SharePoints to import the data from, I many repeats of the above code (I just change the FileName and webaddress).
I would like to revise the above code to loop, so that I don't have to have so many "Public Sub ImportFileName()" and "Call ImportFileName" scripts.
Thank you for any assistance you are able to provide.
Rich

Hi Rich,
I assume that you know all of the web addresses and file names so create a list of the web addresses and files in a worksheet in the same workbook that contains the code. The example code below assumes column A of Sheet3. (The list starts from row 2
because assumes a column header above the list.)
Then in the sub that calls the code to open and copy loops through the list and calls the sub to process. It passes the filename to the called sub as a parameter.
Your code calls a delete sub that you did not include but as per the comments in the example you can pass the filename to the Delete code also. Note my comments on whether this is the correct code to delete a file on the web.
Sub CommenceImport()
    Dim rngFiles As Range
    Dim rngCel As Range
    With Worksheets("Sheet3")    
'Edit "Sheet3" to the sheet name that you use for the list
        Set rngFiles = .Range(.Cells(2, "A"), .Cells(.Rows.Count, "A").End(xlUp))   
'Assumes list in in column A
    End With
    For Each rngCel In rngFiles
        Call ImportFileName(rngCel.Value)   'Call the sub pass the FileName as a parameter
    Next
End Sub
Public Sub ImportFileName(strFile As String)   
'Sub name contains a parameter
   ' Define Workbook and Worksheet Variables
   Dim wkbMyWorkbook As Workbook
   Dim wkbWebWorkbook As Workbook
   Dim wksWebWorkSheet As Worksheet
   Set wkbMyWorkbook = ActiveWorkbook
   ' Open The Web Workbook
   'Workbooks.Open (webaddress_filename_ext)   
'Replace this line with following line
   Workbooks.Open (strFile)
   ' Set the Web Workbook and Worksheet Variables
   Set wkbWebWorkbook = ActiveWorkbook
   Set wksWebWorkSheet = ActiveSheet
   ' Copy The Web Worksheet, delete if already exists in this Workbook the Insert and ename
   wksWebWorkSheet.Copy after:=wkbMyWorkbook.Sheets(Sheets.Count)
   wkbMyWorkbook.Activate
   'I assume it is the file on web to be deleted
   'if so then you can pass the file name to Sub DeleteFileName
   Call DeleteFileName(strFile)     
'Pass the FileName to the Delete sub
   'Call DeleteFileName
   wkbMyWorkbook.Sheets(ActiveSheet.Name).Name = "NewWorksheetsName"
   ' Close the Web Workbook
   wkbMyWorkbook.Activate
   wkbWebWorkbook.Close False
End Sub
Sub DeleteFileName(strFileToDelete As String)    
'Sub includes a parameter to accept the file name
    'Example only. May not be correct to delete a file on the web.
    Kill strFileToDelete
End Sub
Regards, OssieMac

Similar Messages

  • How to load the data from excel file into temprory table in Forms 11g?

    Hi
    How to Load the data from excel file(Extension is .CSV) into the temporary table of oracle in Forms11g.
    My Forms Version is - Forms [64 Bit] Version 11.1.2.0.0 (Production)
    Kindly Suggest the Solution.
    Regards,
    Sachin

    Declare
        v_full_filename         varchar2(500);
        v_server_path           varchar2(2000);
        v_separator             VARCHAR2(1);
        v_filename              VARCHAR2(400);
        filename                VARCHAR2 (100);
        v_stop_load             varchar2 (2000);
        v_rec_error_log         varchar2(4000);
        v_error_log             varchar2(4000);
        ctr                     NUMBER (12);
        cols                    NUMBER (2);
        btn                     number;
        RES                     BOOLEAN;   
        application             ole2.obj_type;
        workbooks               ole2.obj_type;
        workbook                ole2.obj_type;
        worksheets              ole2.obj_type;
        worksheet               ole2.obj_type;
        cell                    ole2.obj_type;
        cellType                ole2.OBJ_TYPE;
        args                    ole2.obj_type;
        PROCEDURE olearg
        IS
        args   ole2.obj_type;
        BEGIN
        args := ole2.create_arglist;
        ole2.add_arg (args, ctr);                                
        ole2.add_arg (args, cols);                                   
        cell := ole2.get_obj_property (worksheet, 'Cells', args);
        ole2.destroy_arglist (args);
        END;
    BEGIN
    v_full_filename := client_get_file_name(directory_name => null
                                     ,file_name      => null
                                     ,file_filter    => 'Excel  files (*.xls)|*.xls|'  
                                                                            ||'Excel  files (*.xlsx)|*.xlsx|'                                                                 
                                     ,message        => 'Choose Excel file'
                                     ,dialog_type    => null
                                     ,select_file    => null
    If v_full_filename is not null Then
    v_separator := WEBUTIL_CLIENTINFO.Get_file_Separator ;
    v_filename := v_separator||v_full_filename ;
    :LOAD_FILE_NAME := substr(v_filename,instr(v_filename,v_separator,-1) + 1);                                
    RES := Webutil_File_Transfer.Client_To_AS(v_full_filename,"server_path"||substr(v_filename,instr(v_filename,v_separator,-1) + 1));     
    --Begin load data from EXCEL
    BEGIN
        filename := v_server_path||substr(v_filename,instr(v_filename,v_separator,-1) + 1); -- to pick the file
        application := ole2.create_obj ('Excel.Application');
        ole2.set_property (application, 'Visible', 'false');
        workbooks := ole2.get_obj_property (application, 'Workbooks');
        args := ole2.create_arglist;
        ole2.add_arg (args, filename); -- file path and name
        workbook := ole2.get_obj_property(workbooks,'Open',args);
        ole2.destroy_arglist (args);
        args := ole2.create_arglist;
        ole2.add_arg (args, 'Sheet1');
        worksheet := ole2.get_obj_property (workbook, 'Worksheets', args);
        ole2.destroy_arglist (args);
        ctr := 2;                                                     --row number
        cols := 1;                                                -- column number
        go_block('xxx');
        FIRST_RECORD;  
        LOOP       
                --Column 1 VALUE --------------------------------------------------------------------
            olearg;
            v_stop_load := ole2.get_char_property (cell, 'Text'); --cell value of the argument
            :item1 := v_stop_load;
            cols := cols + 1;                                                      
              --Column 2 VALUE --------------------------------------------------------------------
            olearg;
            :item2 := ole2.get_char_property (cell, 'Text'); --cell value of the argument
            cols := cols + 1;
            --<and so on>
        ole2.invoke (application, 'Quit');
        ole2.RELEASE_OBJ (cell);
        ole2.RELEASE_OBJ (worksheet);
        ole2.RELEASE_OBJ (worksheets);
        ole2.RELEASE_OBJ (workbook);
        ole2.RELEASE_OBJ (workbooks);
        ole2.RELEASE_OBJ (application);
    END;
    --End load data from EXCELPlease mark it as answered if you helped.

  • 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 read the data in excel sheet

    Dear sir,
    How to read the data in excel sheet when i recieve a data serial communication... ie i have store a data in excel such that
    Cell A       Cell B
       A           Apple 
       B           Ball
       C           Cat
       D           Doll
    when i recieve A from serial communication i have to display Apple, and when i recieve B i have to display Ball and so on.. 

    Hi, 
    I would recommend you to have a look at the VI attached. It makes use of a VI named 'Read from Spreadsheet' to read the row and column data from the tab delimited excel file. The read data is then searched for the Alphabet specified and finally returns you the corresponding string. The test file used to validate the operation of the VI is also attached. 
    Trust this would help you solve the issue. 
    Regards, 
    Sagar G Yadav | Application Engineer | National Instruments
    Attachments:
    read_from_excel.vi ‏10 KB
    Book1.txt ‏1 KB

  • How to read the data from Excel file and Store in XML file using java

    Hi All,
    I got a problem with Excel file.
    My problem is how to read the data from Excel file and Store in XML file using java excel api.
    For getting the data from Excel file what are all the steps i need to follow to get the correct result.
    Any body can send me the code (with java code ,Excel sheet) to this mail id : [email protected]
    Thanks & Regards,
    Sreenu,
    [email protected],
    india,

    If you want someone to do your work, please have the courtesy to provide payment.
    http://www.rentacoder.com

  • How to Load the data from excel file(Extension is .CSV) into the temp.table

    Hi
    How to Load the data from excel file(Extension is .CSV) into the temporary table of oracle in Forms11g.
    My Forms Version is - Forms [64 Bit] Version 11.1.2.0.0 (Production)
    Kindly Suggest the Solution.
    Regards,
    Sachin

    Hello Sachin,
    You can use the following metalink note:How to Read Data from an EXCEL Spreadsheet into a Form Using Webutil Client_OLE2 (Doc ID 813535.1) and modify it a little bit.
    Instead of copy values into forms you can save them in your temporary table.
    Kind regards,
    Alex
    If someone's helpful or correct please mark it accordingly.

  • How  to load the data from excel  file  into table in oracle using UTL_FI

    How to load the data from excel file into table in oracle
    and from table to excel file
    using UTL_FILE package
    Please give me some example

    This is something i tried in oracle apex
    http://avdeo.com/2008/05/21/uploading-excel-sheet-using-oracle-application-express-apex/
    Regards,
    CKLP

  • How to Display the content of Excel file into Webdynpro Table

    Hi Experts
    I am following the Blog to upload a file in to the webdynpro context,but my problem is after uploading a excel file i need to extract the content from that Excel file and that content should be displayed in the webdynpro table.Can any body please guide me how to read the content from excel and to Display in the Table.
    Thanks and Regards
    Kalyan

    HI,
    Take for example, if Excel file contains 4 fields,
    Add jxl.jar to JavaBuild path and Use this snippet
    File f=new File("sample.xls");
    Workbook w=Workbook.getWorkbook(f);
    Sheet sh=w.getSheet(0);
    int cols=sh.getColumns();
    int rows=sh.getRows();
    Cell c=null;
    String s1=null;
    String s2=null;
    String s3=null;
    String s4=null;
    ArrayList al=new ArrayList();
    int j=0;
    for(int i=1;i<rows;i++)
    ITableElement table=wdContext.createTableElementz
         s1=sh.getCell(0,i).getContents();
         s2=sh.getCell(1,i).getContents();
         s3=sh.getCell(2,i).getContents();
         s4=sh.getCell(3,i).getContents();
                             table.setName(s1);
         table.setAddress(s2);
         table.setDesignation(s3);
         table.setDummy(s4);
         al.add(j,table);
         j++;                    
    wdContext.nodeTable().bind(al);
    Regards
    LakshmiNarayana

  • How to organize the import statements in FXML Files?

    Hello,
    I'm a user of NetBeans IDE and it can organize the import statements in *.java files. Now, I'm using JavaFX and editing the *.fxml files as well. I want to know how to organize the import statements in *.fxml files?
    Thanks a lot.

    You should use Scene Builder, it will make all these import statements for you.
    Moreover, it will greatly simplify the writing of your FXML files, since you only have to Drag&Drop JavaFX objects on the scene. Then, it automatically generates FXML files.

  • How to download the values to excel from spool sap abap

    Dear All,
    I am facing  a problem in downloading the Zreport to excel file ( where it consists of 95 fields) ,
    1.if am running the report in foreground and downlaod to excel file , the all 95 fields are upadting in excel file .
    2.if i am schecduling the programe in background and saving inspool, then form spool , i am download to excel file , at that time some of the fields are overllapning ,
    for this i want to download t o excel file without overlapping fields,
    can any one suggest , how to do same procedue.
    regards,
    manoranjan

    Hi,
    whenever you click on Excel download option select spreadsheet instead of unconverted
    There is a possibility of download the spool file as txt-file. .
    Use Tranx SP01 - select the spool entry -->"spool request --> forward as text . You will find the file in your SAP work directory as <sid><spool#>.
    or use fm RSPO_DOWNLOAD_SPOOLJOB.
      Download in Background in Excel Format
    How to download the data in excel format directly while executing in background mode? 
    If you will execute it in bacground with ws_download or download, it will be aoutomatically cancel. so what is the procedure to do this.  How is can directly read the spool from program?
    Download from background is possible, if you could setup the environment
    1. create a custom table first
        Table  : Y001
        Displayed fields:   4 of   4  Fixed columns:
           MANDT BNAME       Y_SITE    Y_PATH
           010      <userid>     <site>      cd <novell_path>
    2. rewrite ws_download to z_download (light modification required, see attachment)
    3. ask your basis team to make a copy of command FTP and CHMOD to ZFTP and ZCHMOD resp., make the setting according to your environment.
    Moderator message - Please respect the 5,000 character maximum when posting. Post only the relevant portions of code
    Hope this will will helps you,
    Thanks and Regards,
    Manjunath M
    Edited by: manjunath4sap on Dec 23, 2010 6:20 PM
    Edited by: Rob Burbank on Dec 23, 2010 9:02 PM

  • STMS: how to hide the Import All Requests button in the import queue view?

    Hi All,
    I'd like to know how to hide the "Import all requests" button in the import queue view.
    Thanks a lot for your answers.
    G.

    Hi,
    about hiding i have a doubt but u can inactivate by following procedure,
    As referred in a thread:
    On the domain controller, in STMS>overview>systems>(double click the one you want to change)>Select Transport Tool tab and click on change. Add Import_single_only value 1, import_single_strategy value 1 and no_import_all value 1. Save distribute and activate.
    or
    Refer to OSS NOTE 194000.
    Thanks & regards.

  • How usnig manuplate the Import and export Key word.

    How usnig manuplate the Import and export Key word? and
    how do the clear of those variable?

    HI ,
    For IMPORT Keyword :---
    To retrieve data from the global memory area, use the IMPORT statement.  The most basic form of the IMPORT statement is:
    IMPORT <variable> FROM MEMORY.
    To give the variable a different name in your program from what it is called in the global memory area, use the TO clause.  You must define the local variable name with a DATA statement in your program.  The format is:
    IMPORT <global var> TO <program var> FROM MEMORY.
    As with the EXPORT statement, you can specify multiple variables per statement, and you have the option of specifying which cluster ID you wish to import from.
    After each IMPORT statement, SY-SUBRC is set to indicate whether or not the cluster ID you specified exists (but not whether specific variables were imported specifically).  SY-SUBRC is zero if the cluster exists.
    It is also possible to IMPORT and EXPORT to database tables .
    ABAP memory that is used to store exported data is user and transaction specific, so when passing data between programs in this manner you must make sure that transaction boundaries are not crossed. Otherwise the contents of this memory will get destroyed and will not be available to the importing program.
    For Export Keyword :---
    The EXPORT statement moves data from your program into a global memory area.  The most basic form of the EXPORT statement is:
    EXPORT <variable> TO MEMORY.
    This places the specified variable into a global memory area that another program can later read using the IMPORT statement.
    You may specify multiple fields in the same EXPORT statement.  For example:
    EXPORT KNA1-KUNNR KNA1-BUKRS TO MEMORY.
    You can give variables a different name in the global memory area using the FROM clause.  For example, the following code exports SY-SUBRC and gives it the name RETVAL in the global memory area:
    EXPORT RETVAL FROM SY-SUBRC TO MEMORY.
    You can specify a cluster ID when exporting data to memory.  You can freely choose the name of the cluster ID, which can be up to 32 characters long.  Each cluster ID specifies a particular area in memory.  Each time you EXPORT data to the same cluster ID, all data previously written to that ID is erased.  For example:
    EXPORT SY-SUBRC TO MEMORY ID u2018LJS1u2019.
    Hope u understand
    Thanks
    Shambhu

  • How to export the data to excel in OAF Page - Urgent

    Hi All,
    I have a developed a page wich dispaly the records based on some condition.
    The Page has two regions.
    1.RowLayout Region
    2.Table Region
    Both the regions are getting the data from two diffrent VOs.
    In this case how to export the data to excel as the export button will not work if the page uses more than one VO(I think).
    Please help me.
    Thanks,
    Srinivas
    Edited by: SrinivasChanda on Oct 7, 2009 10:07 AM

    Hi Gaurav,
    Yes you are rite.When i tried exporting the data(which is coming from two different VOs altogether),i got only one region's data and then got error.
    Please note: Two regions(RowLayout,Table) are getting data from two different VOs
    below is one of the region(row layout) data:
    Hierarchy     Learning Certification Status     Learning Certification     Supervisor
    Direct Reports     Passed Only     All     Michael Swinnerton
    below is the error:               
    <div CLASS="errorText">               
    <html lang="en-US">               
    <head>               
    <script>               
    function ignoreWarnAboutChanges(url)               
    document.location.href = url;               
    </script>                
    <title>Error Page</title>               
    <link rel="stylesheet" charset="UTF-8" type="text/css" href="/OA_HTML/cabo/styles/blaf.css">               
    <META name="fwk-error" content="Error occured while processing the request">               
    <META name="fwk-error-detail" content="oracle.apps.fnd.framework.OAException: Application: FND     Message Name: FND_GENERIC_MESSAGE. Tokens: MESSAGE = java.io.IOException: Stream closed;           
    "     at oracle.apps.fnd.framework.OAException.wrapperException(OAException.java:891)"               
    "     at oracle.apps.fnd.framework.OAException.wrapperException(OAException.java:865)"               
    "     at OAErrorPage.jspService(OAErrorPage.jsp:34)"               
    "     at com.orionserver.http.OrionHttpJspPage.service(OrionHttpJspPage.java:56)"               
    "     at oracle.jsp.runtimev2.JspPageTable.service(JspPageTable.java:317)"               
    "     at oracle.jsp.runtimev2.JspServlet.internalService(JspServlet.java:465)"               
    "     at oracle.jsp.runtimev2.JspServlet.service(JspServlet.java:379)"               
    "     at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)"               
    "     at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:727)"               
    "     at com.evermind.server.http.ServletRequestDispatcher.include(ServletRequestDispatcher.java:119)"               
    "     at com.evermind.server.http.EvermindPageContext.handlePageThrowable(EvermindPageContext.java:547)"               
    "     at com.evermind.server.http.EvermindPageContext.handlePageException(EvermindPageContext.java:518)"               
    "     at OAExport.jspService(OAExport.jsp:122)"               
    "     at com.orionserver.http.OrionHttpJspPage.service(OrionHttpJspPage.java:56)"               
    "     at oracle.jsp.runtimev2.JspPageTable.service(JspPageTable.java:317)"               
    "     at oracle.jsp.runtimev2.JspServlet.internalService(JspServlet.java:465)"               
    "     at oracle.jsp.runtimev2.JspServlet.service(JspServlet.java:379)"               
    "     at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)"               
    "     at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:727)"               
    "     at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:306)"               
    "     at com.evermind.server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:767)"               
    "     at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:259)"               
    "     at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:106)"               
    "     at EDU.oswego.cs.dl.util.concurrent.PooledExecutor$Worker.run(PooledExecutor.java:803)"               
    "     at java.lang.Thread.run(Thread.java:534)"               
    ## Detail 0 ##               
    java.io.IOException: Stream closed               
    "     at java.io.BufferedWriter.ensureOpen(BufferedWriter.java:98)"               
    "     at java.io.BufferedWriter.write(BufferedWriter.java:197)"               
    "     at OAExport.jspService(OAExport.jsp:107)"               
    "     at com.orionserver.http.OrionHttpJspPage.service(OrionHttpJspPage.java:56)"               
    "     at oracle.jsp.runtimev2.JspPageTable.service(JspPageTable.java:317)"               
    "     at oracle.jsp.runtimev2.JspServlet.internalService(JspServlet.java:465)"               
    "     at oracle.jsp.runtimev2.JspServlet.service(JspServlet.java:379)"               
    "     at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)"               
    "     at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:727)"               
    "     at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:306)"               
    "     at com.evermind.server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:767)"               
    "     at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:259)"               
    "     at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:106)"               
    "     at EDU.oswego.cs.dl.util.concurrent.PooledExecutor$Worker.run(PooledExecutor.java:803)"               
    "     at java.lang.Thread.run(Thread.java:534)"               
    java.io.IOException: Stream closed               
    "     at java.io.BufferedWriter.ensureOpen(BufferedWriter.java:98)"               
    "     at java.io.BufferedWriter.write(BufferedWriter.java:197)"               
    "     at OAExport.jspService(OAExport.jsp:107)"               
    "     at com.orionserver.http.OrionHttpJspPage.service(OrionHttpJspPage.java:56)"               
    "     at oracle.jsp.runtimev2.JspPageTable.service(JspPageTable.java:317)"               
    "     at oracle.jsp.runtimev2.JspServlet.internalService(JspServlet.java:465)"               
    "     at oracle.jsp.runtimev2.JspServlet.service(JspServlet.java:379)"               
    "     at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)"               
    "     at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:727)"               
    "     at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:306)"               
    "     at com.evermind.server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:767)"               
    "     at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:259)"               
    "     at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:106)"               
    "     at EDU.oswego.cs.dl.util.concurrent.PooledExecutor$Worker.run(PooledExecutor.java:803)"               
    "     at java.lang.Thread.run(Thread.java:534)"               
    ">
    </head>
    <body>
    <table width=100%"" border=""0"" cellspacing=""0"" cellpadding=""0"">"               
    <tr> <td><img src="/OA_MEDIA/FNDSSCORP.gif" alt=""> </td></tr>               
    <tr> <td> </td>                
    <td> <a href= /OA_HTML/OALogout.jsp>Logout </a></td>                
    </tr>               
    <tr> <td width="100%" nowrap class="OraBGColorDark" >  </td> </tr>               
    </table>               
    <p>               
    <center>               
    <table width="95%" border="0" cellspacing="0" class="OraBGAccentDark" cellpadding="0">               
    <tr> <td>   </td> </tr>               
    <!-- <tr> <td class="OraErrorHeader"> <img src=/OA_HTML/cabo/images/errorl.gif> Error Page </td> </tr> -->               
    <tr> <td class="OraErrorHeader"> <center> Error Page </center> </td> </tr>               
    <tr> <td colspan=2 class="OraBGColorDark"> </td> </tr>               
    <tr> <td>   </td> </tr>                
    <tr> <td colspan=2 class="OraErrorText" >You have encountered an unexpected error. Please               
    contact the System Administrator for assistance. </td> </tr>                
    <tr> <td colspan=2 class="OraErrorText"> Click <a href=javascript:ignoreWarnAboutChanges("/OA_HTML/OAErrorDetailPage.jsp")> here </a> for exception details.                
    </td> </tr>               
    </table>               
    </center>               
    </div>               
    </body>               
    </html>
    Please help me to solve this issue.
    Thanks,
    Srinivas

  • ALV ( How to save the output as Excel file whenever we runs the Report )

    Hi,
          Can any one please let me know , how we can automatically save a ALV Grid Display report in Excel Format in presentation server whenever we execute the Report.
    Regards
    Avi.

    Hi,
    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
    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 UP TO 10 ROWS.
    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 'Flug'(001).
      PERFORM FILL_CELL USING 1 2 0 'Nr'(002).
      PERFORM FILL_CELL USING 1 3 1 'Von'(003).
      PERFORM FILL_CELL USING 1 4 1 'Nach'(004).
      PERFORM FILL_CELL USING 1 5 1 'Zeit'(005).
      LOOP AT IT_SPFLI.
    copy flights to active EXCEL sheet
        H = SY-TABIX + 1.
        PERFORM FILL_CELL USING H 1 0 IT_SPFLI-CARRID.
        PERFORM FILL_CELL USING H 2 0 IT_SPFLI-CONNID.
        PERFORM FILL_CELL USING H 3 0 IT_SPFLI-CITYFROM.
        PERFORM FILL_CELL USING H 4 0 IT_SPFLI-CITYTO.
        PERFORM FILL_CELL USING H 5 0 IT_SPFLI-DEPTIME.
      ENDLOOP.
    changes by Kishore  - start
    CALL METHOD OF H_EXCEL 'Workbooks' = H_MAPL.
      CALL METHOD OF H_EXCEL 'Worksheets' = H_MAPL." EXPORTING #1 = 2.
      PERFORM ERR_HDL.
    add a new workbook
      CALL METHOD OF H_MAPL 'Add' = H_MAP  EXPORTING #1 = 2.
      PERFORM ERR_HDL.
    tell user what is going on
      SET PROPERTY OF H_MAP 'NAME' = 'COPY'.
      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 'Flug'(001).
      PERFORM FILL_CELL USING 1 2 0 'Nr'(002).
      PERFORM FILL_CELL USING 1 3 1 'Von'(003).
      PERFORM FILL_CELL USING 1 4 1 'Nach'(004).
      PERFORM FILL_CELL USING 1 5 1 'Zeit'(005).
      LOOP AT IT_SPFLI.
    copy flights to active EXCEL sheet
        H = SY-TABIX + 1.
        PERFORM FILL_CELL USING H 1 0 IT_SPFLI-CARRID.
        PERFORM FILL_CELL USING H 2 0 IT_SPFLI-CONNID.
        PERFORM FILL_CELL USING H 3 0 IT_SPFLI-CITYFROM.
        PERFORM FILL_CELL USING H 4 0 IT_SPFLI-CITYTO.
        PERFORM FILL_CELL USING H 5 0 IT_SPFLI-DEPTIME.
      ENDLOOP.
    changes by Kishore  - end
    disconnect from Excel
         CALL METHOD OF H_EXCEL 'FILESAVEAS' EXPORTING  #1 = 'C:\SKV.XLS'.
      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 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.
    ENDFORM.
    *&      Form  ERR_HDL
          outputs OLE error if any                                       *
    -->  p1        text
    <--  p2        text
    FORM ERR_HDL.
    IF SY-SUBRC <> 0.
      WRITE: / 'Fehler bei OLE-Automation:'(010), SY-SUBRC.
      STOP.
    ENDIF.
    ENDFORM.                    " ERR_HDL
    Please note that this example maybe slow at filling the excel table
    (perhaps four fields per second on a 900 MHz machine - almost 30 seconds
    for a short example).
    To get the data on properties and methods - there is a bit of smoke and mirrors
    going on here; they are EXCEL properties and methods, not sap ones - so you need
    to look at excel help to determine how a particular function is structured. then
    build the block in sap, as shown in the example.
    If you only want to transfer the data to Excel like when you transfer the data from
    ALV to Excel simply use the Function Modules:
    XXL_SIMPLE_API
    If you want more modifications when you transfer it to Excel use:
    XXL_FULL_API
    Hope this helps.
    Reward if helpful.
    Regards,
    Sipra

  • How do I read a formatted excel worksheet as a string array

    I am using the report toolkit to read a excel worksheet as a LV string array.  This works fine except that it reads the full precision of numeric cells (~10 digits of precision).
    In my workbook I have the displayed precision set to 2.  Is there any way to read the table as it is displayed instead of how it is internally stored?  (BTW, I understand how to do this
    manually by parsing the string array and limiting the precision myself but would prefer to use excel itself to determine the precision)
    Solved!
    Go to Solution.

    sachsm,
    This should allow you to get the actual displayed text from an cell or range of cells.  Kind of doing a 'Paste Special' 'Values'.
    Attachments:
    Read Excel Displayed Text.png ‏30 KB

Maybe you are looking for

  • Itunes 10.6.1.7 (on windows 7 64 bit) recognizes airport express, but will not connect.

    I've attempted disabling all firewalls (both PC and anti-virus), disabling ipv6, rebooting the airport unit itself, but no luck. I'm not prompted with an error, however, as itunes is attempting to connect the airplay icon turns blue, and when it does

  • How to change the country code for Wireless channel usage

    My MacBook country code is set by Japan. In this case, I can use only 5.15~5.25 channels from ch#36 to ch48 at 5GHz Band. I'd like use the other channels..by other country code. How can I change the Wireless card country code?

  • Ethernet printer no longer available after upgrading Airport

    I had an older Airport wired into a router. An older ethernet printer was also wired into the router. I was able to print from various computers on the wireless network with no problem. Today I upgraded my dying Airport with a new Airport Express. I

  • Message popping up

    message says "This accessory is not optimized for this iphone and you may experience cellular noise and decrease in signal strength."

  • Recording phones calls via skype

    I need to record a long phone call and rather than do it directly from the landline i want to try and do it with Skype and record it directly onto the laptop for easy access and transcribing. could anyone tell me if this is possible and if so how to