How to create a report with a PL/SQL Stored Procedure method

Hi,
We are working in oracle applications 11i on oracle database 9i.
I have a custom procedure that is used to send Payslip SMS messages to staff.
I am thinking about creating a request for that procedure so the HR user can run it himself at the end of every month from the HR responsibility.
any hints , guidelines or references will be appreciated...
thanks...

See the example in MOS Doc 73492.1 (Creating a PL/SQL Concurrent Program in Oracle Applications)
More details in the Developer Guide - http://download.oracle.com/docs/cd/B25516_18/current/acrobat/115devg.pdf - Chapters 16 and 17
Srini

Similar Messages

  • Is i possible to base a report on a pl/sql stored procedure

    Is i possible to base a report on a pl/sql stored procedure?
    If Yes please give directions on how to do it.
    /morten

    Hello Morten,
    In Reports 9i, with new feature JDBCPDS its possiable to create a report against a existing stored procedure.
    Using JDBCPDS, user can access any JDBC-enabled data source. You can access database like Oracle, DB2, Sybase, ODBC Data Sources, etc using supporting
    JDBC Drivers. User can also connect ODBC Data Sources like SQL Server, MS-Access, Excel etc.
    User can create a JDBC Query angainst a SQL Query or Stored Procedure in any of mentioned dataSource.
    Following is the syntax of the Oracle Stored Procedure, which can be used as Data Source with JDBCPDS.
    Steps to create a JDBCPDS Report through Report Builder : http://otn.oracle.com:8877/reports/help/ - > JDBCPDS- > How To
    //----------Package definition for Ref cursor ----------/
    package test_Procedure as
    type empcurProcedure5 is ref cursor;
    end test_tryProcedure5;
    // -----------Procedure definition ---------//
    test_Procedure(p_emp_cv out test_tryProcedure5.empcurProcedure5,
    p1 in NUMBER) is
    begin
    update emp set sal=sal + 50 where deptno > P1
    open p_emp_cv for select * from emp where deptno > P1;
    end test_Procedure;
    Procedure first parameter will be Ref Cursor and will be used to return the resultSet to JDBC Query.
    User should create first this procedure in Database. Then in JDBC Query Dialog, user can call this stored procedure by specifying procedure name.
    test_Procedure(40)
    Please see ORACLE_HOME/reports/conf/jdbcpds.conf for more Connection and
    JDBC-Driver information.
    With Regards
    Reports Team

  • How to create a report with survey data

    Hi All,
    I need to create a report with survey data in below format. Can anyone help me how to display the summary in this format.
    Swapna

    Hi Swapna,
    According to your description, you want to create a report with survey data and display the summary.
    Reporting Services is used for rendering the report with data retrieved from datasource. In Reporting Services, we can retrieve data from the datasource then design a report, after the report processed, data is fixed on the report. So it’s not supported
    to have the end users selection and do summary. For your requirement, it’s can’t be achieved currently.
    If you have any question, please feel free to ask.
    Best regards,
    Qiuyun Yu
    Qiuyun Yu
    TechNet Community Support

  • How to create a report with data using the Crystal Reports for Java SDK

    Hi,
    How do I create a report with data that can be displayed via the Crystal Report for Java SDK and the Viewers API?
    I am writing my own report designer, and would like to use the Crystal Runtime Engine to display my report in DHTML, PDF, and Excel formats.  I can create my own report through the following code snippet:
    ReportClientDocument boReportClientDocument = new ReportClientDocument();
    boReportClientDocument.newDocument();
    However, I cannot find a way to add data elements to the report without specifying an RPT file.  Is this possible?  I seems like it is since the Eclipse Plug In allows you to specify your database parameters when creating an RPT file.
    is there a way to do this through these packages?
    com.crystaldecisions.sdk.occa.report.data
    com.crystaldecisions.sdk.occa.report.definition
    Am I forced to create a RPT file for the different table and column structures I have? 
    Thank you in advance for any insights.
    Ted Jenney

    Hi Rameez,
    After working through the example code some more, and doing some more research, I remain unable to populate a report with my own data and view the report in a browser.  I realize this is a long post, but there are multiple errors I am receiving, and these are the seemingly essential ones that I am hitting.
    Modeling the Sample code from Create_Report_From_Scratch.zip to add a database table, using the following code:
    <%@ page import="com.crystaldecisions.sdk.occa.report.application.*"%>
    <%@ page import="com.crystaldecisions.sdk.occa.report.data.*"%>
    <%@ page import="com.crystaldecisions.sdk.occa.report.document.*"%>
    <%@ page import="com.crystaldecisions.sdk.occa.report.definition.*"%>
    <%@ page import="com.crystaldecisions.sdk.occa.report.lib.*" %>
    <%@ page import = "com.crystaldecisions.report.web.viewer.*"%>
    <%
    try { 
                ReportClientDocument rcd = new ReportClientDocument();
                rcd.newDocument();
    // Setup the DB connection
                String database_dll = "Sqlsrv32.dll";
                String db = "qa_start_2012";
                String dsn = "SQL Server";
                String userName = "sa";
                String pwd = "sa";
                // Create the DB connection
                ConnectionInfo oConnectionInfo = new ConnectionInfo();
                PropertyBag oPropertyBag1 = oConnectionInfo.getAttributes();
                // Set new table logon properties
                PropertyBag oPropertyBag2 = new PropertyBag();
                oPropertyBag2.put("DSN", dsn);
                oPropertyBag2.put("Data Source", db);
                // Set the connection info objects members
                // 1. Pass the Logon Properties to the main PropertyBag
                // 2. Set the Server Description to the new **System DSN**
                oPropertyBag1.put(PropertyBagHelper.CONNINFO_CRQE_LOGONPROPERTIES, oPropertyBag2);
                oPropertyBag1.put(PropertyBagHelper.CONNINFO_CRQE_SERVERDESCRIPTION, dsn);
                oPropertyBag1.put("Database DLL", database_dll);
                oConnectionInfo.setAttributes(oPropertyBag1);
                oConnectionInfo.setUserName(userName);
                oConnectionInfo.setPassword(pwd);
                // The Kind of connectionInfos is CRQE (Crystal Reports Query Engine).
                oConnectionInfo.setKind(ConnectionInfoKind.CRQE);
    // Add a Database table
              String tableName = "Building";
                Table oTable = new Table();
                oTable.setName(tableName);
                oTable.setConnectionInfo(oConnectionInfo);
                rcd.getDatabaseController().addTable(oTable, null);
        catch(ReportSDKException RsdkEx) {
                out.println(RsdkEx);  
        catch (Exception ex) {
              out.println(ex);  
    %>
    Throws the exception
    com.crystaldecisions.sdk.occa.report.lib.ReportSDKException: java.lang.NullPointerException---- Error code:-2147467259 Error code name:failed
    There was other sample code on SDN which suggested the following - adding the table after calling table.setDataFields() as in:
              String tableName = "Building";
                String fieldname = "Building_Name";
                Table oTable = new Table();
                oTable.setName(tableName);
                oTable.setAlias(tableName);
                oTable.setQualifiedName(tableName);
                oTable.setDescription(tableName) ;
                Fields fields = new Fields();
                DBField field = new DBField();
                field.setDescription(fieldname);
                field.setHeadingText(fieldname);
                field.setName(fieldname);
                field.setType(FieldValueType.stringField);
                field.setLength(40);
                fields.add(field);
                oTable.setDataFields(fields);
                oTable.setConnectionInfo(oConnectionInfo);
                rcd.getDatabaseController().addTable(oTable, null);
    This code succeeds, but it is not clear how to add that database field to a section.  If I attempt to call the following:
    FieldObject oFieldObject = new FieldObject();
                oFieldObject.setDataSourceName(field.getFormulaForm());
                oFieldObject.setFieldValueType(field.getType());
                // Now add it to the section
                oFieldObject.setLeft(3120);
                oFieldObject.setTop(120);
                oFieldObject.setWidth(1911);
                oFieldObject.setHeight(226);
                rcd.getReportDefController().getReportObjectController().add(oFieldObject, rcd.getReportDefController().getReportDefinition().getDetailArea().getSections().getSection(0), -1);
    Then I get an error (which is not unexpected)
    com.crystaldecisions.sdk.occa.report.lib.ReportDefControllerException: The field was not found.---- Error code:-2147213283 Error code name:invalidFieldObject
    How do I add one of the table.SetDataFields()  to my report to be displayed?
    Are there any other pointers or suggestions you may have?
    Thank you

  • How to create a report with different page sizes

    Hi,
    I would like to create a report with different page sizes, it's possible to do it with diadem?
    When I change the layout parameters, changes afect to all sheets...
    Is there a way to change page size individually for each sheet?
    Thanks in advance.
    Marc

    Hi Marc,
    You can use the DocStart and DocEnd commands along with the PicPrint command to spool multiple print commands to the same output PDF file using the direct printer approach.  This should enable you to programmatically specify the page size differently for each sheet that you add to the print job.
    ' Print PDF Page by Page.VBS
    OPTION EXPLICIT
    Dim i, Path, OldPrintName
    Path = AutoActPath & "2D Stacked"
    Call DataDelAll
    Call DataFileLoad(Path & ".TDM")
    PDFFileName = Path & " Page by Page.pdf"
    IF FileExist(PDFFileName) THEN Call FileDelete(PDFFileName)
    OldPrintName = PrintName
    PrintName = "winspool,DIAdem PDF Export,LPT1:" ' Set to PDF printer
    PDFResolution = "72 DPI" ' "2400 DPI" , "default"
    PDFOptimization = TRUE
    PDFFontsEmbedded = FALSE
    PDFJPGCompressed = "high"
    PrintOrient = "landscape" ' orient paper
    Call PrintMaxScale("GRAPH") ' auto-max, see alternative margin setting variables below
    PrintLeftMarg = 0.181
    PrintTopMarg = 0.181
    PrintWidth = 10.67
    'PrintHeigth = 7 (read-only)
    Call WndShow("REPORT")
    Call DocStart ' Begin multi-page document/print job
    FOR i = 1 TO 4
    Call PicLoad(Path & ".TDR")
    Call GraphSheetNGet(1)
    Call GraphSheetRename(GraphSheetName, "Page " & i)
    Call PicUpdate
    Call PicPrint("WinPrint") ' Add a page to be printed
    NEXT ' i
    Call DocEnd ' End multi-page document/print job
    PrintName = OldPrintName
    Call ExtProgram(PDFFileName)
    Brad Turpin
    DIAdem Product Support Engineer
    National Instruments

  • How to create Webi Reports with SAP BW Objects

    Hi,
    I have no knowledge on creating webi reports with SAP BW Objects like (InfoCube, DSO, MultiProvider, Infoview, MasterData Infoobject).
    As per my understanding Webi reports can be developed with universe which is created on BEx Queries or OLAP BAPI interface, unfortunately i don't have BEx App installed. So, i have to create OLAP universe in this case.
    Here my question is can we create universe with all the available BW objects like InfoCube, DSO, MultiProvider, Infoview, MasterData Infoobject.
    Please, Can anyone suggest a solution
    Thanks,
    Siva
    Edited by: siva@chinni on Apr 25, 2010 4:45 PM

    Hi,
    Yes we can create WebI on the top of SAP Objects - InfoCube, DSO, Characteristics etc...
    But we have to keep in mind that for WebI we must create Universe.
    When we create universe we make direct connection with SAP Objects but we get less functionality - such Calculated Key Figures, Restricted Key Figures, formulas etc. Now you have to achieve all these missing components at Universe Level and at WebI level.
    If you are creating your universe on the top of DSO and InfoObject then make sure they set for reporting.
    There are some online documentation which tells that what functionality you can achieve.
    Check the following document to have a bird's eye view.
    [http://www.sdn.sap.com/irj/boc/go/portal/prtroot/docs/library/uuid/100369a7-033e-2c10-94a4-f254f8578153?quicklink=index&overridelayout=true]
    There is another document in PPT which I could  not find online. It is very helpful document. It is:
    II. SAP BusinessObjects BI Solutions XI 3.1 and SAP NetWeaver BW 7 Current risks, approach, and mitigating strategies for Client Partners, License Sales, and Consulting Delivery Managers
    Partner Enablement Seminar
    Regards,
    Bashir Awan

  • How to build a report in webi XIr2 using stored procedure

    Post Author: vijay123
    CA Forum: WebIntelligence Reporting
    hi,
    Is anybody can help me out how to creat a report using stored procedure in webiXir2
    thanks
    vijay

    Post Author: amr_foci
    CA Forum: WebIntelligence Reporting
    this has been posted twice.. i think

  • Crystal Report with Optional Parameters from Stored Procedure

    I have a client who created a Crystal Report. This report is linked to a Stored Procedure which allows for input on two criteria. Both of these critera are static values. However, the second of these parameters is setup to allow the user to enter up to 20 values. For example, the Stored Procedure needs the CARDCODE, and a set of DOCUMENTS. So the parameters/prompts would look like this...
    BP CardCode:
    Document1:
    Document2:
    Document3:
    ...etc...
    The report will just display basic document information for those documents that were entered.
    With 8.8, these parameters were changed to be REQUIRED.... not OPTIONAL. According to SAP note 1500777, this is a known bug and will be fixed in future versions. This note also states to change the criteria for the filter. However, when using a Stored Procedure, this does not appear to be an option, as the selection is defined by the data connection (and the parameters defined in the SP).
    Am I missing something? Is there a way to make the suggetion in the above note work with my Stored Procedure?
    Or, is there another way to make these parameters optional? (Do I need to change the SP?)
    Thanks!
    ~ terry.

    I have a client who created a Crystal Report. This report is linked to a Stored Procedure which allows for input on two criteria. Both of these critera are static values. However, the second of these parameters is setup to allow the user to enter up to 20 values. For example, the Stored Procedure needs the CARDCODE, and a set of DOCUMENTS. So the parameters/prompts would look like this...
    BP CardCode:
    Document1:
    Document2:
    Document3:
    ...etc...
    The report will just display basic document information for those documents that were entered.
    With 8.8, these parameters were changed to be REQUIRED.... not OPTIONAL. According to SAP note 1500777, this is a known bug and will be fixed in future versions. This note also states to change the criteria for the filter. However, when using a Stored Procedure, this does not appear to be an option, as the selection is defined by the data connection (and the parameters defined in the SP).
    Am I missing something? Is there a way to make the suggetion in the above note work with my Stored Procedure?
    Or, is there another way to make these parameters optional? (Do I need to change the SP?)
    Thanks!
    ~ terry.

  • How to create a report with dynamic columns

    Hi all,
    I am using Apex 4.0 with Oracle 10g
    I am creating a report and I need to display columns dynamically based on the item values.
    example:
    I have a table employee with columns name, designation, sal
    In the report page i have a select list with designations and when I select a designation from the select list,
    I need to display the names of the employees horizontally,
    like each name as a new column in the report with that particular designation. and same has to continue when I select different designations.
    Can some one help me how we can do that.
    I appreciate your answer
    Thanks,
    Rik

    Essentially you want to write a pl/sql function which returns a varchar2 string. The contents of the string must be a valid sql statement.
    Once you have done this, you need to add a report region as type sql report and you will have the option of writing it as a query or as a function returning query. Choose function returning query and enter in the function call.
    Note your function must be valid, and must be executable by your apex parsing schema.
    example:
    create or replace
    function test_report(   p1_tablename       in varchar2)
    return varchar2
    is
    v_query varchar2(4000);
    begin
    v_query  :=
    'SELECT * from '||p_tablename;
    return v_query;
    end test_report;Edited by: Keith Jamieson on Aug 15, 2011 4:50 PM

  • How to create a report with selection screen that can run in background

    Sorry to ask these basic questions but I am knew to ABAP Programming.
    To keep it simply, I am attempting to create a report that has a simple parameter driven selections screen with one field.  That field takes in a folder path from the user.  The user executes the report.  The report creates a simply BDC that goes into SE16, gathers data from a table, and exports the results to a text file using the folder path provided.  I created a variant for the folder path field in the selection screen hoping to use it while executing the report in the background.  The report is not exporting the file as it did when run in the foreground for some reason.
    I am wondering what event is triggered when a report is executed in the background.  In the foreground (or when I execute the program via SE38->Execute->With Variant) the user needs to execute the program by hitting the execute button once the variant has populated the folder path field.  It works then, so I am trying to get the same to work in the background.  I am thinking I didn't put the program together correctly to accommodate the running in the background.  How can you create a report that can accept user input via variant into a selection screen and then run in the background?
    Please, any information would be greatly appreciated.
    Thanks you all for reading this!!!

    Ok, finally I understand what you're doing. Initially you lost me with the SE16 reference...
    Not sure what you're trying to achieve overall, but apart from the fact that you cannot export/download a file to a user's PC via background job (unless you have a mapped network share on the server or something like an FTP server on the user's PC, but both are pretty hypothetical scenarios and unlikely to occur).
    Also, the BDC approach to get data via SE16 is pretty awkward. Note that SE16 is guarded by some authorization checks and often users won't have access in production (which might not matter if you intend to always run your program in background via dedicated batch user). However, I have no clue why you wouldn't want to use [open SQL|http://help.sap.com/abapdocu_70/en/ABENOPEN_SQL_READING.htm] to read the data. You could then save it on the application server or if you really have to get it to the user you can consider e-mailing the file (extracts should be compressed before sending). For the latter you'll find plenty of references here, basically it's the [business communication services|http://help.sap.com/saphelp_nw2004s/helpdata/en/2d/1c5d3aebba4c38e10000000a114084/frameset.htm] that you'd need to look at.

  • How to create a report with dynamic no of columns

    Hi All,
    we have a report with 6 columns.
    and its been access by 10-20 people.
    the user dont want to have a fix report with 6 columns rather they want to have a flexibility to select the columns from the report they want to see.
    i.e. user one one time wasnt to see only one columns
    another time he want to see only column 2 and 4 of the report.
    its like there can be a multiple select option from where he can select the columns in the existing report and then see the same report with only that much column.
    Please tell me how to implement it.

    Abhip i thin you didnt get the problem.
    there is s exeiting report with 6 column
    Currently when i logging to OBIEE and see that report
    i will be getting report with 6 column
    but now i want a flexibility of selecting only 2 or 3 or 1 or 4 or 5 as i wish columns from this report and see the result only for that
    so is there by any chance i can have a check box for each column which i can check in dashborad to select that column
    and show the result were as by default it will show the report with 6 column.
    Thanks

  • Crystal Report Source is MS SQL Stored Procedure Causes Login Popup

    My environment is this:  Visual Studio 2010 with CRforVS_13_0_9 installed.  MS SQL Server is source for all report data.  I use three different databases for all my reports.
    I have a number of working CR reports that work fine in IDE and at runtime.  However, one report works in IDE report designer Main Report Preview but does not work at runtime.  Instead, it pops up the Database Login dialog box.  This particular report is the only one that I have that uses a Stored Procedure for report source data.  The following code is used for all reports.  Can someone please help me to identify what is causing this anomaly?
         ' _Options contains parameter name and value pairs, if any
         Dim oReport As New ReportDocument()
         Dim FullReportName = "MA_CustomerUsage"
         oReport.Load(FullReportName, OpenReportMethod.OpenReportByDefault)
         DoCRLogin(oReport)
         If _Options.ParameterList IsNot Nothing Then ImplementCRParameters(oReport)
         With CrystalReportViewer
              .SelectionFormula = _SelectionFormula
              .ReportSource = oReport
              .Zoom(zoomPageWidth)
              .ShowParameterPanelButton = False
              .ToolPanelView = ToolPanelViewType.None
         End With
         Private Sub DoCRLogin(ByVal oRpt As ReportDocument)
                Dim oCRDb As Database = oRpt.Database
                Dim oCRTables As Tables = oCRDb.Tables
                Dim oCRTableLogonInfo As CrystalDecisions.Shared.TableLogOnInfo
                Dim DatabaseName = oCRTables(0).LogOnInfo.ConnectionInfo.DatabaseName
                Dim oCRConnectionInfo As New CrystalDecisions.Shared.ConnectionInfo() _
                    With {.DatabaseName = ScanInvenConStrSetting("Initial Catalog=", DatabaseName),
                          .ServerName = ScanInvenConStrSetting("Data Source=", DatabaseName),
                          .IntegratedSecurity = True}
                For Each oCRTable As Table In oCRTables
                    oCRConnectionInfo.DatabaseName = oCRTable.LogOnInfo.ConnectionInfo.DatabaseName
                    oCRTableLogonInfo = oCRTable.LogOnInfo
                    oCRTableLogonInfo.ConnectionInfo = oCRConnectionInfo
                    oCRTable.ApplyLogOnInfo(oCRTableLogonInfo)
                Next
         End Sub
         Private Sub ImplementCRParameters(ByRef oReport As ReportDocument)
                Dim oparamFields = New ParameterValues
                Dim oFieldDefs = oReport.DataDefinition.ParameterFields
                For Each CRParameter In _Options.ParameterList
                    Dim oFieldDef = oFieldDefs("@" & CRParameter.Name)
                    Dim oDiscrete As New ParameterDiscreteValue()
                    oDiscrete.Value = CRParameter.Value.ToString
                    oparamFields.Add(oDiscrete)
                    oFieldDef.ApplyCurrentValues(oparamFields)
                Next
         End Sub
         Private Function ScanInvenConStrSetting(ByVal Src As String, ByVal DBName As String) As String
                Dim MyDB As String = String.Empty
                Select Case DBName.ToUpper
                    Case "Database1".ToUpper
                        MyDB = Global.My.Settings.Database1ConnectionString
                    Case "Database2".ToUpper
                        MyDB = Global.My.Settings.DatabaseConnectionString
                    Case "Database3".ToUpper
                        MyDB = Global.My.Settings.Database3ConnectionString
                End Select
                Dim ndx1 As Integer = InStr(MyDB, Src, CompareMethod.Text) + Src.Length
                Dim ndx2 As Integer = InStr(ndx1, MyDB, ";", CompareMethod.Text)
                If ndx2 = 0 Then ndx2 = MyDB.Length
                ScanInvenConStrSetting = Mid(MyDB, ndx1, ndx2 - ndx1)
         End Function

    Check what else is different with the report:
    1) Connection type (ODBC vs. OLEDB, vs. Native, etc)
    2) Check for subreports
    3) Check that the report uses the SQL Native 10 Driver
    Enable the report options "Verify on 1st refresh" and "Verify stored procedure on 1st refresh".
    Comment out the db logon code as well as the parameter code and let the report prompt. Does that work?
    If it does, add the db logon code but leave the param code commented out. Does that work?
    - Ludek
    Senior Support Engineer AGS Product Support, Global Support Center Canada
    Follow us on Twitter

  • How to create crystal report 2008 with running totals?

    i want to create a report with running totals as follows:
    Balance B/F 1000.00
    Invoices     Receipts    Running B/ce
    100                            1100
                     500             600
                     500             100
    300                              400
                     400                0
    The B/F field is passed as a Parameter.

    Hi  panayiotis,
    In order to create a running total you need to have absolute clarity on the following:
    (i)Whether the running total be set on change of field/record/group.
    (ii)Whether the running total be set on change of record/group OR never.
    Make the appropriate choice.
    Apply this to the field to summarize and type of summary in Running Total Pane.
    Thanks,
    Amogh.

  • How to create a report based on a DataSet programatically

    I'm working on a CR 2008 Add-in.
    Usage of this add-in is: Let the user choose from a list of predefined datasets, and create a totally empty report with this dataset attached to is. So the user can create a report based on this dataset.
    I have a dataset in memory, and want to create a new report in cr2008.
    The new report is a blank report (with no connection information).
    If I set the ReportDocument.SetDataSource(Dataset dataSet) property, I get the error:
    The report has no tables.
    So I must programmatically define the table definition in my blank report.
    I found the following article: https://boc.sdn.sap.com/node/869, and came up with something like this:
    internal class NewReportWorker : Worker
          public NewReportWorker(string reportFileName)
             : base(reportFileName)
    public override void Process()
             DatabaseController databaseController = ClientDoc.DatabaseController;
             Table table = new Table();
             string tabelName = "Table140";
             table.Name = tabelName;
             table.Alias = tabelName;
             table.QualifiedName = tabelName;
             table.Description = tabelName;
             var fields = new Fields();
             var dbField = new DBField();
             var fieldName = "ID";
             dbField.Description = fieldName;
             dbField.HeadingText = fieldName;
             dbField.Name = fieldName;
             dbField.Type = CrFieldValueTypeEnum.crFieldValueTypeInt64sField;
             fields.Add(dbField);
             dbField = new DBField();
             fieldName = "IDLEGITIMATIEBEWIJS";
             dbField.Description = fieldName;
             dbField.HeadingText = fieldName;
             dbField.Name = fieldName;
             dbField.Type = CrFieldValueTypeEnum.crFieldValueTypeInt64sField;
             fields.Add(dbField);
             // More code for more tables to add.
             table.DataFields = fields;
             //CrystalDecisions.ReportAppServer.DataDefModel.ConnectionInfo info =
             //   new CrystalDecisions.ReportAppServer.DataDefModel.ConnectionInfo();
             //info.Attributes.Add("Databse DLL", "xxx.dll");
             //table.ConnectionInfo = info;
             // Here an error occurs.
             databaseController.AddTable(table, null);
             ReportDoc.SetDataSource( [MyFilledDataSet] );
             //object path = @"d:\logfiles\";
             //ClientDoc.SaveAs("test.rpt", ref path, 0);
    The object ClientDoc referes to a ISCDReportClientDocument in a base class:
       internal abstract class Worker
          private ReportDocument _ReportDoc;
          private ISCDReportClientDocument _ClientDoc;
          private string _ReportFileName;
          public Worker(string reportFileName)
             _ReportFileName = reportFileName;
             _ReportDoc = new ReportDocument();
             // Load the report from file path passed by the designer.
             _ReportDoc.Load(reportFileName);
             // Create a RAS Document through In-Proc RAS through the RPTDoc.
             _ClientDoc = _ReportDoc.ReportClientDocument;
          public string ReportFileName
             get
                return _ReportFileName;
          public ReportDocument ReportDoc
             get
                return _ReportDoc;
          public ISCDReportClientDocument ClientDoc
             get
                return _ClientDoc;
    But I get an "Unspecified error" on the line databaseController.AddTable(table, null);
    What am i doing wrong? Or is there another way to create a new report based on a DataSet in C# code?

    Hi,
    Have a look at the snippet code below written for version 9 that you might accommodate to CR 2008, it demonstrates how to create a report based on a DataSet programmatically.
    //=========================================================================
    +           * the following two string values can be modified to reflect your system+
    +          ************************************************************************************************/+
    +          string mdb_path = "C:
    program files
    crystal decisions
    crystal reports 9
    samples
    en
    databases
    xtreme.mdb";    // path to xtreme.mdb file+
    +          string xsd_path = "C:
    Crystal
    rasnet
    ras9_csharp_win_datasetreport
    customer.xsd";  // path to customer schema file+
    +          // Dataset+
    +          OleDbConnection m_connection;                         // ado.net connection+
    +          OleDbDataAdapter m_adapter;                              // ado.net adapter+
    +          System.Data.DataSet m_dataset;                         // ado.net dataset+
    +          // CR variables+
    +          ReportClientDocument m_crReportDocument;          // report client document+
    +          Field m_crFieldCustomer;+
    +          Field m_crFieldCountry;+
    +          void CreateData()+
    +          {+
    +               // Create OLEDB connection+
    +               m_connection = new OleDbConnection();+
    +               m_connection.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + mdb_path;+
    +               // Create Data Adapter+
    +               m_adapter = new OleDbDataAdapter("select * from Customer where Country='Canada'", m_connection);+
    +               // create dataset and fill+
    +               m_dataset = new System.Data.DataSet();+
    +               m_adapter.Fill(m_dataset, "Customer");+
    +               // create a schema file+
    +               m_dataset.WriteXmlSchema(xsd_path);+
    +          }+
    +          // Adds a DataSource using dataset. Since this does not require intermediate schema file, this method+
    +          // will work in a distributed environment where you have IIS box on server A and RAS Server on server B.+
    +          void AddDataSourceUsingDataSet(+
    +               ReportClientDocument rcDoc,          // report client document+
    +               System.Data.DataSet data)          // dataset+
    +          {+
    +               // add a datasource+
    +               DataSetConverter.AddDataSource(rcDoc, data);+
    +          }+
    +          // Adds a DataSource using a physical schema file. This method require you to have schema file in RAS Server+
    +          // box (NOT ON SDK BOX). In distributed environment where you have IIS on server A and RAS on server B,+
    +          // and you execute CreateData above, schema file is created in IIS box, and this method will fail, because+
    +          // RAS server cannot see that schema file on its local machine. In such environment, you must use method+
    +          // above.+
    +          void AddDataSourceUsingSchemaFile(+
    +               ReportClientDocument rcDoc,          // report client document+
    +               string schema_file_name,          // xml schema file location+
    +               string table_name,                    // table to be added+
    +               System.Data.DataSet data)          // dataset+
    +          {+
    +               PropertyBag crLogonInfo;               // logon info+
    +               PropertyBag crAttributes;               // logon attributes+
    +               ConnectionInfo crConnectionInfo;     // connection info+
    +               CrystalDecisions.ReportAppServer.DataDefModel.Table crTable;+
    +               // database table+
    +               // create logon property+
    +               crLogonInfo = new PropertyBag();+
    +               crLogonInfo["XML File Path"] = schema_file_name;+
    +               // create logon attributes+
    +               crAttributes = new PropertyBag();+
    +               crAttributes["Database DLL"] = "crdb_adoplus.dll";+
    +               crAttributes["QE_DatabaseType"] = "ADO.NET (XML)";+
    +               crAttributes["QE_ServerDescription"] = "NewDataSet";+
    +               crAttributes["QE_SQLDB"] = true;+
    +               crAttributes["QE_LogonProperties"] = crLogonInfo;+
    +               // create connection info+
    +               crConnectionInfo = new ConnectionInfo();+
    +               crConnectionInfo.Kind = CrConnectionInfoKindEnum.crConnectionInfoKindCRQE;+
    +               crConnectionInfo.Attributes = crAttributes;+
    +               // create a table+
    +               crTable = new CrystalDecisions.ReportAppServer.DataDefModel.Table();+
    +               crTable.ConnectionInfo = crConnectionInfo;+
    +               crTable.Name = table_name;+
    +               crTable.Alias = table_name;+
    +               // add a table+
    +               rcDoc.DatabaseController.AddTable(crTable, null);+
    +               // pass dataset+
    +               rcDoc.DatabaseController.SetDataSource(DataSetConverter.Convert(data), table_name, table_name);+
    +          }+
    +          void CreateReport()+
    +          {+
    +               int iField;+
    +               // create ado.net dataset+
    +               CreateData();+
    +               // create report client document+
    +               m_crReportDocument = new ReportClientDocument();+
    +               m_crReportDocument.ReportAppServer = "127.0.0.1";+
    +               // new report document+
    +               m_crReportDocument.New();+
    +               // add a datasource using a schema file+
    +               // note that if you have distributed environment, you should use AddDataSourceUsingDataSet method instead.+
    +               // for more information, refer to comments on these methods.+
    +               AddDataSourceUsingSchemaFile(m_crReportDocument, xsd_path, "Customer", m_dataset);+
    +                              +
    +               // get Customer Name and Country fields+
    +               iField = m_crReportDocument.Database.Tables[0].DataFields.Find("Customer Name", CrFieldDisplayNameTypeEnum.crFieldDisplayNameName, CeLocale.ceLocaleUserDefault);+
    +               m_crFieldCustomer = (Field)m_crReportDocument.Database.Tables[0].DataFields[iField];+
    +               iField = m_crReportDocument.Database.Tables[0].DataFields.Find("Country", CrFieldDisplayNameTypeEnum.crFieldDisplayNameName, CeLocale.ceLocaleUserDefault);+
    +               m_crFieldCountry = (Field)m_crReportDocument.Database.Tables[0].DataFields[iField];+
    +               // add Customer Name and Country fields+
    +               m_crReportDocument.DataDefController.ResultFieldController.Add(-1, m_crFieldCustomer);+
    +               m_crReportDocument.DataDefController.ResultFieldController.Add(-1, m_crFieldCountry);+
    +               // view report+
    +               crystalReportViewer1.ReportSource = m_crReportDocument;+
    +          }+
    +          public Form1()+
    +          {+
    +               //+
    +               // Required for Windows Form Designer support+
    +               //+
    +               InitializeComponent();+
    +               // Create Report+
    +               CreateReport();+
    +               //+
    +               // TODO: Add any constructor code after InitializeComponent call+
    +               //+
    +          }+//=========================================================================

  • How to create a report in Form line Style and can display Image field?

    Hi,
    In Report builder 10g, I would like to create a Report with Form Line Style and this report included a Image field.
    I can choose this Style only when Select Report type is Paper Layout. Because, If I choose Create both Web & Paper Layout or Create Web Layout only then in the next Style tab 03 option Form, Form letter and Mailing Label be Disabled.
    But in Paper Layout, my report can not display Image field.
    I tried with Web layout and all the other Styles (Except 03 mentioned be Disabled) then all Styles are displayed Imager field OK.
    How to create a report in Form line Style and can display Image field?
    I was change File Format property of my Image field from text to Image already in Property Inspector. But report only showed MM for my Image field.
    Thanks & regards,
    BACH
    Message was edited by:
    bachnp

    Here you go..Just follow these steps blindly and you are done.
    1) Create a year prompt with presentation variable as pv_year
    2) Create a report say Mid report with year column selected 3 times
    - Put a filter of pv_year presentation variable on first year column with a default value say @{pv_year}{2008}
    - Rename the second time column say YEAR+1 and change the fx to CAST(TIME_DIM."YEAR" AS INT)+1
    - Rename the second time column say YEAR-1 and change the fx to CAST(TIME_DIM."YEAR" AS INT)-1
    Now when you will run Mid Report, this will give you a records with value as 2008 2009 2007
    3) Create your main report with criteria as Year and Measure col
    - Change the fx for year column as CAST(TIME_DIM."YEAR" AS INT)
    - Now put a filter on year column with Filter based on results of another request and select these:
    Relationship = greater than or equal to any
    Saved Request = Browse Mid Report
    Use values in Column = YEAR-1
    - Again,put a filter on year column with Filter based on results of another request and select these:
    Relationship = less than or equal to any
    Saved Request = Browse Mid Report (incase it doesn't allow you to select then select any other request first and then select Mid Report)
    Use values in Column = YEAR+1
    This will select Year > = 2007 AND Year < = 2009. Hence the results will be for year 2007,2008,2009
    This will 100% work...
    http://i56.tinypic.com/wqosgw.jpg
    Cheers

Maybe you are looking for