Again: Using Crystal Report to export excel sheet.

Morning every one, first Iu2019d like to apologize for my last question see Using Crystal Report to export excel sheet. Itu2019s pretty hard to understand and wastes your precious time. Now here is a new one hopefully it will do myself a lot of help:)
First, we have a table called HOURLY_PORTUTIL in the Database:
Column Name...........Data Type  
STARTTIME ................DATE
CIRCLE.......................VARCHAR2
SERVICENAME...........VARCHAR2
PORTUTIL....................NUMBER
The data in this table looks like:
9/25/2008 00:00:00 AM...AP...(456)...0.01
9/25/2008 01:00:00 AM...AP...(456)...0.04
9/25/2008 02:00:00 AM...AP...(456)...5.04
9/25/2008 12:00:00 PM...AP...(456)...0.02
9/25/2008 00:00:00 AM...AP...AL-MOD...0.01
9/25/2008 01:00:00 AM...AP...AL-MOD...0.04
9/25/2008 02:00:00 AM...AP...AL-MOD...0.04
9/25/2008 12:00:00 PM...AP...AL-MOD...0.02
9/26/2008 00:00:00 AM...AP...(456)...1.01
9/26/2008 01:00:00 AM...AP...(456)...0.34
9/26/2008 02:00:00 AM...AP...(456)...5.24
9/26/2008 12:00:00 PM...AP...(456)...7.72
9/26/2008 00:00:00 AM...AP...AL-MOD...12.0
9/26/2008 01:00:00 AM...AP...AL-MOD...0.23
9/26/2008 02:00:00 AM...AP...AL-MOD...0.44
9/26/2008 12:00:00 PM...AP...AL-MOD...8.11
9/25/2008 00:00:00 AM...Delhi...(456)...1.01
9/25/2008 01:00:00 AM...Delhi...(456)...2.04
9/25/2008 02:00:00 AM...Delhi...(456)...6.04
9/25/2008 12:00:00 PM...Delhi...(456)...7.02
Then we have a Cross-Table:
Columns:
.............HOURLY_PORTUTIL.SERVICENAME
Rows:
............HOURLY_PORTUTIL.CIRCLE
............HOURLY_PORTUTIL.STARTTIME
............@hourly
Summarized Fields:
..............................Sum HOURLY_PORTUTIL.PORTUTIL
The Formula @hourly converts, say, '9/25/2008 01:00:00 AM' to '01:00-02:00'.
The above all is the information of our Cross-Table configuration, but the outcome is not what we want. I find that this forum doesn't want the user to post image, so I post the actually outcome and the outcome we want in my Picasa.
Actually outcome:
[http://picasaweb.google.com/enel.guo/ForWork#5288743968250408770]
What we want:
[http://picasaweb.google.com/enel.guo/ForWork#5288743974292750610]
I know that the outcome looks good enough, but our customers don't think so. They want export the report to Excel sheet and have every row with exact CIRCLE and STARTTIME.
Thanks again guys:)

Hi  Ashwini Yadav,
Thanks for your reply:)
I'm afraid that your answer is not perfectly right. Again I'm sorry for my vague description. The suggestion you gave us is already adopted. The total and grand total part disappeared but we still can't get what we want.
Please have a look at the new image link below, Hopefully it will give you a clear picture of what's going on:)
Cross-table:
[http://picasaweb.google.com/enel.guo/ForWork#5289122850514299506]
Cross-Table configuration:
[http://picasaweb.google.com/enel.guo/ForWork#5289123604007267826]
Cross-Table configuration::
[http://picasaweb.google.com/enel.guo/ForWork#5289122854967734466]
The original output:
[http://picasaweb.google.com/enel.guo/ForWork#5289120017105336914]
The output we want:
[http://picasaweb.google.com/enel.guo/ForWork#5289120018508824882]
Edited by: Yu-Lin Liang on Jan 9, 2009 3:51 AM

Similar Messages

  • Crystal Report 10 Export Excel (with gridlines)

    Post Author: Angel Tam
    CA Forum: JAVA
    Hi,I am now using Crystal Report 10 with Java to export the report to excel format.  I can do it successfully but all the gridlines (border) are lost.  Is anybody know how to set this feature.  My source code is as follows.<%@ page contentType = "text/html; charset=UTF-8"%><%@ page import = "com.crystaldecisions.sdk.occa.report.application.ReportClientDocument,                   java.util.,                   java.io.,                   javax.servlet.,                   javax.servlet.http.,                   com.crystaldecisions.sdk.occa.report.application.,                   com.crystaldecisions.sdk.occa.report.lib.ByteArray.,                   com.crystaldecisions.sdk.occa.report.exportoptions.,                   com.crystaldecisions.sdk.occa.report.lib." %><%/******************************************************************************************** *                Exporting the report to desired format and destination ********************************************************************************************/// Declare the PrintOutputControllerPrintOutputController poController;try {        // Retrieve the ReportClientDocument object from session        ReportClientDocument clientDoc = (ReportClientDocument) session.getAttribute("rptDoc");        // Clear ReportClientDocument object from session cache        session.setAttribute("rptDoc", null);                               // Get the print output controller object    poController = clientDoc.getPrintOutputController();     // Use the report documents PrintOutputController to export the report to a ByteArrayInputStream    // Change the int value to a ReportExportFormat    ByteArrayInputStream byteIS = (ByteArrayInputStream) poController.export(ReportExportFormat.MSExcel);    // Portable Document Format    String strExt = ".xls";                // Exported File Extension    String strMime = "application/vnd.ms-excel";    // Mime Type        // Create a byte&#91;&#93; (same size as the exported ByteArrayInputStream)    byte byteArray&#91;&#93; = new byte&#91;byteIS.available()&#93;;    // Copy the contents of the ByteArrayInputStream into a byteArray&#91;&#93;    int x = byteIS.read(byteArray, 0, byteIS.available());     response.reset();    // Clear out response stream            // Set the browser's mime type    response.setContentType(strMime);    response.addHeader("Content-disposition", "inline; filename=exported" + strExt);    // Use the SevletOutputStream to send the byteArray's data to the browser    response.getOutputStream().write(byteArray); } catch (Exception e) {    out.println("An error has occurred while exporting the report.<BR>" + e.toString());    out.println(e);}%>----
    I think these few lines may be useful to do the setting but I don't really how to use.  Hope somebody can help me.  Thank you.ExcelExportFormatOptions XLExpOpts = new ExcelExportFormatOptions();XLExpOpts.setShowGridlines(true);ExportOptions exOpts = new ExportOptions();exOpts.setFormatOptions(XLExpOpts);exOpts.setExportFormatType(ReportExportFormat.from_int(ReportExportFormat._MSExcel));Angel

    Post Author: Angel Tam
    CA Forum: JAVA
    Hi,I am now using Crystal Report 10 with Java to export the report to excel format.  I can do it successfully but all the gridlines (border) are lost.  Is anybody know how to set this feature.  My source code is as follows.<%@ page contentType = "text/html; charset=UTF-8"%><%@ page import = "com.crystaldecisions.sdk.occa.report.application.ReportClientDocument,                   java.util.,                   java.io.,                   javax.servlet.,                   javax.servlet.http.,                   com.crystaldecisions.sdk.occa.report.application.,                   com.crystaldecisions.sdk.occa.report.lib.ByteArray.,                   com.crystaldecisions.sdk.occa.report.exportoptions.,                   com.crystaldecisions.sdk.occa.report.lib." %><%/******************************************************************************************** *                Exporting the report to desired format and destination ********************************************************************************************/// Declare the PrintOutputControllerPrintOutputController poController;try {        // Retrieve the ReportClientDocument object from session        ReportClientDocument clientDoc = (ReportClientDocument) session.getAttribute("rptDoc");        // Clear ReportClientDocument object from session cache        session.setAttribute("rptDoc", null);                               // Get the print output controller object    poController = clientDoc.getPrintOutputController();     // Use the report documents PrintOutputController to export the report to a ByteArrayInputStream    // Change the int value to a ReportExportFormat    ByteArrayInputStream byteIS = (ByteArrayInputStream) poController.export(ReportExportFormat.MSExcel);    // Portable Document Format    String strExt = ".xls";                // Exported File Extension    String strMime = "application/vnd.ms-excel";    // Mime Type        // Create a byte&#91;&#93; (same size as the exported ByteArrayInputStream)    byte byteArray&#91;&#93; = new byte&#91;byteIS.available()&#93;;    // Copy the contents of the ByteArrayInputStream into a byteArray&#91;&#93;    int x = byteIS.read(byteArray, 0, byteIS.available());     response.reset();    // Clear out response stream            // Set the browser's mime type    response.setContentType(strMime);    response.addHeader("Content-disposition", "inline; filename=exported" + strExt);    // Use the SevletOutputStream to send the byteArray's data to the browser    response.getOutputStream().write(byteArray); } catch (Exception e) {    out.println("An error has occurred while exporting the report.<BR>" + e.toString());    out.println(e);}%>----
    I think these few lines may be useful to do the setting but I don't really how to use.  Hope somebody can help me.  Thank you.ExcelExportFormatOptions XLExpOpts = new ExcelExportFormatOptions();XLExpOpts.setShowGridlines(true);ExportOptions exOpts = new ExportOptions();exOpts.setFormatOptions(XLExpOpts);exOpts.setExportFormatType(ReportExportFormat.from_int(ReportExportFormat._MSExcel));Angel

  • Can we create Multi Tabbed excel Sheet using Crystal Reports 2008

    Hi,
      We want to create a Crystal Report which will export the output as multiple Tab's ( we can use sub reports).  Can we create a Multi Tabbed excel Sheet using Crystal Reports 2008 ( not  Crystal reports Basic 2008). Please share any information/links on how to do that.
    Also if it is not supported please let us know which version supports it.
    Thanks,
    Vasu

    At least one of the 3rd-party Crystal Reports Desktop Scheduling tools listed at: http://www.kenhamady.com/bookmarks.html provides that functionality.  It allows you to burst a single report so that each Group at level 1 becomes a separate tab.  You can control the tab names (and tab colors) via fields/formulas inside the report.
    You can also automate the process of exporting to (and also replacing or appending to) specified tabs inside existing workbooks.

  • Invalid export DLL or export format" with Crystal Reports 2008 to Excel xls

    We are experiencing the same issue as reported in the sticky thread. I answered in that thread, but thought that I woudl open a new thread to keep track of this issue.  I can give you the responses to your questions you have requested in that thread:
    Server Operating System - MS Windows Server 2003 R2 Enterprise Edition SP2
    Version of the .NET Framework - MS .NET Framework 3.5 SP1
    How did you deploy? - Installed CR 2008 SP1 runtime with msi package
    If you deployed with CRRuntime_12_0_mlb.msi - what was the date of the file and its size? CRRuntime_12_1_mlb.msi dated Sept. 16, 2008 12:55:00 PM, size: 56,717,824 bytes
    What is the file version of crpe32.dll on your server? You'll find this in the C:\Program Files\Business Objects\BusinessObjects Enterprise 12.0\win32_x86 directory - File was created 9/13/08 11:21AM, 9451KB File Version: 12.1.0.882
    How many libpng10.dll files are on your system? List all instances. - 1 instance is on the system located in C;\Program Files\Business Objects\Business Objects Enterprise 12.0\win32_x86 directory. It is dated 9/13/08 8:52:26AM 132KB version 1.0.30.1
    Any additional comments - We have tried to export to PDF and this works successfully. However, we can not export to xls or rft formats.
    CRXF_XLS.dll is 905KB 9/13/08 9:38AM Version 12.1.0.882
    CRXF_RTF.dll is 509KB 9/13/08 9:35AM Version 12.1.0.882
    We also have the CR XIR2 server runtime installed side by side on the server as we migrate from CR 2008 to CR XIR2 SP4 ( where this function does work currently).
    Please let me know if you need anything additional.
    Phil
    "Invalid export DLL or export format" with Crystal Reports 2008
    Posted: Sep 27, 2008 12:36 AM       E-mail this message      Reply 
    I've included this sticky because we are seeing many posts in this forum regarding the error Invalid export DLL or export format when exporting to Excel and RTF in .NET applications using the Crystal Reports 2008 .NET SDK.
    Issue
    Exporting a Crystal Report to Excel or RTF format
    .NET application using the Crystal Reports 2008 runtime (version 12.0)
    error Invalid export DLL or export format
    We've been doing some testing in-house and haven't reproduced this behavior. In order to figure this issue out we will need your help. If you are getting this error please reply to this post with the following information:
    Server Operating System
    Version of the .NET Framework
    How did you deploy?
    If you deployed with CRRuntime_12_0_mlb.msi - what was the date of the file and its size?
    What is the file version of crpe32.dll on your server? You'll find this in the C:\Program Files\Business Objects\BusinessObjects Enterprise 12.0\win32_x86 directory
    How many libpng10.dll files are on your system? List all instances.
    Any additional comments
    What We Know
    The error invalid export DLL or export format may occur when exporting to Excel and RTF formats in .NET applications utilizing the Crystal Reports 2008 runtime (v 12.0)
    Other export formats like Adobe PDF, Crystal Reports, CSV all export with no error
    Some customers have resolved this by adding C:\Program Files\Business Objects\BusinessObjects Enterprise 12.0\win32_x86 to their environment path variables
    This may have something to do with the file libpng10.dll. Both crxf_xls.dll and crxf_rtf.dll are dependent on it.
    Thanks in advance for your co-operation. We hope to figure out what is causing this issue soon.

    Hi,
    I am also having the same problem, except that I am not using Crystal Report 2008 runtime but the actual Crystal Report 2008 installation on Windows XP SP2 with VS Studio 2005 (VC++). MS .NET Framework 2.0.
    Cyrstal Report XIR2 was installed on the same machine but uninstalled before installing Crystal Report 2008.
    So only one instance of libpng10.dll and found in C:\Program Files\Business Objects\BusinessObjects Enterprise 12.0\win32_x86
    Crpe32.dll        3/1/2008 version 12.0.0.683
    Crxf_xls.dll       3/1/2008 version 12.0.0.683
    Crxf_rtf.dll         3/1/2008 version 12.0.0.683
    crdb_oracle.dll  3/1/2008 version 12.0.0.683
    libpng10.dll       3/1/2008 version 1.0.30.0             122880 bytes
    There is no problem for exporting to pdf, html, word, csv, Crystal Report. If I create a testing report without any data from database, the testing report can then be exported also to rtf and xls.
    Oracle 11.1.0.6 is the DB for the reports.
    Adding C:\Program Files\Business Objects\BusinessObjects Enterprise 12.0\win32_x86 to the path did not resolve my problem.
    Any idea to fix this issue?
    Thanks
    Kin H Chan

  • Crystal Reports 9 Export To Excel 2007

    Hi All,
    We are using Crystal Reports 9 designer in VB6 to create our reports.
    When report is generated and siplayed on the screen, the option to export the report to Excel only gives the option of Microsoft Excel 97 - 2000. We are looking to upgrade to Microsoft Office 2007.
    Question: Is there any way to update Cyrstal to allow the ability to export the Crystal Report to Excel 2007?
    Is there any dll that can be applied to present the Office 2007 export option capability?
    I am doing this to determine if Crystal Reports 9 would be able to ulitize Office 2007.

    Hello Don,
    The problem is that Excel 2007 is not offered as an option to export to to. If we upgrade to Office 2007, we need to be able to select this. The Microsoft 97 - 2000 would not work as Excel would be 2007. We don't want to have to created as Excel 2000 and then have Excel 2007 convert it. We are looking for a way to have Crystal 9 have the ability to export to Excel 2007 directly.
    Is there any upgrade to Crystal 9 that would allow Excel 2007 as an export option or would we have to upgrade to a different version of Crystal? We are trying to avoid upgrading Crystal since this would require purchasing multiple developer licenses and the report would have to be recreated using the upgraded version report designer in VB6.
    Edited by: cpscott on Feb 20, 2010 12:44 AM

  • How to set Excel Options using  crystal reports 2008

    Hi,
    I am trying to figure out CR 8.5 (Crystal report control) Equivalents in Crystal reports 2008 using crystal report viewer in .Net but not able to find the exact replacments.
    Properties used in CR 8.5
    CRAXDRT.ExportOptions.ExcelUseWorksheetFunctions=True
    CRAXDRT.ExportOptions.ExcelUseTabularFormat =True
    CRAXDRT.ExportOptions.SetLogOnInfo(1,3,4,5)
    Please let me know the replacements for the above mentioned properties in .Net using crystal report viewer (CR 2008)
    Thanks in Advance
    Regards,
    Ramnath

    Hello,
    The code that has been provided is of Report Designer Component.
    RDC has been deprecated in Crystal Reports 2008.
    Use the 'ExcelFormatOptions' class. It provides many options regarding exporting in an excel format.
    ExcelFormatOptions myExportFormatOptions = new ExcelFormatOptions();
    Try exploring the Developer guide for Crystal Reports .NET SDK [here|http://www.sdn.sap.com/irj/boc/sdklibrary#section7]..

  • Formatting / Post Processing of Exported Excel Sheet

    Hi ,
    Issue:
    The Columns in the Excel Sheet are not fully visible when we export Report from CR viewer  to Excel Sheet. So we had planned for Post processing of the Excel Sheet using VBA or .NET etc to format the Excel Sheet, which would be on the server side, meaning the End user will never see the formatting process, but only the End Report. Is it possible to achieve this ??
    NOTE:
    1) VBA or .NET could not be run on the Linux Server but we could take advantage of the windows server in the presentation layer.
    Architecture:  
    Presentation Layer                    
    Linux Server <--> Windows .Net Server <--
    > End User
    {Crystal RAS Server} <-->{GUI CR Viewer Application}<--
    >
    Our Proposed Solution:
    1) Create an GUI Application that has CR viewer in it .
    2) Create a Separate Excel Export button on the webpage.
    3) when the user wants to export the report , he clicks the button.
    4) The GUI/ application saves the Exported Excel Sheet from the Ras server to the windows server.
    5) Then the .Net or the Vba code is applied to process/Format the Excel Sheet.
    6) When complete the End user is prompted for saving the report to a local disk.
    My questions:
    1) Can this be achieved ?
    2) what would be the best way to handle this ?
    3) what should be the process flow ?
    4) what are the things to be considered while planning for such a design ?
    Regards,
    Ramkumar Govindasamy

    So you're looking at using RAS .NET SDK on the Application Layer to export a Crystal Report to Excel, save to temp file on the Application Layer machine, process that temp file, and stream that back out to the client web browser.
    Considerations:
    1. You need to create your own custom UI button to trigger the process, since the .NET Web Forms Crystal Reports viewer won't have the hooks to customize the Excel export.
    2. Running Excel VBA from your Web App may be problematic - you'd have to be particularly careful if the system is under load, since the Excel VBA - COM-Interop isn't necessarily designed for high throughput.  Under high load, you may get file locking or COM-Interop layer just refuse to process.  It's pretty common to try and catch exceptions and retry if you encounter this.
    You'd likely not find anyone here familiar with 2 above, but 1 is fairly common.
    Sincerely,
    Ted Ueda

  • Crystal report 10 export to MAPI does not work in Windows 7

    hi:
    I am using CR10 10.0.5.1025 in Windows 7. I tried to export a report to MAPI and got error:
    Error 2147500037 returned by function <MAPIResolveName>
    This error occurs both Office 2007 and 2003
    Any one see this error before?

    SOLUTION
    Hi, (excuse my bad english)
    The client have and use Windows 7 SP1 x64 Ultimate version .
    He use Crystal Report XI R2 Sp6
    PROBLEM:   He has a MAPI error Error when exporting PDF to MAPI.
                          He Receiving the following error message when trying to export PDF Crystal Report to MAPI.
                          Error 2147500037 returned by function <MAPIResolveName>
                          Email Client: MS Outlook 2007
    SOLUTION:   Were I found on the internet.
    Auhtor is: Andrew Whittam
    Web Link: http://www.2icsoftware.com/Support/Forum/tabid/110/aff/2/aft/1105/afv/topic/Default.aspx
    Microsoft decided to no longer support the 'Simple MAPI' email system in Windows 7. Although countless applications use it to manage emails, including 2ic Pallets, a replacement system has not been provided.
    So Windows 7 users have two options:
    Manually create email messages by copying and pasting information from the '2icEmail.txt' file that is created whenever there is an emailing error, i.e. every time you try emailing with Windows 7.
    Downgrade the '  C:\Windows\System32\Mapi32.dll  ' file to an earlier version, i.e. replace Mapi32.dll with the same file from a Windows Vista or XP computer.
    Downgrading seems to work ok. Mapi32.dll on Windows 7 has version number 1.0.2536.0, which is the same as Mapi32.dll on Windows Vista and XP. However, downgrade AT YOUR OWN RISK and check with your system administrator before making any changes.
    It is strongly recommended to rename the existing Mapi32.dll file rather than delete it so it can be restored if you find other programs do not work after downgrading. To downgrade, follow the steps below:
    Open Windows Explorer, navigate to '  C:\Windows\System32   ' (or '  C:\Windows\SysWOW64  ' for 64 bit operating systems), find Mapi32.dll and rename it to Mapi32.dll.OLD or Mapi32.dll.2ic. If you receive the message "You require permission from TrustedInstaller to make changes to this file." or some other permissions-related error, change the Owner of the file and permissions before trying again, i.e. right-click on Mapi32.dll, select Properties, Security tab, click Advanced, Owner tab, click Edit..., select "Administrators", OK the dialog boxes, again right-click on Mapi32.dll, select Properties, Security tab, click Edit, select "Administrators", allow Full Control and OK the dialog boxes. For more detail, good instructions can be found at http://helpdeskgeek.com/windows-7/w...dinstaller.
    Run the 'Email patch' from the Downloads - Utilities page of this website. This patch installs and registers the files below.
    C:\Windows\System32\Mapi32.dll
    C:\Windows\System32\MSmapi32.ocx
    Note they are only installed when missing or replacing an older version. For 64 bit operating systems these files are updated in the 'C:\Windows\SysWOW64' folder. Alternatively these files can be manually copied from a different computer and registered using Regsvr32.
    The email functionality can be checked using the 'Export/email test spreadsheet', also available on the Downloads - Utilities page. Using this spreadsheet to generate an email on Windows 7 before downgrading should result in an error message. Emailing should work after running the patch.
    RESULT:       I fixed the problem customer PC. TEST and Verification are fonctionnal.
    Steve
    Edited by: sstmartin on Mar 18, 2011 9:11 PM

  • Download the ALV Report output into excel sheet or notepad

    Hi,
    how to downlaod the alv report out into excel sheet or notepad in a proper manner. program contain large number records....
    Thanks in advance!!!!
    Regards,
    kranthi.

    Hi
    Download a report to excel with format (border, color cell, etc) 
    Try this program...it may help you to change the font ..etc.
    Code:
    REPORT ZSIRI NO STANDARD PAGE HEADING.
    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

  • Need to send ALV Report as an Excel sheet via Email

    Well , I need to Email an ALV Report as an Excel Sheet using my program. What do I need to do and how?
    Answers will be rewarded with points.
    Thanks

    Hi Manu,
    You can copy and paste the following codes and try to execute..
    Hope this will help you..
    note: dont forget to change 'SAPUSER' to your SAP user id.
    REPORT  yhn_test8                               .
    TYPE-POOLS: slis, slist, truxs.
    DATA t5         LIKE t005t OCCURS 0 WITH HEADER LINE.
    DATA fcat       TYPE slis_t_fieldcat_alv.
    DATA listobject LIKE abaplist OCCURS 0 WITH HEADER LINE.
    DATA stack      TYPE slist_listlevel_stack WITH HEADER LINE.
    DATA ttxt       LIKE solisti1 OCCURS 0 WITH HEADER LINE.
    PARAMETER p_alv   RADIOBUTTON GROUP a.
    PARAMETER p_excel RADIOBUTTON GROUP a.
    START-OF-SELECTION.
      SELECT * INTO TABLE t5
               FROM t005t
              WHERE spras = sy-langu.
      CLEAR : fcat, fcat[].
      CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
        EXPORTING
          i_structure_name       = 'T005T'
        CHANGING
          ct_fieldcat            = fcat
        EXCEPTIONS
          inconsistent_interface = 1
          program_error          = 2
          OTHERS                 = 3.
      IF p_alv = 'X'.
        CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
          EXPORTING
            it_fieldcat   = fcat
          TABLES
            t_outtab      = t5
          EXCEPTIONS
            program_error = 1
            OTHERS        = 2.
        IF sy-subrc <> 0.
        ENDIF.
      ELSEIF p_excel = 'X'.
        CALL FUNCTION 'LIST_FREE_MEMORY'.
        SUBMIT yhn_test8 EXPORTING LIST TO MEMORY AND RETURN.
        CALL FUNCTION 'LIST_FROM_MEMORY'
          TABLES
            listobject = listobject
          EXCEPTIONS
            not_found  = 1
            OTHERS     = 2.
        IF sy-subrc = 0.
        Generate LIST for excel file
          CALL FUNCTION 'LIST_TO_TXT'
            TABLES
              listtxt            = ttxt
              listobject         = listobject
            EXCEPTIONS
              empty_list         = 1
              list_index_invalid = 2
              OTHERS             = 3.
          IF sy-subrc = 0.
            LOOP AT ttxt.
              REPLACE ALL OCCURRENCES OF '|' IN ttxt-line
                      WITH cl_abap_char_utilities=>horizontal_tab.
              MODIFY ttxt.
            ENDLOOP.
            PERFORM send_email.
          ENDIF.
        ENDIF.
      ENDIF.
    *&      Form  send_email
    FORM send_email .
      DATA docs LIKE docs OCCURS 0 WITH HEADER LINE.
      DATA excelsize TYPE i.
      DATA excel LIKE solisti1   OCCURS 0 WITH HEADER LINE.
      DATA doc LIKE sodocchgi1.
      DATA excelln TYPE i.
      DATA int_objpack LIKE sopcklsti1 OCCURS 2 WITH HEADER LINE.
      DATA int_objhead LIKE solisti1   OCCURS 2 WITH HEADER LINE.
      DATA int_objtext LIKE solisti1   OCCURS 0 WITH HEADER LINE.
      DATA int_reclist LIKE somlreci1  OCCURS 1 WITH HEADER LINE.
      DATA bodyln LIKE sy-tabix.
      DATA output_data TYPE ssfcrescl.
      excel[] = ttxt[].
    excel table sizes
      DESCRIBE TABLE excel LINES excelln.
    Body Email
      int_objtext-line = 'Test Body'.
      APPEND int_objtext.
      DESCRIBE TABLE int_objtext LINES bodyln.
      READ     TABLE int_objtext INDEX bodyln.
      CLEAR doc.
      doc-doc_size   = ( bodyln - 1 ) * 255 + STRLEN( int_objtext ).
      doc-obj_name   = ' '.
      doc-sensitivty = 'P'.
      doc-proc_syst  = sy-sysid.
      doc-proc_clint = sy-mandt.
      CLEAR: int_objpack, int_objpack[].
      int_objpack-transf_bin = ' '.
      int_objpack-head_start = 1.
      int_objpack-head_num   = 0.
      int_objpack-body_start = 1.
      int_objpack-body_num   = bodyln.
      int_objpack-doc_type   = 'RAW'.
      int_objpack-obj_descr  = 'Test'.
      APPEND int_objpack.
      CLEAR: int_objhead, int_objhead[].
      int_objhead            = 'Attachment'.
      APPEND int_objhead.
      int_objpack-transf_bin = 'X'.
      int_objpack-head_start = 1.
      int_objpack-head_num   = 0.
      int_objpack-body_start = 1.
      int_objpack-body_num   = excelln.
      int_objpack-doc_size   = excelsize.
      int_objpack-doc_type   = 'XLS'.
      int_objpack-obj_name   = 'excel'.
      int_objpack-obj_descr  = 'test.xls'. "File name
      APPEND int_objpack.
      Set Receiver
      int_reclist-receiver   = 'SAPUSER'.
      int_reclist-rec_type   = 'B'.
      int_reclist-notif_del  = 'X'.
      int_reclist-notif_read = 'X'.
      int_reclist-notif_ndel = 'X'.
      int_reclist-express    = 'X'.
      APPEND int_reclist.
      doc-obj_descr = 'Report in Excel'.
      Sending Email
      CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
        EXPORTING
          document_data              = doc
          put_in_outbox              = 'X'
          commit_work                = 'X'
        TABLES
          packing_list               = int_objpack
          object_header              = int_objhead
          contents_bin               = excel
          contents_txt               = int_objtext   "Body
          receivers                  = int_reclist
        EXCEPTIONS
          too_many_receivers         = 1
          document_not_sent          = 2
          document_type_not_exist    = 3
          operation_no_authorization = 4
          parameter_error            = 5
          x_error                    = 6
          enqueue_error              = 7
          OTHERS                     = 8.
    ENDFORM.                    " send_email

  • Can we generate output of a report in an Excel Sheet?

    Hi All,
      Can anyone tell me how to generate output of a report in an Excel Sheet format?
    Thanks in advance,
    Jasmine.

    hi,
    try this sample...
    data: begin of itab occurs 0,
          vbeln like vbak-vbeln,
          posnr like vbap-posnr,
          end of itab.
    select vbeln
           posnr
           from vbap
           up to 20 rows
           into table itab.
    * EXCEL sheet using OLE automation.
    INCLUDE OLE2INCL.
    * handles for OLE objects
    DATA: H_EXCEL TYPE OLE2_OBJECT,        " Excel object
          H_WORK  TYPE OLE2_OBJECT,
          H_SHEET TYPE OLE2_OBJECT,
          H_CELL  TYPE OLE2_OBJECT,
          V_COL   LIKE SY-TABIX.     " column number of the cell
    DATA:
      V_STEP(30),
      V_FILE LIKE RLGRAP-FILENAME.
    * tell user what is going on
      CALL FUNCTION 'SAPGUI_PROGRESS_INDICATOR'
         EXPORTING
    *           PERCENTAGE = 0
               TEXT       = 'Creating Excel...'
           EXCEPTIONS
                OTHERS     = 1.
    * start Excel
      V_STEP = 'Starting Excel'.
      CREATE OBJECT H_EXCEL 'EXCEL.APPLICATION'.
      PERFORM ERR_HDL.
      SET PROPERTY OF H_EXCEL  'Visible' = 1.
      CALL METHOD OF H_EXCEL 'APPEND'
        EXPORTING  #1 = 'D:SappdfABAP Trainingsheettr.xls'.
    *  PERFORM ERR_HDL.
    * tell user what is going on
      CALL FUNCTION 'SAPGUI_PROGRESS_INDICATOR'
         EXPORTING
    *           PERCENTAGE = 0
               TEXT       = 'Adding Data to Excel...'
           EXCEPTIONS
                OTHERS     = 1.
    * Get the list of workbooks
      V_STEP = 'Preaparing Excel'.
      CALL METHOD OF H_EXCEL 'WORKBOOKS' = H_WORK.
      PERFORM ERR_HDL.
    ** Add new workbook (create a file)
      CALL METHOD OF H_WORK 'ADD'.
      PERFORM ERR_HDL.
    * Get the created worksheet
    ************************Sheet Number
      CALL METHOD OF H_EXCEL 'WORKSHEETS' = H_SHEET EXPORTING #1 = 3.
    ************************Sheet Number
      PERFORM ERR_HDL.
    * Activate (select) the first sheet
      CALL METHOD OF H_SHEET 'ACTIVATE'.
      PERFORM ERR_HDL.
    * tell user what is going on
      CALL FUNCTION 'SAPGUI_PROGRESS_INDICATOR'
         EXPORTING
    *           PERCENTAGE = 0
               TEXT       = 'Adding Data to Excel...'
           EXCEPTIONS
                OTHERS     = 1.
    * output column headings to active Excel sheet
      V_STEP = 'Adding data to Excel'.
      LOOP AT ITAB.
        V_COL = SY-TABIX.
        PERFORM FILL_CELL USING 1 V_COL ITAB-vbeln.
        PERFORM FILL_CELL USING 2 V_COL ITAB-posnr.
      ENDLOOP.
      V_STEP = 'Releasing Excel'.
      FREE OBJECT H_EXCEL.
      PERFORM ERR_HDL.
      H_EXCEL-HANDLE = -1.
    *&      Form  ERR_HDL
    *       text
    *  -->  p1        text
    FORM ERR_HDL.
      IF SY-SUBRC <> 0.
        WRITE: / 'Error in processing Excel File:', V_STEP.
        STOP.
      ENDIF.
    ENDFORM.                    " ERR_HDL
    *&      Form  FILL_CELL
    *       text
    *      -->P_1      text
    *      -->P_1      text
    *      -->P_1      text
    FORM FILL_CELL USING  ROW COL VAL.
      CALL METHOD OF H_EXCEL 'Cells' = H_CELL
                     EXPORTING #1 = ROW #2 = COL.
      PERFORM ERR_HDL.
      SET PROPERTY OF H_CELL 'Value' = VAL .
      PERFORM ERR_HDL.
    ENDFORM.                    " FILL_CELL
    regards
    satesh

  • Using Olefield to embed an excel sheet

     

    Hi Manish,
    My answer may not be straight to the point.
    But, let me explain what I have done with my application.
    We have a similiar case here, but the difference is we are
    accessing Crystal Reports where as you are accessing Excel sheet and you
    are using OLE object where as we are using Active X. But the concept
    is going to be the same.
    Our application contains some batch process on the server which
    fills up the table in our database.
    Crystal report should access the table and get the data.
    For this we need to pass a set of parameters through Forte.
    This is acheived through the active X properties.
    I think you can map excel sheet to a data base table and fetch
    the data from there using some simple macros.
    Hope this helps you.
    Ratna K Garapati,
    Complete Business Solutions Inc.,
    Off : 248 848 2288 Ext 3464
    Res: 248 888 0775
    E-Mail : [email protected]
    -----Original Message-----
    From: Manish Shirke [SMTP:[email protected]]
    Sent: Monday, March 09, 1998 8:20 AM
    To: '[email protected]'
    Subject: Using Olefield to embed an excel sheet
    hi,
           I am trying to embed an MSExcel sheet in a forte application. I
    have
    been able to create the Excel project using Olegen and also to embed
    an excel sheet in my application window. Now I need to map the data in
    my application onto the excel sheet using the Ole API. I am trying to
    figure
    it out due to lack of sufficient forte documentation.
         If any forte users have done this previously and know how to map
    data
    from their application onto the excel sheet, can they kindly help me
    out.
    Thanks
    Manish Shirke
    [email protected]

  • Crystal Report 2008 export to text problem

    Hello,
    I am using Crystal Reports 2008 for generating reports in our WPF application. In this application, we are exporting the report to txt file on a button click. Now the application contains a form called u2018Print Manageru2019, through which the user can print the exported report(text files). Now the issue, when we try to the any of the exported report file through the application, the printer leaves alternate blank pages. The printer used in this case is DOT MATRIX EPSON LQ-1150II ESC/P2. We even tried printing the text file on HP Laser jet 4600, but the same issue is faced.
    Also, please note that when I try to read the exported txt file, a formfeed(u2018\fu2019 page break) character  can be seen  at the place where the printer leaves a blank page. Hence, my concern is, Is there any property of crystal report that I am missing on or is this a printer driver issue? But if it would have been a driver issue, then changing the printer might have solved the issue.
    I also  tried  doing u2018Keep Togetheru2019 property = false of all the sections of the report. Also, I found that the u2018New Page Afteru2019 property = true and disabled for the u2018Page Footeru2019 section. So I set u2018New Page Afteru2019 property = false programmatically as
    rdTest.ReportDefinition.Sections["Section5"].SectionFormat.EnableNewPageAfter = false;
    but no luck.
    If anyone has faced similar problem or have any clues, please help!
    Any kind of help in solving this issue will be highly appreciated.
    Thanks in anticipation!

    Good morning.
    We've got something to get straight first
    When you say "...from the Report Viewer. The report printed as expected on HP printer...", do you mean the viewer of the .NET app, or the viewer of the CR designer?
    And version 12.0.0.683, is very old (well as far as CR is concerned anyhow   ). That version is SP 1, we are now on SP 2. So that will be the place to start. Get to SP 2 which can be downloaded from here;
    https://smpdl.sap-ag.de/~sapidp/012002523100009038092009E/cr2008win_sp2.exe
    Ludek

  • Crystal Reports 10 - Export to TEXT with Delimited Space Format

    Hello,
    I am new to Crystal reports, sorry if this is a really basic question.  I am trying to create a report which I can export to a TXT file.  The TXT file format will be delimted space (size 500 characters).  I would like to know how I can use Crystal reports to fix the size of the fields.
    For example field 1 is 22 characters, field 2 starts directly after field 1 and is 9 characters (9 spaces), field 3 is then 7 characters so an example of the output I need is:
    1111111111111111111111         2222222
    I will need to use a mixture of TEXT fields and database fields to create the report.  Thefore is it possible to specify the length of a text file i.e. TEXT1 = 22?
    I am new to Crystal so I hope there is a simple solution without the use of coding
    Thanks,
    Brett

    You will have to force the fields to the length that you are looking for, as Crystal treats strings as variable length strings.  So to force a character field to 20 characters, you'd do something like:
    left({db.charfield} + ReplicateString(" ", 20), 20)
    For a number, you could use either
    ToText({db.numfield}, "0000000000")
    or
    right(ReplicateString(" ", 10) + ToText({db.numfield}, "0"), 10)
    (for a 10 digit integer; change the format string in ToText for other numeric data types)
    I suggest that it may be clearer and more accurate to create one formula field with the entire line formatted as needed, then just display that one field on the report.
    HTH,
    Carl

  • JRC Export to Text like Crystal Report Designer Export

    We need to Export report to Text like Crystal Report Designer Export using JRC. Is this possible? I see export ReportExportFormat CSV, PDF and RTF only. These exports are working, But I need plain text that looks like Text export of Crystal Reports Designer. I see this working in RAS 2008. What I can do to get this with JRC. I am using Crystal Reports 2008 to design reports.
    Thanks for any help.
    Regards
    Raveendra
    Clarification

    Thank you Jitin.
    What could be solution to this problem?
    If still I want to go with JRC, Can I write some Java code to perform this export?
    I see TextExportFormatOptions and its not working.
    If I want to export automatically to text format, what other choices are there?
    Basically I need to execute report and generate text file automatically. Text file should look like Crystal Report Designer Exported Text file.
    Thank you for your time.
    Regards,
    Raveendra

Maybe you are looking for