Extracting SQL statement from a Webi document's data provider using SDK.

Hi all,
Is it possible to extract the SQL statement from an existing Webi document's data provider using BO SDK?  I've searched through the class library but haven't found any information on this yet.  If you have done it, could you provide some guidance.  Many thanks.

I found the following Java code that might be of some help to you. I realize you are using .NET but this might push you down the right path.
The trick here is to use the Report Engine SDK to get the DataProvider of the DocumentInstance. Then, look at the SQLDataProvider to get your SQLContainer.
My apologies for the poor formatting. This didn't copy and paste over to the forums very well. I've cleaned up as much as I could.
<%@ page import="com.crystaldecisions.sdk.framework.*" %>
<%@ page import="com.crystaldecisions.sdk.exception.SDKException" %>
<%@ page import="com.crystaldecisions.sdk.occa.infostore.*" %>
<%@ page import="com.businessobjects.rebean.wi.*" %>
<%
boolean loginSuccessful = false;
IEnterpriseSession oEnterpriseSession = null;
String username = "username";
String password = "password";
String cmsname  = "cms_name";
String authenticationType = "secEnterprise";
try
//Log in. oEnterpriseSession = CrystalEnterprise.getSessionMgr().logon( username, password, cmsname, authenticationType);
if (oEnterpriseSession == null)
out.print("<FONT COLOR=RED><B>Unable to login.</B></FONT>");
else
{  loginSuccessful = true;
catch (SDKException sdkEx)
{ out.print("<FONT COLOR=RED><B>ERROR ENCOUNTERED</B><BR>" + sdkEx + "</FONT>");}
if (loginSuccessful) { IInfoObject oInfoObject = null;
String docname = "WebI document name";
//Grab the InfoStore from the httpsession IInfoStore oInfoStore = (IInfoStore) oEnterpriseSession.getService("", "InfoStore");  //Query for the report object in the CMS.  See the Developer Reference guide for more information the query language.   String query = "SELECT TOP 1 * " +        "FROM CI_INFOOBJECTS " +        "WHERE SI_INSTANCE = 0 And SI_Kind = 'Webi' " +        "AND SI_NAME='" + docname + "'";
IInfoObjects oInfoObjects = (IInfoObjects) oInfoStore.query(query);
if (oInfoObjects.size() > 0)
//Retrieve the latest instance of the report  oInfoObject = (IInfoObject) oInfoObjects.get(0);
  // Initialize the Report Engine  ReportEngines oReportEngines = (ReportEngines)
oEnterpriseSession.getService("ReportEngines"); 
ReportEngine oReportEngine = (ReportEngine) oReportEngines.getService(ReportEngines.ReportEngineType.WI_REPORT_ENGINE);
  // Openning the document  DocumentInstance oDocumentInstance = oReportEngine.openDocument(oInfoObject.getID());   
DataProvider oDataProvider = null; 
SQLDataProvider oSQLDataProvider = null; 
SQLContainer oSQLContainer_root = null; 
SQLNode oSQLNode = null;
SQLSelectStatement oSQLSelectStatement = null; 
String sqlStatement = null;
  out.print("<TABLE BORDER=1>");
for (int i=0; i<oDocumentInstance.getDataProviders().getCount(); i++)
oDataProvider = oDocumentInstance.getDataProviders().getItem(i);
  out.print("<TR><TD COLSPAN=2 BGCOLOR=KHAKI>Data Provider Name: " + oDataProvider.getName() + "</TD></TR>");
   if (oDataProvider instanceof SQLDataProvider)
oSQLDataProvider = (SQLDataProvider) oDataProvider;
    oSQLContainer_root = oSQLDataProvider.getSQLContainer();
    if (oSQLContainer_root != null)
for (int j=0; j<oSQLContainer_root.getChildCount(); j++)
oSQLNode = (SQLNode) oSQLContainer_root.getChildAt(j);
      oSQLSelectStatement = (SQLSelectStatement) oSQLNode;             
sqlStatement = oSQLSelectStatement.getSQL();     
out.print("<TR><TD>" + (j+1) + "</TD><TD>" + sqlStatement + "</TD></TR>");   
else
out.print("<TR><TD COLSPAN=2>Data Provider is not a SQLDataProvider.  SQL Statement can not be retrieved.</TD></TR>");   }  }  out.print("</TABLE>");
  oDocumentInstance.closeDocument(); }
oEnterpriseSession.logoff();}%>

Similar Messages

  • Extraction SQL statement from oracle stored procedure stored in file

    Hi,
    I am newbie to oracle stored procedure. I need to extract the list of sqls present in oracle stored procedure. Besides that I also want to parse these sql statements to get the list of tables and columns used. Is there any tool which can help me in doing thats.
    thanks,
    govind

    why don't check on user_dependencies table instead?
    select referenced_name,referenced_type
    from user_dependencies
    where name='<your stored procedure name in upper case>'
    and referenced_type = 'TABLE'HTH,
    Prazy

  • API to retrieve SQL query from a Webi Document

    Hi,
    Which API can be used to retrieve the Oracle SQL query for a webi report using BO XI web services SDK? The report is connected to a Oracle database in the backend.
    A sample code is greatly appreciated.
    Thanks a lot!
    Liz

    Hi Liz,
    The libraries for the Enterprise and Report Engine SDKs are included with your Enterprise installation and the location will vary with each version:
    XI Release 1 and Release 2
    XI Release 1 (assuming it's installed on C:\):
    - Windows: C:\Program Files\Common\3.0\java\lib
    - Linux/UNIX: (INSTALL_DIR)/java/lib
    XI Release 2:
    - Windows: (INSTALL_DIR)\Business Objects\Common\3.5\java\lib
    - Linux/UNIX: (INSTALL_DIR)/java/lib
    There are quite a few JAR files in this location, but you should only need the following set for Enterprise & REBean with XI Release 1 or XI Release 2:
    From the java\lib directory
    - boconfig.jar
    - cecore.jar
    - celib.jar
    - ceplugins.jar
    - cereports.jar
    - cesession.jar
    - ceutils.jar
    - cexsd.jar
    - corbaidl.jar
    - ebus405.jar
    - jtools.jar
    - keycodeDecoder.jar
    - rebean.common.jar
    - rebean.fc.jar
    - rebean.jar
    - rebean.wi.jar
    - rpoifs.jar
    - Serialization.jar
    - URIUtil.jar
    - wilog.jar     
    From the java\lib\external directory:
    - Concurrent.jar
    - freessl201.jar
    - icu4j.jar
    - jaxrpc.jar
    - jsafe.jar
    - log4j.jar
    - pullparser.jar
    - saaj.jar
    - sslj.jar
    - xbean.jar
    - xercesImpl.jar
    - xml-apis.jar
    BusinessObjects Enterprise XI 3.0
    - Windows: (INSTALL_DIR)\Business Objects\Common\4.0\java\lib
    - Linux/UNIX: (INSTALL_DIR)/java/lib
    You can find a list of required JAR files in the [XI 3.0 Enterprise SDK Developer Guide|https://boc.sdn.sap.com/node/7298].
    Cheers,
    Parin
    Edited by: Parin Patel on Jun 25, 2008 11:03 AM

  • BusinessObject 4.0 API to get SQL statement from webi or crystal report

    Hello,
    Need your help.... could you confirm whether BusinessObjects 4.0 provides any SDK, API or Web Service to get physical SQL statement from the webi or crystal reports file?
    If so, could you provide name of package, class and method?
    If I am not wrong, there is an SDK in v3.0 that allows to extract the SQL. But I am reading a lot on these forums that lot of SDK classes and functions are deprecated / removed in v4.0.
    Thanks for your help.
    Omer

    For Crystal Reports in BI 4.0 to retrieve the SQL query you can use Report Application Server SDK. Here is a code snippet that retrieves the SQL statement.
    //oInfoObjectReport is of type IInfoObject corresponding to the crystal report.
    ReportClientDocument reportClientDoc = reportAppFactory.openDocument(oInfoObjectReport, 0, Locale.ENGLISH);
            //for all crystal reports
            GroupPath grpPath = new GroupPath();
            //get CR SQL query string
            String reportSQL=reportClientDoc.getRowsetController().getSQLStatement(grpPath,null);
            System.out.println("report SQL String: "+reportSQL);
            //for report whose datasource is command object:
            Tables tables = reportClientDoc.getDatabaseController().getDatabase().getTables();
            for (int i = 0; i < tables.size(); i++)
             ITable table = tables.getTable(i);
             ICommandTable ic= (ICommandTable) table;
             //Command can be obtained from the report using getCommandObject() method
             //get CR SQL query string
             String SQLText=ic.getCommandText();
             System.out.println("SQLText_"+i+": "+SQLText);
    Here are useful links for BI 4.0
    [RAS API Specification|http://help.sap.com/businessobject/product_guides/boexir4/en/xi4_rasjava_apiRef_en.zip]
    [RAS Developer Guide|http://help.sap.com/businessobject/product_guides/boexir4/en/xi4_rasjava_dg_en.zip]

  • How could I extract past executed SQL statement from dictionary ?

    We use oracle11gR2 on win2008R2.
    How could I extract the past executed SQL statement from dictionary ? (Is it possible from V$SQLTEXT or other dictionary table ?)

    IvicaArsov wrote:
    Hi,
    You can find executed SQL in V$SQLAREA view (if it's still in memory). If it does'n't exist and you have AWR enabled you can query DBA_HIST_SQLTEXT table, but remember that the statistic information in AWR tables is filtered (1 out of 10).
    I.Arsov
    As you know when taking snapshot oracle will capture only top sql statements and stored in AWR.
    But can you please link(source) dba_hist_sqltext contain only 1 out of 10 filtered data?. In dba_hist_active_sess_history yes it contain 1 out of 10 sampled data.

  • How to isolate the Sql Statement from Java Code

    Hi
    I Need to know that can we segregate the Sql Statements and convert them to Stored Procedures so as to isolate the Sql statements from Java Code.
    So i have one static web page which uses four select Statements so what i want is to create a stored procedure encapsulating these queries. So that the Java Web Developer will simply call the Stored Procedure instead of using four different SQL Statements.
    Suppose the developer has these four Statements
    Select ename,empno,sal,job from emp;
    select empno,ename,mgr from emp;
    select deptno,dname from dept;
    select emp.ename,emp.empno,emp.deptno,dept,dname fromemp,dept;
    So can i encapsulate these four Sql Statements in one Procedure and the Web developer can call the Store procedure and dont need to write the Sql Statements in his code.
    Can Anybody guide me how to write this Stored type of Store procedure.
    Thanks

    http://www.google.com/search?q=java+windows+registry
    Next time, search yourself. It might be beyond your belief, but you're really, really not the first person to wonder about this.

  • Exec SQL statement from BW to MS SQL

    Hi Experts,
    I need to execute sql statement from BW on MS SQL Server.
    I want to do it in process chain. There is a so called ABAP Program Component.
    How to implement such a program or function module that will execute on MS SQL Server an sql statement such as for instance:
    "Create view SOME_VIEW as select * from XTABLE".
    I have already configured database connection using DBCO transaction.
    Waiting for response.
    Krzysztof

    Thanks, but that is not what I was asking for.
    I just need to send some SQL statement from BW to MS SQL Server using ABAP program (exec sql or something like this).
    Could you provide me a pattern of such an ABAP program?
    The sql statement is not importent here, I have already extracted data from MS SQL to BW, I have configured dataflow, process chains and so on.
    No I need to determine DELTA on MS SQL Server. I've got some ideas but I need to know how to send SQL statement from BW to MS SQL Server using ABAP program.
    Please any help will be appreciated

  • Extracting SQL Queries from Crystal Reports

    I am trying to find a way or a utility to be able extract SQL queries from Crystal reports into a text file for documentation purposes.  These queries are not in the repository, they were entered into each of the reports when the reports were being built and I can't find a way to extract them.  Any ideas/suggestions?

    Hello,
    CR doesn't have the ability, and I don't recall if this has ever been asked previously. Great suggestion for the Idea Place tab in the up right corner of this page.
    If you find a developer it's quite simple to get:
                // log onto the server and then get the SQL.
                rptClientDoc.DatabaseController.LogonEx("van-w-13-dwilli", "xtreme", "sa", "pw");
                GroupPath gp = new GroupPath();
                string tmp = String.Empty;
                rptClientDoc.RowsetController.GetSQLStatement(gp, out tmp);
                // show the SQL but easy enough to save the SQL text to a file.
                MessageBox.Show(tmp, "Data Source Set and SQL Statement", MessageBoxButtons.OK, MessageBoxIcon.Information);
    Of course you need to open the report first, lots of samples on how to...
    Thank you
    Don

  • How to store data into database by reading sql statements from text file

    how to write java program for storing data into database by reading sql statements from text file

    Step 1: Create a property file to add various queries.
    Step 2: Read the properties file using ResourceBundle
    Step 3: Use the jdbc to execute the query read from the property file.
    So in future if you need to change query no need do any modifications in java program. But depends on how you use the property file.

  • How do extract one page from one pdf document and save as a new pdf?

    How do I extract one page from a pdf document and create a new document?

    In Acrobat: Tools - Pages - Extract.
    In Reader it's not possible.
    On Sat, Jan 31, 2015 at 10:29 PM, Ned Murphy <[email protected]>

  • How Can I Retrieve SQL Statement From The User ?

    Hi
    I want to know, how can I make the user can enter the SQL statement from himself ?? in this code he can't enter it. Only he can display the SQL that i wrote it...
    this is my Code:
    import java.sql.*;
    public class db_testing {
         static final String DRIVER = "com.mysql.jdbc.Driver";            
         static final String DATABASE_URL = "jdbc:mysql://localhost/S204111933";
         public static void main(String[] args) {
              Connection cn=null;
              Statement st= null;
              ResultSet rset=null;
              try{
                   Class.forName(DRIVER);
                   cn=DriverManager.getConnection(DATABASE_URL, "root", "admin");
                   st=cn.createStatement();
                   rset=st.executeQuery("select * from employee");
                   ResultSetMetaData metadata=rset.getMetaData();
                   System.out.println("The begining: ");
                   for(int i=1;i<=metadata.getColumnCount();i++)
                   System.out.print(metadata.getColumnName(i)+"\t");
                   System.out.println();
                   System.out.println();
                   while(rset.next()){
                   for(int i=1;i<=metadata.getColumnCount();i++)
                   System.out.print(rset.getObject(i)+"\t\t");
                   System.out.println();}
              catch(Exception e){
                   e.printStackTrace();
              finally{
                   try{
                   cn.close();
                   st.close();
                   rset.close();
                   catch(Exception e1){
                        e1.printStackTrace();
    }

    The following changes in the code will make the user to give the input
    import java.sql.*;
    public class db_testing {
    static final String DRIVER = "com.mysql.jdbc.Driver";
    static final String DATABASE_URL = "jdbc:mysql://localhost/S204111933";
    public static void main(String[] args) {
    Connection cn=null;
    Statement st= null;
    ResultSet rset=null;
    try{
    Class.forName(DRIVER);
    cn=DriverManager.getConnection(DATABASE_URL, "root", "admin");
    // st=cn.createStatement();
    // rset=st.executeQuery("select * from employee");
    PreparedStatement pstmt=null;
    pstmt=cn.prepareStatement("select * from employee where id=?");
    pstmt.setInt(1,Integer.parseInt(args[0]));
    rset=pstmt.executeQuery();
    ResultSetMetaData metadata=rset.getMetaData();
    System.out.println("The begining: ");
    for(int i=1;i<=metadata.getColumnCount();i++)
    System.out.print(metadata.getColumnName(i)+"\t");
    System.out.println();
    System.out.println();
    while(rset.next()){
    for(int i=1;i<=metadata.getColumnCount();i++)
    System.out.print(rset.getObject(i)+"\t\t");
    System.out.println();}
    catch(Exception e){
    e.printStackTrace();
    finally{
    try{
    cn.close();
    st.close();
    rset.close();
    catch(Exception e1){
    e1.printStackTrace();
    }

  • Can we Run a simple SQL statement from OBIEE Middle Tier node

    Hi
    i am working in OBIEE 11g environment. Database is installed on one node and Middle tier (BI services ) in other node,
    Can i use any utility to run a simple SQL statement from Middle tier ?
    Thanks
    Reddy

    Any utility means?
    We can create an ODBC connection on the BI server and run the sql.
    Mark if helps.

  • Where to see generated SQL statement from jdbc adapter?

    Hi everybody,
    where can I see the generated SQL statement from JDBC adapter?
    Regards Mario

    Yes and True lterally means the same, but alas XI does not understand literature..
    Just checked the note as well, as you are correct!
    Regards
    Bhavesh

  • How could I investigate SQL statement from standard audit record ?

    We use Oracle 11gR2.
    We use standard audit , audit_trail=DB.
    We found suspicious audit record but that  SQL_BIND,SQL_TEXT colums were NULL.
    How could I investigate that SQL statement from standard audit record ?

    Only "DB, EXTENDED" would cause the SQL statement to be captured.
    If you have the Diagnostics Pack licence you could try querying DBA_HIST_SQLTEXT (joined to DBA_HIST_SNAPSHOT) -- but this would only list SQLs captured by AWR (i.e. the "Top 'N'" SQLs in that snapshot).
    Hemant K Chitale

  • Patterns to execute a SQL Statement from a Droplet (select)

    Hi,
    I need to perform a query on a table, Example: select * from ARF_QUERY "the database used is Oracle. I would like to know if the atg has some
    standard method to perform this database connection and execute the SQL statement from a Droplet (select).
    Thank.

    I dont think there is any generic droplet to run a select query directly against a table.
    However, there are various lookup droplets available that run on the repositories.
    Like /atg/targeting/RepositoryLookup droplet. you can run it for specific id or for all.
    You might want to have a look at it in documentation of how exactly to use it.
    Thanks

Maybe you are looking for

  • Connecting to a database in Dreamweaver/ColdFusion

    Please Help! I've created database connections to both Mysql and MS Access databases in the ColdFusion Administrator Data Source page (I've used both Mysql and Access to test what's wrong with the connection). However, I can't connect to them in Drea

  • API to find out identity of current thread in a feature receiver?

    Hi All, What API can I use to get the identity under which the current thread is running in a feature event receiver? Thank you!

  • Timeout error in Wait for Operation Complete VI for TEKDPO4054 scope driver

    Hi, I keep getting a timeout error (-1073807339) when I run the "wait for operation complete" sub-VI that comes with the tektronix DPO4000 series oscilloscope driver. I'm using a DPO4054 scope. The error out source is the VISA Read STB command, but I

  • How to make smooth hardware accelerated JApplet?

    Hi there ive made a game that extends JPanel and im using the paintComponent method to do my painting as far as i know JPanel is hardware accelerated by default bufferStrategy(2) ive put the JPanel in a JFrame and the game runs very smooth with ~62fp

  • Locking folders

    How do you lock a folder. Itry to lock my web foundation folder in my sherlock folder, but the lock button was grayed out. I checked other folders and was the same thing. I was trying to follow the instructions from an earlier post on sherlock. See b