Deski report which is using a Store Procedure - Redirecting connection

I have a DeskI report which is using a Store Procedure as its data provider.
This is an Oracle based Store Procedure.
Where can i see wich connection (connections listed in CMC) is used in DeskI report ?
How can i redirect one connection to point to another on report?
Thanks
Georg

Marina,
The strategy for displaying LOV via Infoview needs to be different than what you've set up via DeskI.  The main difference is that when using a client/server program like DeskI, the LOV is cached to the client, thus producing a list more quickly, however, over the web, the web client does not cache LOV as readily.  To "solve" this "problem" you need to go back to your universe and trace what is happening.  If the LOV is getting generated through an essential "select distinct" on the fact/dimension table, and that table has over a million rows, then it will take some time to generate the list (and thus will timeout).  A different strategy to take is to maintain a "backend lookup" table that the LOV will point to instead.  The backend lookup table will contain the unique instances of the column getting scanned and thus when the LOV points to the new lookup table the response will be quicker versus the old method.  Care must be taken each time new data is loaded to WH to ensure that any new unique values from the "home" table/column are also placed in the backend lookup table.
thanks,
John

Similar Messages

  • How to find the list of Queries/Reports which are using Exceptional Aggregation in SAP BI?

    Hi All,
    We are interested to know how to find the list of Queries/ Reports which are using Exceptional aggregation in SAP BI.
    Please let us know is there any table's to check the list of reports using Exceptional Aggregation in SAP BI.

    Hi,
    Here you go..
    1) Go to table RSZCALC and get list of ELTUID where AGGREXC is not INITIAL and AGGRCHA is not initial; now you get only exception aggregation set based on some chars. Also you can further add STEPNR = 1 since your intention is just to get query name , not the calculation details; this will reduce number of entries to lookup and save DB time for next steps.
    Here you will get list of exception aggregation UUID numbers from which you can get properties from RSZELTDIR.
    2) Pass list of RSZCALC-ELTUID to table RSZELTXREF - TELTUID and get list of RSZELTXREF -SELTUID - this table stores query to it's elements maping kind.
    3) Now again pass RSZELTXREF - SELTUID into same table but into different field RSZELTZREF - TELTUID and get RSZELTXREF - SELTUID
    This step you get query reference sheet or column or query general UUID for next step.
    4) Pass list of RSZELTXREF - SELTUID into RSZELTDIR - ELTUID with DEFTP as 'REP'. Now you get list of query names in RSZELTDIR - MAPNAME and description in TXTLG.
    Note: you can also get the reference chars used for exception aggregation from RSZCALC - AGGRCHA field.
    Hope this helps.
    Please keep in mind, it might take more time depends on how many query elements you have in the system...
    Comments added for better DB performance by: Arun Thangaraj

  • Translating a report which is using excel template

    Hello,
    We are working on a BI report using excel template. I've checked the report designer's user guide and it says template translation is a feature only supporting RTF and BI publisher layout template.
    I am wondering what is the best practice for translating a report which is using excel template.
    So far I have a alternative which is making all labels in my template dynamically getting values from HCM lookups , but this solution is time consuming.
    Could anybody help here?
    Regards
    Buyun

    Did you try reading sap help files which clearly explains about Managing templates, selecting templates, creating templates, deleting templates.
    [Managing Templates in ALV|http://help.sap.com/saphelp_apo/helpdata/en/d4/a2a138198daa2fe10000009b38f842/content.htm]
    This will provide you a clear picturesque on handling templates in ALV.
    Edited by: K.Manas on Dec 22, 2010 9:13 AM

  • How to find reports which are using sales tables

    Hi Guys,
    we are using OBIEE 10g version.Here i need to identify the the reports which are using sales tables.
    Table names are given but how to find which report is using these tables.Is there any method to find
    or we have to check all reports manually?
    Could any one pls suggest me here!
    Regards,
    sk
    Edited by: 912736 on Jun 8, 2012 1:24 PM

    Hi SK,
    You can run a report from catalog manager that willl give you all answers requests and the subject area columns in use, you can map these back to the sales tables either manually or by linking (vlookup) to an RPD report that you can run from the Admin tool.
    The Usage Tracking method is pretty good but you will have to match up the reports using the Logical SQL.
    I'd do both methods and cross ref your results to ensure nothing slips the net.
    Regards
    Alastair

  • Need help on processing XML doc using Java store procedure

    I am currently working on project to read, parse XML document and store data in XML document into database columns. I use JAVA API-OracleXMLSave in my java store procedure to do it, which use URL of XML doc to read, parse doc and store the data to database columns. My java store procedure works fine when XML doc is saved in server, but got "ORA-29532: Java call terminated by uncaught Java exception:
    oracle.xml.sql.OracleXMLSQLException: No such file or directory" if XML doc is in client's PC instead of in server. I think the problem comes from the URL that created using OracleXMLSave
    --createURL(fileName) based on the filename. what will be the filename if XML document located in Client PC like C:\myprojects\xmldoc.xml?
    Thank you in advance if anyone can give some hints.

    I am currently working on project to read, parse XML document and store data in XML document into database columns. I use JAVA API-OracleXMLSave in my java store procedure to do it, which use URL of XML doc to read, parse doc and store the data to database columns. My java store procedure works fine when XML doc is saved in server, but got "ORA-29532: Java call terminated by uncaught Java exception:
    oracle.xml.sql.OracleXMLSQLException: No such file or directory" if XML doc is in client's PC instead of in server. I think the problem comes from the URL that created using OracleXMLSave
    --createURL(fileName) based on the filename. what will be the filename if XML document located in Client PC like C:\myprojects\xmldoc.xml?
    Thank you in advance if anyone can give some hints.

  • Create oData service using oracle Store procedure

    Hello Experts,
    I need to create oData service from oracle store procedure,
    what are the steps to do it.
    We are using SMP Integration gateway.
    Please Suggest.
    Regards
    Manish

    Hello Experts,
    Here is my code to join 2 tables , in debug it does not give error, but it gives on only one table output not merged output.
    Please suggest.
    function processRequestSQL(message) {
      //Import statements
      importPackage(com.sap.gateway.ip.core.customdev.util);
      importPackage(java.util);
      importPackage(org.apache.olingo.odata2.api.edm);
      importPackage(com.sap.gateway.core.ip.component.commons);
      importPackage(org.apache.olingo.odata2.api.uri);
      importPackage(com.sap.gateway.ip.core.customdev.logging);
      //Get the SQL statement contained in message body
      var sqlStatement = message.getBody();
      var uriInfo = message.getHeaders().get(ODataExchangeHeaderProperty.UriInfo.toString());
      var map = new HashMap();
      map = uriInfo.getCustomQueryOptions();
      //Create the query and sub query
      var JOIN_WO_WHERE = "INNER JOIN ZONE ON AREA.AREA_ID = ZONE.AREA_ID ";
      var WHERE = " WHERE ";
      var JOIN = " INNER JOIN ZONE ON AREA.AREA_ID = ZONE.AREA_ID ";
      //Modify the SQL statement
      var modifiedSqlStatement = "";
      var entitySet = uriInfo.getStartEntitySet();
      var odataMethod = message.getHeaders().get(ODataExchangeHeaderProperty.ODataMethod.toString());
      modifiedSqlStatement += sqlStatement;
      if (odataMethod.toString() == "GET_FEED") {
      entitySetName = entitySet.getName();
      if (entitySetName == "AREA") {
      if (sqlStatement.indexOf("WHERE") != -1
      || sqlStatement.indexOf("where") != -1) {
      modifiedSqlStatement += JOIN_WO_WHERE;
      } else {
      // modifiedSqlStatement += WHERE;
      modifiedSqlStatement += JOIN;
      //Set the message body back with the modified SQL statement
      message.setBody(modifiedSqlStatement);
      //Logger
      log.logErrors(LogMessage.TechnicalError, "This is first log");
      //Set the message body back with the modified SQL statement
      message.setBody(modifiedSqlStatement);
      //Logger
      log.logErrors(LogMessage.TechnicalError, "This is first log");
    -------------------End Sample Implementation---------------------------------------
      return message;

  • Crystal reports, Push method using a stored Procedure

    Could someone 'PLEASE' help!  I am trying to create and populate a Crystal Report via a stored procedure in a vb.net  asp.net web site..  I have created a dataset1.xsd and I have dragged my Stored_Proc onto the dataset.  I then use the 'DataBase Expert' and select ADO.net Datasets and select my storedProcedure from dataset1 as my selected dataset.  After that I just drag the fields onto my report.  Then via ado.net shown below I populate the dataset.  I can loop through the dataset and it does get populated correctly from the stored_proc.  yet when the report pops up in a web browser the fields are empty.  I have found that this method works fine if I drag an actual table from my database onto my dataset, but I need to populate the dataset via joins and a parameter. 
    Could someone please tell me what I'm missing!
    ***********Code Sample**************
    Dim conStr As String = System.Configuration.ConfigurationManager.AppSettings("adoConnString")
            Dim sqlConnection As New SqlConnection(conStr)
            Dim Command As SqlCommand = New SqlCommand()
            Command.Connection = sqlConnection
            Command.CommandText = "usp_GetInquiryByID"
            Command.CommandType = CommandType.StoredProcedure
            Dim Parameter As SqlParameter = New SqlParameter("@intInqID", 108)
            Parameter.Direction = ParameterDirection.Input
            Parameter.DbType = DbType.Int16
            Command.Parameters.Add(Parameter)
            Dim Adapter As SqlDataAdapter = New SqlDataAdapter(Command)
            Dim ds As New DataSet1
            Adapter.Fill(ds, "Inquirys")
            CrystalReportSource1.ReportDocument.SetDataSource(ds)
            CrystalReportSource1.DataBind()
    Duckkiller53

    Hello Scott,
    It'll be difficult to migrate CR 10 reports to SQL Server 2005, since it's not a supported combination:
    [http://resources.businessobjects.com/support/communitycs/TechnicalPapers/cr10_supported_platforms.pdf|http://resources.businessobjects.com/support/communitycs/TechnicalPapers/cr10_supported_platforms.pdf]
    Also, CR 10 will be going out of support at the end of the year, so the supported platform list will not be expanded. 
    It's not a recommended combination for production use.
    Sincerely,
    Ted Ueda

  • Problem Using Java Store Procedure (java class) to connect to sybase

    Hi, I'm trying to use a java class to obtain some data from another databse (SYBASE) in another server.. here are the code
    package pkg;
    import com.sybase.jdbcx.SybDriver;
    import java.sql.Connection;
    import java.sql.Driver;
    import java.sql.DriverManager;
    import java.sql.ResultSet;
    import java.sql.SQLException;
    import java.sql.Statement;
    public class clsTest
    public clsTest()
    public static void main(String[] args)
    testConn("");
    private static void testConn()
    Connection _con= null;
    String host = "XXX";
    String port= "XXX";
    String url = host + ":" + port;
    Statement _stmt= null;
    int timeout = 10;
    boolean needsReconnect = true;
    SybDriver sybDriver = null;
    try
    Class c = Class.forName("com.sybase.jdbc3.jdbc.SybDriver");
    sybDriver = (SybDriver) c.newInstance();
    DriverManager.registerDriver((Driver) sybDriver);
    catch (Exception e)
    System.err.print("Unable to load the Sybase JDBC driver. "
    + e.toString());
    e.printStackTrace(System.out);
    if (needsReconnect)
    try
    if (_con != null)
    _con.close();
    url="jdbc:sybase:Tds:BDSERVER:PORT/BD";
    System.err.println("Trying to connect to: " + url);
    DriverManager.setLoginTimeout(timeout);
    con = DriverManager.getConnection(url,"usrquery","mundial");
    _stmt = _con.createStatement();
    boolean results = _stmt.execute("select count(*) from TABLA");
    if (results)
    ResultSet rs= _stmt.getResultSet();
    rs.next();
    System.err.println(rs.getString(1));
    _con.close();
    catch (SQLException sqle)
    System.err.println(sqle.toString() + " Restart connection.");
    return;
    catch (Exception e)
    e.printStackTrace();
    System.err.println("Unexpected Exception: " + e.toString());
    return;
    When I run the proyect using the IDE JDeveloper I have no problem, but when I make de use loadjava I receive these error message
    creating : resource META-INF/MANIFEST.MF
    loading : resource META-INF/MANIFEST.MF
    Error while creating resource META-INF/MANIFEST.MF
    ORA-29547: Java system class not available: oracle/aurora/rdbms/Compiler
    creating : class pkg/clsTest
    loading : class pkg/clsTest
    creating : resource jconn3.jar
    loading : resource jconn3.jar
    Error while creating resource jconn3.jar
    ORA-29547: Java system class not available: oracle/aurora/rdbms/Compiler
    granting : execute on class pkg/clsTest to public
    Error while computing shortname of pkg/clsSybaseLAE
    ORA-06550: line 1, column 13:
    PLS-00201: identifier 'DBMS_JAVA.SHORTNAME' must be declared
    ORA-06550: line 1, column 7:
    PL/SQL: Statement ignored
    resolving: class pkg/clsTest
    errors : class pkg/clsTest
    ORA-29521: referenced name java/lang/StringBuffer could not be found
    ORA-29521: referenced name java/lang/Class could not be found
    ORA-29521: referenced name com/sybase/jdbcx/SybDriver could not be found
    ORA-29521: referenced name java/sql/Driver could not be found
    ORA-29521: referenced name java/sql/DriverManager could not be found
    ORA-29521: referenced name java/lang/System could not be found
    ORA-29521: referenced name java/lang/Exception could not be found
    ORA-29521: referenced name java/io/PrintStream could not be found
    ORA-29521: referenced name java/sql/Connection could not be found
    ORA-29521: referenced name java/sql/Statement could not be found
    ORA-29521: referenced name java/sql/ResultSet could not be found
    ORA-29521: referenced name java/sql/SQLException could not be found
    ORA-29521: referenced name java/lang/Object could not be found
    ORA-29521: referenced name java/lang/String could not be found
    synonym : pkg/clsTest
    The following operations failed
    resource META-INF/MANIFEST.MF: creation
    class pkg/clsTest: resolution
    resource jconn3.jar: creation
    exiting : Failures occurred during processing
    Please some one help me!.. Thank's a lot

    Thanks, you was right, but I have another problem
    The following operations failed
    class cl/bcch/clsSyBase: resolution
    source cl/bcch/clsSyBase: creation (createFailed)
    oracle.aurora.server.tools.loadjava.ToolsException: Failures occurred during processing
         at oracle.aurora.server.tools.loadjava.LoadJava.process(LoadJava.java:1057)
         at oracle.jdeveloper.deploy.tools.OracleLoadjava.deploy(OracleLoadjava.java:124)
         at oracle.jdeveloper.deploy.tools.OracleLoadjava.deploy(OracleLoadjava.java:53)
         at oracle.jdevimpl.deploy.OracleDeployer.deploy(OracleDeployer.java:98)
         at oracle.jdevimpl.deploy.StoredProcHandler.doDeploy(StoredProcHandler.java:503)
         at oracle.jdevimpl.deploy.StoredProcHandler.doDeploy(StoredProcHandler.java:381)
         at oracle.jdevimpl.deploy.StoredProcHandler.doDeploy(StoredProcHandler.java:300)
         at oracle.jdevimpl.deploy.StoredProcProfileDt$Action$1.run(StoredProcProfileDt.java:598)
    #### Export incomplete. #### 09-01-2008 02:28:39 PM
    *** Note ***
    One possibility for the database export failure is that the target Database may not support JDK version 1.4. Updating your Project Properties compiler Source & Target to an earlier release could fix this problem.
    ************

  • MAIL USING PL/SQL PROCEDURE TCP CONNECTION ERROR

    I was trying to send an e-mail using the demo-mail helper package which uses UTL_SMTP package and on execution, it gives the following TCP Connection error. Is it some something to do with mail configuration?
    This is the sample code I was trying to run.
    demo_mail.mail( sender => 'Me <[email protected]>',
    recipients => 'Someone <[email protected]>, ' ||
    '"Another one" <[email protected]>',
    subject => 'Test', message => 'Hi! This is a test.');
    And this is the error I am getting.
    class oracle/plsql/net/TCPConnection does not exist
    at "SYS.UTL_TCP", line 537
    at "SYS.UTL_TCP", line 199
    at "SYS.UTL_SMTP", line 102
    at "SYS.UTL_SMTP", line 121
    at "VNARAYA.DEMO_MAIL", line 159
    at "VNARAYA.DEMO_MAIL", line 119
    at "VNARAYA.DEMO_MAIL", line 105
    at "VNARAYA.SEND_MAIL", line 2
    at line 1

    The Java library needed by UTL_TCP is not created properly. You may just run $ORACLE_HOME/rdbms/admin/initplsj.sql as SYS to install it:
    cd $ORACLE_HOME/rdbms/admin
    sqlplus sys/<sys-password> @initplsj.sql

  • Unable to run Store Procedure based deski report in Infoview

    Hi All,
    I have a Deski report which is created using Store Procedure. I am able to run report in Full Client Deski. But I am unable to run / schedule same report thorough infoview.
    More details about report
    - Report uses 3 store procedures. When I ran report in infovew I get error message as "SP2 Dataprovider did not refresh properly".  -- SP2 is Dataprovider name.
    - Same report I am able to run in Dev environment. After migration to Model, report fails to run in model infoview.
    - I am able to Run report only for 1st. When I refresh and run with same parameter report shows error.
    Any input will be great help.
    Thanks,
    NV

    Hi,
    Could you please test the following solutions to resolve the issue.
    Solution1:
    Test the issue by inserting the following parameter in .SBO file.
    <Parameter Name="Force SQLExecute">Always</Parameter> .
    Solution2
    Just put SET NOCOUNT OFF in the end of the stored procedure SQL.
    If the above doesnu2019t works then please try the following solution.
    Solution3
    Make the new connection from the scratch using ODBC connection and test the issue.
    I hope this will help you.
    Regards,
    Sarbhjeet Kaur

  • Migrating DESKI Reports (Stored Procedures) from 6x to XI 3.1

    I am migrating DESKI reports based off of Stored procedures from a 6x environment to XI 3.1
    I have created a new OLE DB connection pointing to the new SQL server.
    I need to find out how to point my report to the new connection.
    I have seen in that in case of DESKI reports using universes, I can go to Data Manager --> Definition tab and point to my new universe there.
    But in case of stored procedure report, that option is not available.
    Can someone let me know how to go about migrating these reports which are pointing to Stored Procedures.
    Thanks

    Note that I have never done it.
    But I heard you could create a new universe with a derived table. In the SQL of the derived table you can call the stored procedure. The connection of that new universe is your stored procedure connection.
    Build you report with that new universe, using the derived table.

  • Using Oracle Stored Procedure in Interactive Reporting

    Hello,
    i'm trying to use Oracle Store procedure in Interactive reporting but all i get are errors.
    My env:
    Interactive Reporting 9.3.1
    Oracle Database 10.2
    I created OCE as ODBC/OBDC. Tables are returned and Stored Procedure entry is enabled.
    If i use "microsoft ODBC for Oracle" i can see stored procedure list but i get this error:
    SQL API: [SQLExecDirectW], SQL RETURN: [-1], SQL STATE: [42000], SQL NATIVE ERROR: [6550], SQL MESSAGE: [[Microsoft][ODBC driver for Oracle][Oracle]ORA-06550: line 1, column 7:
    PLS-00306: wrong number or types of arguments in call to 'TEST_PDC_RECORDSET'
    If i use Oracle's odbc i get: "Error in function sequence".
    If i use Merants (5.2) odbc i cannot retreive stored procedure list. (list is empty)
    Note.
    My stored procedure works (tested via sqlplus).
    thank u daniele

    Returning (or sending in) multiple rows directly from (or to) a stored procedure is not currently possible. I have been in contact with SAP on this subject earlier, and they suggest using a web service to do the job. I used this as a work around, calling the stored procedure from a web service. I send in VC tables to this web service, and this in turn contacts my stored procedure.
    The problem is related to the connector framework in the J2EE environment.
    I am on 7.0 sps 17
    If you use stored procedure single value parameters of type varchar, number ... then VC has no problem communicating with your procedures.
    Good luck
    Henning Strand

  • HOW TO EXECUTE A STORE PROCEDURE THAT RETURN MULTIPLE ROWS FROM A QUERY

    I NEED TO CREATE AND USE A STORE PROCEDURE THAT IS GOING TO DO A SELECT STATEMENT AN THE RESULT OF THE SELECT STATEMENT IS RETURN IN SOME WAY TO THE REQUESTER.
    THIS CALL IS MADE BY AN EXTERNAL LANGUAGE, NOT PL/SQL OR FORMS APPLICATION. USING FOR EXAMPLE ODBC AND VISUAL BASIC. WHAT I NEED TO DO IS ADD A DATA ACCESS LAYER TO MY APPLICATION AND I ALREADY HAVE IT DONE FOR MS SQL SERVER, BUT I NEED THE SAME FUNCTIONALITY ACCESSING AN ORACLE DATABASE.
    FLOW:
    1. VB CREATE A ODBC CONNECTION TO A ORACLE DATABASE
    2. VB EXECUTE A STORE PROCEDURE
    3. THE STORE PROCEDURE RETURNS TO THE VB APPLICATION THE RESULT OF THE QUERY THAT IS INSIDE OF THE STORE PROCEDURE.(I.E. THE STORE PROCEDURE IS A BASIC SELECT, NOTHING COMPLEX)
    4. VB DISPLAY THE RESULT IN A GRID
    FOR SURE I CAN DO THE SELECT DIRECTLY TO ORACLE, BUT FOR PERFORMANCE REASONS AND SCALABILITY, I'LL LIKE IT TO DO IT USING A STORE PROCUDURES
    IS THIS POSIBLE?, HOW?
    THANKS

    Certainly, it's possible. First, define a stored procedure that includes an OUT parameter which is a REF CURSOR. Then, call the stored procedure via ODBC omitting the OUT parameter from the list of parameters. IT will automatically be returned as a result set. Syntax for both is below...
    CREATE PROCEDURE foo (inParam in varchar2, resultSet OUT REF CURSOR )
    In ODBC:
    {call foo( 'someData' )}
    Justin

  • Can not run complex report with ReportClientDocument using POJO beans.

    Hi All,
    Any help would be very appreciated I have been stack on this issue for the last 4 hours.
    My report has parameters, a ResultSet and subreports that themselves have both parameters and ResultSet.
    The report runs well in Crystal Report Designer but not on my application with ReportClientDocument API.
    The excpeiton I am getting is:
    ======================================================================
    Caused by: java.lang.NullPointerException
    16:22:56,796 INFO  [STDOUT]      at com.crystaldecisions.sdk.occa.report.application.ParameterFieldController.do(Unknown Source)
    16:22:56,796 INFO  [STDOUT]      at com.crystaldecisions.sdk.occa.report.application.bs.a(Unknown Source)
    16:22:56,796 INFO  [STDOUT]      at com.crystaldecisions.sdk.occa.report.application.bs.byte(Unknown Source)
    16:22:56,796 INFO  [STDOUT]      at com.crystaldecisions.sdk.occa.report.application.a3.if(Unknown Source)
    16:22:56,796 INFO  [STDOUT]      at com.crystaldecisions.proxy.remoteagent.r.a(Unknown Source)
    16:22:56,796 INFO  [STDOUT]      at com.crystaldecisions.proxy.remoteagent.r.a(Unknown Source)
    16:22:56,796 INFO  [STDOUT]      at com.crystaldecisions.proxy.remoteagent.r.a(Unknown Source)
    16:22:56,796 INFO  [STDOUT]      at com.crystaldecisions.proxy.remoteagent.r.else(Unknown Source)
    16:22:56,796 INFO  [STDOUT]      at com.crystaldecisions.proxy.remoteagent.r.for(Unknown Source)
    16:22:56,796 INFO  [STDOUT]      at com.crystaldecisions.proxy.remoteagent.h.for(Unknown Source)
    16:22:56,796 INFO  [STDOUT]      at com.crystaldecisions.sdk.occa.report.application.cf.a(Unknown Source)
    16:22:56,796 INFO  [STDOUT]      at com.crystaldecisions.sdk.occa.report.application.DatabaseController.a(Unknown Source)
    16:22:56,796 INFO  [STDOUT]      at com.crystaldecisions.sdk.occa.report.application.DatabaseController.setDataSource(Unknown Source)
    16:22:56,796 INFO  [STDOUT]      at com.tramada.documents.businessobjects.BODocumentProvider.generateDocument(BODocumentProvider.java:178)
    16:22:56,796 INFO  [STDOUT]      at com.tramada.documents.service.impl.DocumentServiceImpl.generateDocumentContent(DocumentServiceImpl.java:125)
    16:22:56,796 INFO  [STDOUT]      ... 58 more
    This is my class that is trying to do the work.:
    ======================================================================
    BODocumentProvider.java Created on 19/05/2008
    This software is the confidential and proprietary information of Tramada
    Systems Pty Limited.
    package com.tramada.documents.businessobjects;
    import java.io.ByteArrayInputStream;
    import java.util.List;
    import java.util.Locale;
    import com.businessobjects.samples.pojo.POJOResultSetFactory;
    import com.crystaldecisions.sdk.framework.CrystalEnterprise;
    import com.crystaldecisions.sdk.framework.IEnterpriseSession;
    import com.crystaldecisions.sdk.occa.infostore.IInfoObject;
    import com.crystaldecisions.sdk.occa.infostore.IInfoObjects;
    import com.crystaldecisions.sdk.occa.infostore.IInfoStore;
    import com.crystaldecisions.sdk.occa.managedreports.IReportAppFactory;
    import com.crystaldecisions.sdk.occa.report.application.ISubreportClientDocument;
    import com.crystaldecisions.sdk.occa.report.application.ParameterFieldController;
    import com.crystaldecisions.sdk.occa.report.application.ReportClientDocument;
    import com.crystaldecisions.sdk.occa.report.application.SubreportController;
    import com.crystaldecisions.sdk.occa.report.data.Fields;
    import com.crystaldecisions.sdk.occa.report.data.IField;
    import com.crystaldecisions.sdk.occa.report.data.ITable;
    import com.crystaldecisions.sdk.occa.report.data.Tables;
    import com.crystaldecisions.sdk.occa.report.exportoptions.ReportExportFormat;
    import com.crystaldecisions.sdk.occa.report.lib.IStrings;
    import com.tramada.core.utils.SoftMap;
    import com.tramada.documents.DocumentDataProvider;
    import com.tramada.documents.DocumentDescriptor;
    import com.tramada.documents.DocumentFormat;
    import com.tramada.documents.DocumentProvider;
    import com.tramada.documents.SubDocumentDescriptor;
    import com.tramada.documents.businessobjects.model.Template;
    import com.tramada.documents.model.DocumentContent;
    import com.tramada.persistence.home.GenericHome;
    Business Objects specific Document Provider.
    public class BODocumentProvider implements DocumentProvider {
        private static final String BO_AUTH_TYPE = "secEnterprise";
        private boolean connect;
        private String userName;
        private String userPassword;
        private String boURL;
        private String documentsFolder;
        private GenericHome home;
    Local cache. Keeps track of document source for better performance.
        private SoftMap<String, ReportClientDocument> cachedSources = new SoftMap<String, ReportClientDocument>();
        // SETTERS & GETTERS
        // SETTERS & GETTERS
        public GenericHome getHome() {
            return home;
        public void setHome(GenericHome home) {
            this.home = home;
        public boolean getConnect() {
            return connect;
        public void setConnect(boolean connect) {
            this.connect = connect;
        public String getBoURL() {
            return boURL;
        public void setBoURL(String boURL) {
            this.boURL = boURL;
        public String getUserName() {
            return userName;
        public void setUserName(String userName) {
            this.userName = userName;
        public String getUserPassword() {
            return userPassword;
        public void setUserPassword(String userPassword) {
            this.userPassword = userPassword;
        public String getDocumentsFolder() {
            return documentsFolder;
        public void setDocumentsFolder(String documentsFolder) {
            this.documentsFolder = documentsFolder;
        // PUBLIC INTERFACE
    Generates a document given its descriptor.
    @param descriptor
               valid document descriptor
    @return Document (generated document).
        public DocumentContent generateDocument(DocumentDescriptor descriptor, DocumentFormat format) throws Exception {
            if (descriptor == null) {
                throw new IllegalArgumentException("descriptor==null");
            if (format == null) {
                throw new IllegalArgumentException("format==null");
            // get the document source.
            // Can not use setDataSource() error code 2147483648?
            ReportClientDocument document = getDocument(descriptor.getDocumentName());
            ParameterFieldController parameterController = document.getDataDefController().getParameterFieldController();
            // insert the main document parameters and there values
            populateParameters(document.getDataDefController().getDataDefinition().getParameterFields(),
                    parameterController, descriptor, "");
            // insert into the main document all the required data.
            Tables tables = document.getDatabaseController().getDatabase().getTables();
            for (int i = 0; i < tables.size(); i++) {
                ITable table = tables.getTable(i);
                String tableAlias = table.getAlias();
                DocumentDataProvider provider = descriptor.getDocumentDataProvider(tableAlias);
                POJOResultSetFactory factory = new POJOResultSetFactory(provider.getDataType());
                document.getDatabaseController().setDataSource(factory.createResultSet(provider.getData()), tableAlias,
                        tableAlias);
            // go through all the sub-documents and do the same thing as for the
            // main document.
            SubreportController subReportController = document.getSubreportController();
            IStrings names = subReportController.getSubreportNames();
            for (int i = 0; i < names.size(); i++) {
                String subDocumentName = (String) names.get(i);
                SubDocumentDescriptor subDescriptor = descriptor.getSubDocument(subDocumentName);
                // get the actual sub document.
                ISubreportClientDocument subDocument = subReportController.getSubreport(subDocumentName);
                // insert the subdocument parameters.
                populateParameters(subDocument.getDataDefController().getDataDefinition().getParameterFields(),
                        parameterController, subDescriptor, subDocumentName);
                // insert into the main document all the required data.
                Tables subTables = subDocument.getDatabaseController().getDatabase().getTables();
                for (int j = 0; j < subTables.size(); j++) {
                    ITable subTable = subTables.getTable(j);
                    String tableAlias = subTable.getAlias();
                    DocumentDataProvider subProvider = subDescriptor.getDocumentDataProvider(tableAlias);
                    POJOResultSetFactory subFactory = new POJOResultSetFactory(subProvider.getDataType());
                    subDocument.getDatabaseController().setDataSource(subFactory.createResultSet(subProvider.getData()),
                            tableAlias, tableAlias);
            // generate the report in the specified format
            ByteArrayInputStream bais = (ByteArrayInputStream) document.getPrintOutputController().export(
                    getReportFormat(format));
            byte[] content = new byte[bais.available()];
            bais.read(content);
            return (new DocumentContent(content));
    Refreshes the connector and all its cached document sources.
        public void refresh() throws Exception {
            cachedSources.clear();
        // PRIVATE ROUTINES
    Populates the document parameters with there values.
        private void populateParameters(Fields parameters, ParameterFieldController controller,
                DocumentDescriptor descriptor, String documentName) throws Exception {
            for (int i = 0; i < parameters.size(); i++) {
                IField parameter = parameters.getField(i);
                String parameterName = parameter.getName();
                if (!descriptor.getParameters().containsKey(parameterName)) {
                    throw new IllegalStateException("missing parameter entry for '" + parameterName + "'");
                Object value = descriptor.getParameter(parameterName);
                if (value != null) {
                    controller.setCurrentValue(documentName, parameterName, value);
    Retrieves the document source. If the source is not cached get it from
    BO. First get the template name that is stored on BO.
        private ReportClientDocument getDocument(String documentName) throws Exception {
            ReportClientDocument source = cachedSources.get(documentName);
            if (source == null) {
                String templateName = getTemplateName(documentName);
                if (userName == null) {
                    throw new IllegalArgumentException("user-name==null");
                if (userPassword == null) {
                    throw new IllegalArgumentException("user-password==null");
                if (boURL == null) {
                    throw new IllegalArgumentException("boURL==null");
                if (documentsFolder == null) {
                    throw new IllegalArgumentException("documents-folder==null");
                // login to BO
                IEnterpriseSession enterpriseSession = CrystalEnterprise.getSessionMgr().logon(userName, userPassword,
                        boURL, BO_AUTH_TYPE);
                IInfoStore iStore = (IInfoStore) enterpriseSession.getService("InfoStore");
                // get the application folder.
                IInfoObjects folders = iStore.query("Select SI_ID From CI_INFOOBJECTS Where SI_PROGID='CrystalEnterprise.Folder' And SI_NAME = '"
                        + documentsFolder + "'");
                if (folders.size() != 1) {
                    throw new IllegalStateException("documents folder '" + documentsFolder + "' not found on BO Server '"
                            + boURL + "'.");
                IInfoObject folder = (IInfoObject) folders.get(0);
                // get the document identified by the template name.
                IInfoObjects templates = iStore.query("select SI_ID, SI_NAME From CI_INFOOBJECTS "
                        + "where SI_PROGID = 'CrystalEnterprise.Report' " + "And SI_INSTANCE_OBJECT = 0 "
                        + "And SI_PARENT_FOLDER = " + folder.getID() + " And SI_NAME= '" + templateName + "'");
                if (templates.size() != 1) {
                    throw new IllegalStateException("template with name '" + templateName + "' not found in folder '"
                            + documentsFolder + "'on BO Server '" + boURL + "'.");
                source = ((IReportAppFactory) enterpriseSession.getService("RASReportFactory")).openDocument(
                        ((IInfoObject) templates.get(0)).getID(), 0, Locale.getDefault());
                cachedSources.put(documentName, source);
            return (source);
    Returns the associated template name for the given document descriptor.
        @SuppressWarnings("unchecked")
        private String getTemplateName(String documentName) {
            Template example = new Template();
            example.setDocumentName(documentName);
            List<Template> templates = (List<Template>) home.findByExampleExcludingAssociations(example);
            if (templates == null || templates.size() != 1) {
                throw new IllegalStateException("no template defined for document name '" + documentName + "'");
            return (templates.get(0).getTemplateName());
    Get the equivalent BO format for the given document format.
    @param format
               document format.
    @return ReportExportFormat
        private ReportExportFormat getReportFormat(DocumentFormat format) {
            if (format.equals(DocumentFormat.PDF)) {
                return (ReportExportFormat.PDF);
            } else if (format.equals(DocumentFormat.WORD)) {
                return (ReportExportFormat.MSWord);
            } else if (format.equals(DocumentFormat.EXCEL)) {
                return (ReportExportFormat.MSExcel);
            return (ReportExportFormat.MSWord);
    Best Regards
    Khalef  Bessaih

    Hello,
    If I understand correctly, you create a local report which choose report from Report Server. You have two query parameters in the report which are returned by stored procedure. Currently, you cannot get default values for these parameters when run the report.
    Based on my test, if we haven’t configure these parameter with Available Values, we can reproduce the same issue. Also, caching issue may cause the same issue. If the issue is persist, please delete the corresponding report in the report server. Then, redeploy
    it to check.
    There is a similar issue, you can refer to it.
    http://social.msdn.microsoft.com/Forums/en-US/6a548d65-35d0-4a3e-8b64-3b7b655c76ee/ssrs-2008-report-parameter-default-value-doesnt-work-when-deployed
    Regards,
    Alisa Tang
    Alisa Tang
    TechNet Community Support

  • How to use a atore procedure in the sender Jdbc adapter

    Hi Experts!
    I am having a requirement to read multiple data from multiple tables from Oracle database at a time.
    In sender side i am using JDBC Adapter. Here i want to know how can we use a store procedure to do this and can any one pls give a blog which guide me in design.
    Thanks in advance,
    Preethi.

    Pleasae see this thread
    Stored procedure in Sender JDBC Adapter
    In space of select statement put
    EXEC nameofstoredprocedure
    and update statement
    Put <TEST>

Maybe you are looking for

  • It`s possible to transmit any video source from iMac to apple TV?

    It´s possible to transmit any video source from Imac to Apple TV?.

  • Issue with MQ connection

    I am facing issue in MQ connection. Note:EDU:- An environment behaves as repository based on clustered environment. UAT:- An environment behaves as repository based on stand-alone environment The flow is to pass booking details from Proxy service to

  • Cannot, View or Repair Disk Permissions with disk utility,

    Hey, I can't repair disk permissions using Disk Utility. I can only repair them using the boot disk and I'm just worried that something somewhere is corrupted or gone irky (Technical computer term). Thanks.

  • Playlist burning song order

    occasionally the playlist that gets burned to a cd changes its order, latest one rearranged songs into order by artist...

  • Drill-Through Report automation through VBA

    Hi, I've been making macros using standard VBA functions in Excel Essbase. For this, I've been using functions defined in essxlvba.txt. My Essbase database has linked objects which gives the transaction level data for selected cells. If I call EssMen