cancel
Showing results for 
Search instead for 
Did you mean: 

execute existing query by Java Xmla Connector

Former Member
0 Kudos

Hi,

I try to acces a BI/BW System with a Java Xmla Connector. I can connect to the SAP and create a query, no problem.

But now I want to execute an existing query of the BW that was created by the Query Designer and render the result with Java...

Is that possible? And how?

Thanks,

Martin

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

The project died in the meantime, but this code seems to work:


try {
	    
	    BwXmlaConnection bwCon = new BwXmlaConnection();
	    bwCon.setUserName("user");
	    bwCon.setPassword("pwd");
	    bwCon.setLanguage("DE");
	    bwCon.setUrl("http://server.de:8080/sap/bw/xml/soap/xmla");
	    
	    IBIConnection connection = bwCon.connectToXMLADatasource();
	    IBIOlap olap = connection.getOlap();

	    String mdxQuery = "SELECT " +
	    "[Measures].MEMBERS ON COLUMNS, " +
	    "NON EMPTY [0PUR_GROUP].MEMBERS ON ROWS " +
	    "FROM ZPUR_M01/ZPUR_M01_Q0034";

	    IBIDataSet dataset = olap.execute(mdxQuery);

	    BIDataSetTableModel table = new BIDataSetTableModel(dataset, false);

	    int row = table.getRowCount();
	    int col = table.getColumnCount();

	    for (int j = 0; j < col; j++) {
		for (int i = 0; i < row; i++) {
		    BITableItem item = table.getValueAt(i, j);
		    System.out.println(item.toString());
		}
		System.out.println(" ---- ");
	    }

	} catch (Exception e) {
	    e.printStackTrace();
	}

Former Member
0 Kudos

Hi,

thanks for your answer.

The connection is established and works fine.

I can create my own query and execute it, no problem.

But I want to execute an already existing query that was designed by the SAP Query Designer with a certain name like "ZPUR_M01_Q0034".

Ho can I do that? Has someone an example code?

Thanks,

Martin

Former Member
0 Kudos

Hi Martin,

could you please post sample code of how you created queries and execute and display them ? I have no idea how to do this.

Former Member
0 Kudos

Hi,

Use

To prepare a data source for use with the BI Java SDK or with UD Connect, you must first configure the properties of the BI Java Connector used to connect to the data source. You do this in the SAP NetWeaver Application Serveru2019s Visual Administrator, following the steps below.

To create and configure systems in the portal for use in BEx Web and Visual Composer scenarios, see Running the System Landscape Wizard and Editing Systems in the NetWeaver Portal System Landscape documentation.

Prerequisites

In order to configure the properties for a data source based on a BI Java Connector, the connectoru2019s resource adapter archive (RAR file) (delivered as part of Universal Data Integration, or UDI) and the Metamodel Repository (MMR) upon which the connectors rely must first be deployed to the server. UDI and MMR are part of usage type AS-Java (Application Server u2013 Java) in NetWeaver 7.0.

Check the documentation for the connector you wish to configure for any additional prerequisites (youu2019ll also be referring to these documents for the list of specific properties to configure):

○ BI JDBC Connector

○ BI ODBO Connector

○ BI SAP Query Connector

○ BI XMLA Connector

Procedure

...

1. Start the Visual Administrator:

○ UNIX: On your central instance host, change to the admin directory /usr/sap/<SAPSID>/<instance_number>/j2ee/admin and execute go.sh.

○ Windows: On your central instance host, change to the admin directory \usr\sap\<SAPSID>\<instance_number>\j2ee\admin and execute go.bat.

2. On the Cluster tab, choose Server x u00AE Services u00AE Connector Container.

3. Locate your connector in the Connector Container tree and double-click it to open the connector definition:

○ BI JDBC Connector: SDK_JDBC under the node sap.com/com.sap.ip.bi.sdk.dac.connector.jdbc

○ BI ODBO Connector: SDK_ODBO under the node sap.com/com.sap.ip.bi.sdk.dac.connector.odbo

○ BI SAP Query Connector: SDK_SAPQ under the node sap.com/com.sap.ip.bi.sdk.dac.connector.sapq

○ BI XMLA Connector: SDK_XMLA under the node sap.com/com.sap.ip.bi.sdk.dac.connector.xmla.

4. On the Runtime tab (in the right frame), choose Managed Connection Factory u00AE Properties.

5. Select and edit each property according to Connector Properties tables in the documents below:

○ BI JDBC Connector

○ BI ODBO Connector

○ BI SAP Query Connector

○ BI XMLA Connector

6. After configuring each property, choose Add to transfer the changes to the active properties list.

7. Save the settings.

For the BI JDBC Connector only:

Still in the Connector Container service, configure a reference to your data sourceu2019s JDBC driver using the steps below:

1. Select the BI JDBC Connector in the Connectors tree.

2. Choose the Resource Adapter tab.

3. In the Loader Reference box, choose Add to add a reference to your JDBC driver.

4. Enter library:<jdbc driver name> and choose OK.

The <jdbc driver name> is the name you entered for your driver when you loaded it (see Prerequisites in BI JDBC Connector).

5. Save the settings.

For the BI XMLA Connector only:

If you are using the SAPLOGONTICKET authentication method, configure BI to accept

user/SAPLogonTicket pairs for authentication (instead of only user/password pairs) using the procedures below:

1. Configure SSO between the J2EE engine and the SAP BI system (so that ABAP accepts SSO from the J2EE engine) using the instructions in the following document:

Configuring SAP Web AS ABAP to Accept Logon Tickets from the J2EE Engine

2. Configure SSO between the SAP BI system and the J2EE engine (so that the J2EE engine accepts SSO from ABAP) using the instructions in the following document:

Configuring the J2EE Engine to Accept Logon Tickets

If an error occurs when configuring and testing the BI XMLA Connector, apply SAP Note 863672.

For more information on using the Connector Container service, see Connector Container Service.

Result

Your BI Java Connector properties are configured and your data source is ready to use.

Testing the Connections

After you configure a BI Java Connector, you can perform a rough installation check by displaying the page for a given connector in your server. Perform the tests for a given connector by visiting the URLs in the table below:

Connector Test Servlets

Connector

URL

Successful Result

BI JDBC Connector

http://<host>:<port>/TestJDBC_Web/TestJDBCPage.jsp

A list of tables is displayed

BI ODBO Connector

http://<host>:<port>/TOdbo/servlet/TestOdbo

A list of cubes is displayed

BI SAP Query Connector

http://<host>:<port>/TSapq/servlet/TestSapq

A list of tables is displayed

BI XMLA Connector

http://<host>:<port>/TXmla/servlet/TestXmla

A list of cubes is displayed

These tests are designed to work with the default installation of the BI Java Connectors. Cloned connectors with new JNDI names are not tested by these servlets.

JNDI Names

When engineering applications with the BI Java SDK, refer to a connector by its JNDI name:

Connector JNDI Names

Connector

JNDI Name

BI JDBC Connector

SDK_JDBC

BI ODBO Connector

SDK_ODBO

BI SAP Query Connector

SDK_SAPQ

BI XMLA Connector

SDK_XMLA

For code samples, refer to the Connection Interfaces Javadocs package in the documentation set delivered with the BI Java SDK.

Cloning the Connections

You can clone an existing connection by using the Clone button in the toolbar.

For Universal Data Connect (UD Connect) only:

When entering the resource adapter name during the cloning process, you must prefix the JNDI name with SDK_ and use only all capital letters in the name in order for UD Connect to properly recognize the connector.

Plz refer this link:

http://help.sap.com/saphelp_nw70/helpdata/EN/43/e35b3315bb2d57e10000000a422035/frameset.htm

reg,

suresh