Skip to Content
0
Feb 25, 2009 at 11:21 AM

Problem with connecting to SAP system

325 Views

Hi all,

I am currently working on a Java application, which should create a .rpt file. Now I am facing a problem when trying to connect to a SAP system with this application.

I am working with Crystal Reports for Eclipse and all the report creation stuff is working fine. Now I tried to build up a connection to a SAP system in order to add tables and fields to my report.

I used an existing report (which I created in Crystal Reports 2008) to get all the necessary data for connecting and added this data to my code.

When I start the application a com.crystaldecisions.sdk.occa.report.lib.ReportSDKException is thrown. It says there is an error when searching for the JNDI-name (usciq74).

Is there anything missing or wrong with my code? Or does anyone have an example how to build up such a connection?

Thanks a lot for your help!

Kind regards,

Tobias

The data I read from the existing report looked like this:

========= TABLES ============

Name: 0PUR_C01/TW_TEST_CR2

QName: 0PUR_C01/TW_TEST_CR2

Alias: 0PUR_C01_TW_TEST_CR2

Desc: Neue Query

========= CONNECTION ===========

User: null

Password:

Kind: SQL

-


Server Type = SAP BW Query

PreQEServerName = usciq74

R3NAME = Q74

Database DLL = crdb_bwquery.dll

Database = CLIENT=003 LANG=DE ASHOST=usciq74 SYSNR=77 USER=WELLERTO R3NAME=Q74

Database Name = CLIENT=003 LANG=DE ASHOST=usciq74 SYSNR=77 USER=WELLERTO R3NAME=Q74

Server Name = usciq74

Server = usciq74

What I now added to my programm was the following code:

PropertyBag propertyBag = this.connectionInfo.getAttributes();
 
propertyBag.put("Server Type", "SAP BW Query");
propertyBag.put("PreQEServerName", "usciq74");
propertyBag.put("R3NAME", "Q74");
propertyBag.put("Database", "CLIENT=003 LANG=DE ASHOST=usciq74 SYSNR=77 USER=WELLERTO R3NAME=Q74");
propertyBag.put("Database Name", "CLIENT=003 LANG=DE ASHOST=usciq74 SYSNR=77 USER=WELLERTO R3NAME=Q74");
propertyBag.put("Server Name", "usciq74");
propertyBag.put("Server", "usciq74");
propertyBag.put("Database DLL", "crdb_bwquery.dll");
   
this.connectionInfo.setAttributes(propertyBag);
this.connectionInfo.setUserName(***);
this.connectionInfo.setPassword(***);
this.connectionInfo.setKind(ConnectionInfoKind.SQL);   
    
Table table;
String table_name = "0PUR_C01/TW_TEST_CR2";
String table_alias = "0PUR_C01_TW_TEST_CR2";
table = new Table();
table.setName(table_name);
table.setAlias(table_alias);
table.setQualifiedName(table_name);
table.setConnection(new Connection());
table.setConnectionInfo(connectionInfo);
      
reportClientDocument.getDatabaseController().addTable(table, null);

Edited by: Tobias Weller on Feb 25, 2009 3:19 PM

When I build up a connecting in CR I need the SAP integration kit, is there anything similar needed here or is this another problem?